some changes to RequestInventoryFile()
parent
11a8a722df
commit
fa9a4a9a2b
|
@ -48,6 +48,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
private byte[] m_inventoryFileData = new byte[0];
|
private byte[] m_inventoryFileData = new byte[0];
|
||||||
|
private byte[] m_inventoryFileNameBytes = new byte[0];
|
||||||
|
private string m_inventoryFileName = "";
|
||||||
private uint m_inventoryFileNameSerial = 0;
|
private uint m_inventoryFileNameSerial = 0;
|
||||||
private bool m_inventoryPrivileged = false;
|
private bool m_inventoryPrivileged = false;
|
||||||
private object m_inventoryFileLock = new object();
|
private object m_inventoryFileLock = new object();
|
||||||
|
@ -1112,18 +1114,34 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// <param name="xferManager"></param>
|
/// <param name="xferManager"></param>
|
||||||
public void RequestInventoryFile(IClientAPI client, IXfer xferManager)
|
public void RequestInventoryFile(IClientAPI client, IXfer xferManager)
|
||||||
{
|
{
|
||||||
|
|
||||||
lock (m_inventoryFileLock)
|
lock (m_inventoryFileLock)
|
||||||
{
|
{
|
||||||
string filename = "inventory_" + UUID.Random().ToString() + ".tmp";
|
|
||||||
|
|
||||||
bool changed = false;
|
bool changed = false;
|
||||||
if (m_inventoryFileNameSerial < m_inventorySerial)
|
|
||||||
|
Items.LockItemsForRead(true);
|
||||||
|
|
||||||
|
if (m_inventorySerial == 0) // No inventory
|
||||||
|
{
|
||||||
|
Items.LockItemsForRead(false);
|
||||||
|
client.SendTaskInventory(m_part.UUID, 0, new byte[0]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_items.Count == 0) // No inventory
|
||||||
|
{
|
||||||
|
Items.LockItemsForRead(false);
|
||||||
|
client.SendTaskInventory(m_part.UUID, 0, new byte[0]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_inventoryFileNameSerial != m_inventorySerial)
|
||||||
{
|
{
|
||||||
m_inventoryFileNameSerial = m_inventorySerial;
|
m_inventoryFileNameSerial = m_inventorySerial;
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Items.LockItemsForRead(false);
|
||||||
|
|
||||||
if (m_inventoryFileData.Length < 2)
|
if (m_inventoryFileData.Length < 2)
|
||||||
changed = true;
|
changed = true;
|
||||||
|
|
||||||
|
@ -1134,32 +1152,11 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
if (m_inventoryPrivileged != includeAssets)
|
if (m_inventoryPrivileged != includeAssets)
|
||||||
changed = true;
|
changed = true;
|
||||||
|
|
||||||
|
|
||||||
Items.LockItemsForRead(true);
|
|
||||||
|
|
||||||
if (m_inventorySerial == 0) // No inventory
|
|
||||||
{
|
|
||||||
Items.LockItemsForRead(false);
|
|
||||||
client.SendTaskInventory(m_part.UUID, 0, new byte[0]);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_items.Count == 0) // No inventory
|
|
||||||
{
|
|
||||||
Items.LockItemsForRead(false);
|
|
||||||
client.SendTaskInventory(m_part.UUID, 0, new byte[0]);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!changed)
|
if (!changed)
|
||||||
{
|
{
|
||||||
Items.LockItemsForRead(false);
|
xferManager.AddNewFile(m_inventoryFileName, m_inventoryFileData);
|
||||||
|
|
||||||
xferManager.AddNewFile(filename,
|
|
||||||
m_inventoryFileData);
|
|
||||||
client.SendTaskInventory(m_part.UUID, (short)m_inventoryFileNameSerial,
|
client.SendTaskInventory(m_part.UUID, (short)m_inventoryFileNameSerial,
|
||||||
Util.StringToBytes256(filename));
|
m_inventoryFileNameBytes);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1168,6 +1165,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
InventoryStringBuilder invString = new InventoryStringBuilder(m_part.UUID, UUID.Zero);
|
InventoryStringBuilder invString = new InventoryStringBuilder(m_part.UUID, UUID.Zero);
|
||||||
|
|
||||||
|
Items.LockItemsForRead(true);
|
||||||
|
|
||||||
foreach (TaskInventoryItem item in m_items.Values)
|
foreach (TaskInventoryItem item in m_items.Values)
|
||||||
{
|
{
|
||||||
UUID ownerID = item.OwnerID;
|
UUID ownerID = item.OwnerID;
|
||||||
|
@ -1222,9 +1221,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
if (m_inventoryFileData.Length > 2)
|
if (m_inventoryFileData.Length > 2)
|
||||||
{
|
{
|
||||||
xferManager.AddNewFile(filename, m_inventoryFileData);
|
m_inventoryFileName = "inventory_" + UUID.Random().ToString() + ".tmp";
|
||||||
client.SendTaskInventory(m_part.UUID, (short)m_inventoryFileNameSerial,
|
m_inventoryFileNameBytes = Util.StringToBytes256(m_inventoryFileName);
|
||||||
Util.StringToBytes256(filename));
|
xferManager.AddNewFile(m_inventoryFileName, m_inventoryFileData);
|
||||||
|
client.SendTaskInventory(m_part.UUID, (short)m_inventoryFileNameSerial,m_inventoryFileNameBytes);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1267,26 +1267,22 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
AddNameValueLine("obj_id", folderID.ToString());
|
AddNameValueLine("obj_id", folderID.ToString());
|
||||||
AddNameValueLine("parent_id", parentID.ToString());
|
AddNameValueLine("parent_id", parentID.ToString());
|
||||||
AddNameValueLine("type", "category");
|
AddNameValueLine("type", "category");
|
||||||
AddNameValueLine("name", "Contents|");
|
AddNameValueLine("name", "Contents|\n\t}");
|
||||||
AddSectionEnd();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddItemStart()
|
public void AddItemStart()
|
||||||
{
|
{
|
||||||
BuildString.Append("\tinv_item\t0\n");
|
BuildString.Append("\tinv_item\t0\n\t{\n");
|
||||||
AddSectionStart();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddPermissionsStart()
|
public void AddPermissionsStart()
|
||||||
{
|
{
|
||||||
BuildString.Append("\tpermissions 0\n");
|
BuildString.Append("\tpermissions 0\n\t{\n");
|
||||||
AddSectionStart();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddSaleStart()
|
public void AddSaleStart()
|
||||||
{
|
{
|
||||||
BuildString.Append("\tsale_info\t0\n");
|
BuildString.Append("\tsale_info\t0\n\t{\n");
|
||||||
AddSectionStart();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void AddSectionStart()
|
protected void AddSectionStart()
|
||||||
|
@ -1307,8 +1303,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
public void AddNameValueLine(string name, string value)
|
public void AddNameValueLine(string name, string value)
|
||||||
{
|
{
|
||||||
BuildString.Append("\t\t");
|
BuildString.Append("\t\t");
|
||||||
BuildString.Append(name + "\t");
|
BuildString.Append(name);
|
||||||
BuildString.Append(value + "\n");
|
BuildString.Append("\t");
|
||||||
|
BuildString.Append(value);
|
||||||
|
BuildString.Append("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
public String GetString()
|
public String GetString()
|
||||||
|
|
Loading…
Reference in New Issue