Relaxed the ultra-conservative lock on m_items. Needs testing under linux and stress.
parent
b7f1288361
commit
7c124a5543
|
@ -118,20 +118,20 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// <param name="linkNum">Link number for the part</param>
|
/// <param name="linkNum">Link number for the part</param>
|
||||||
public void ResetInventoryIDs()
|
public void ResetInventoryIDs()
|
||||||
{
|
{
|
||||||
lock (Items)
|
lock (m_items)
|
||||||
{
|
{
|
||||||
if (0 == Items.Count)
|
if (0 == m_items.Count)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
HasInventoryChanged = true;
|
HasInventoryChanged = true;
|
||||||
m_part.ParentGroup.HasGroupChanged = true;
|
m_part.ParentGroup.HasGroupChanged = true;
|
||||||
IList<TaskInventoryItem> items = new List<TaskInventoryItem>(Items.Values);
|
IList<TaskInventoryItem> items = GetInventoryItems();
|
||||||
Items.Clear();
|
m_items.Clear();
|
||||||
|
|
||||||
foreach (TaskInventoryItem item in items)
|
foreach (TaskInventoryItem item in items)
|
||||||
{
|
{
|
||||||
item.ResetIDs(m_part.UUID);
|
item.ResetIDs(m_part.UUID);
|
||||||
Items.Add(item.ItemID, item);
|
m_items.Add(item.ItemID, item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -148,17 +148,17 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
HasInventoryChanged = true;
|
HasInventoryChanged = true;
|
||||||
m_part.ParentGroup.HasGroupChanged = true;
|
m_part.ParentGroup.HasGroupChanged = true;
|
||||||
IList<TaskInventoryItem> items = new List<TaskInventoryItem>(Items.Values);
|
List<TaskInventoryItem> items = GetInventoryItems();
|
||||||
foreach (TaskInventoryItem item in items)
|
foreach (TaskInventoryItem item in items)
|
||||||
|
{
|
||||||
|
if (ownerId != item.OwnerID)
|
||||||
{
|
{
|
||||||
if (ownerId != item.OwnerID)
|
item.LastOwnerID = item.OwnerID;
|
||||||
{
|
item.OwnerID = ownerId;
|
||||||
item.LastOwnerID = item.OwnerID;
|
|
||||||
item.OwnerID = ownerId;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -175,17 +175,15 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
HasInventoryChanged = true;
|
HasInventoryChanged = true;
|
||||||
m_part.ParentGroup.HasGroupChanged = true;
|
m_part.ParentGroup.HasGroupChanged = true;
|
||||||
IList<TaskInventoryItem> items = new List<TaskInventoryItem>(Items.Values);
|
List<TaskInventoryItem> items = GetInventoryItems();
|
||||||
foreach (TaskInventoryItem item in items)
|
foreach (TaskInventoryItem item in items)
|
||||||
{
|
{
|
||||||
if (groupID != item.GroupID)
|
if (groupID != item.GroupID)
|
||||||
{
|
item.GroupID = groupID;
|
||||||
item.GroupID = groupID;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -194,16 +192,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void CreateScriptInstances(int startParam, bool postOnRez, string engine, int stateSource)
|
public void CreateScriptInstances(int startParam, bool postOnRez, string engine, int stateSource)
|
||||||
{
|
{
|
||||||
lock (m_items)
|
List<TaskInventoryItem> scripts = GetInventoryScripts();
|
||||||
{
|
foreach (TaskInventoryItem item in scripts)
|
||||||
foreach (TaskInventoryItem item in Items.Values)
|
CreateScriptInstance(item, startParam, postOnRez, engine, stateSource);
|
||||||
{
|
|
||||||
if ((int)InventoryType.LSL == item.InvType)
|
|
||||||
{
|
|
||||||
CreateScriptInstance(item, startParam, postOnRez, engine, stateSource);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList GetScriptErrors(UUID itemID)
|
public ArrayList GetScriptErrors(UUID itemID)
|
||||||
|
@ -236,16 +227,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// </param>
|
/// </param>
|
||||||
public void RemoveScriptInstances(bool sceneObjectBeingDeleted)
|
public void RemoveScriptInstances(bool sceneObjectBeingDeleted)
|
||||||
{
|
{
|
||||||
lock (Items)
|
List<TaskInventoryItem> scripts = GetInventoryScripts();
|
||||||
{
|
foreach (TaskInventoryItem item in scripts)
|
||||||
foreach (TaskInventoryItem item in Items.Values)
|
RemoveScriptInstance(item.ItemID, sceneObjectBeingDeleted);
|
||||||
{
|
|
||||||
if ((int)InventoryType.LSL == item.InvType)
|
|
||||||
{
|
|
||||||
RemoveScriptInstance(item.ItemID, sceneObjectBeingDeleted);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -375,21 +359,15 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// </param>
|
/// </param>
|
||||||
public void CreateScriptInstance(UUID itemId, int startParam, bool postOnRez, string engine, int stateSource)
|
public void CreateScriptInstance(UUID itemId, int startParam, bool postOnRez, string engine, int stateSource)
|
||||||
{
|
{
|
||||||
lock (m_items)
|
TaskInventoryItem item = GetInventoryItem(itemId);
|
||||||
{
|
if (item != null)
|
||||||
if (m_items.ContainsKey(itemId))
|
CreateScriptInstance(item, startParam, postOnRez, engine, stateSource);
|
||||||
{
|
else
|
||||||
CreateScriptInstance(m_items[itemId], startParam, postOnRez, engine, stateSource);
|
m_log.ErrorFormat(
|
||||||
}
|
"[PRIM INVENTORY]: " +
|
||||||
else
|
"Couldn't start script with ID {0} since it couldn't be found for prim {1}, {2} at {3} in {4}",
|
||||||
{
|
itemId, m_part.Name, m_part.UUID,
|
||||||
m_log.ErrorFormat(
|
m_part.AbsolutePosition, m_part.ParentGroup.Scene.RegionInfo.RegionName);
|
||||||
"[PRIM INVENTORY]: " +
|
|
||||||
"Couldn't start script with ID {0} since it couldn't be found for prim {1}, {2} at {3} in {4}",
|
|
||||||
itemId, m_part.Name, m_part.UUID,
|
|
||||||
m_part.AbsolutePosition, m_part.ParentGroup.Scene.RegionInfo.RegionName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -430,16 +408,18 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Check if the inventory holds an item with a given name.
|
/// Check if the inventory holds an item with a given name.
|
||||||
/// This method assumes that the task inventory is already locked.
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="name"></param>
|
/// <param name="name"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
private bool InventoryContainsName(string name)
|
private bool InventoryContainsName(string name)
|
||||||
{
|
{
|
||||||
foreach (TaskInventoryItem item in Items.Values)
|
lock (m_items)
|
||||||
{
|
{
|
||||||
if (item.Name == name)
|
foreach (TaskInventoryItem item in m_items.Values)
|
||||||
return true;
|
{
|
||||||
|
if (item.Name == name)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -482,12 +462,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// <param name="item"></param>
|
/// <param name="item"></param>
|
||||||
public void AddInventoryItemExclusive(TaskInventoryItem item, bool allowedDrop)
|
public void AddInventoryItemExclusive(TaskInventoryItem item, bool allowedDrop)
|
||||||
{
|
{
|
||||||
List<TaskInventoryItem> il;
|
List<TaskInventoryItem> il = GetInventoryItems();
|
||||||
|
|
||||||
lock (m_items)
|
|
||||||
{
|
|
||||||
il = new List<TaskInventoryItem>(m_items.Values);
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (TaskInventoryItem i in il)
|
foreach (TaskInventoryItem i in il)
|
||||||
{
|
{
|
||||||
|
@ -527,14 +502,12 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
item.GroupID = m_part.GroupID;
|
item.GroupID = m_part.GroupID;
|
||||||
|
|
||||||
lock (m_items)
|
lock (m_items)
|
||||||
{
|
|
||||||
m_items.Add(item.ItemID, item);
|
m_items.Add(item.ItemID, item);
|
||||||
|
|
||||||
if (allowedDrop)
|
if (allowedDrop)
|
||||||
m_part.TriggerScriptChangedEvent(Changed.ALLOWED_DROP);
|
m_part.TriggerScriptChangedEvent(Changed.ALLOWED_DROP);
|
||||||
else
|
else
|
||||||
m_part.TriggerScriptChangedEvent(Changed.INVENTORY);
|
m_part.TriggerScriptChangedEvent(Changed.INVENTORY);
|
||||||
}
|
|
||||||
|
|
||||||
m_inventorySerial++;
|
m_inventorySerial++;
|
||||||
//m_inventorySerial += 2;
|
//m_inventorySerial += 2;
|
||||||
|
@ -558,9 +531,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
m_items.Add(item.ItemID, item);
|
m_items.Add(item.ItemID, item);
|
||||||
// m_part.TriggerScriptChangedEvent(Changed.INVENTORY);
|
// m_part.TriggerScriptChangedEvent(Changed.INVENTORY);
|
||||||
}
|
}
|
||||||
|
m_inventorySerial++;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_inventorySerial++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -615,45 +587,44 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
public bool UpdateInventoryItem(TaskInventoryItem item, bool fireScriptEvents)
|
public bool UpdateInventoryItem(TaskInventoryItem item, bool fireScriptEvents)
|
||||||
{
|
{
|
||||||
lock(m_items)
|
TaskInventoryItem it = GetInventoryItem(item.ItemID);
|
||||||
|
if (it != null)
|
||||||
{
|
{
|
||||||
if (m_items.ContainsKey(item.ItemID))
|
item.ParentID = m_part.UUID;
|
||||||
{
|
item.ParentPartID = m_part.UUID;
|
||||||
if (m_items.ContainsKey(item.ItemID))
|
item.Flags = m_items[item.ItemID].Flags;
|
||||||
{
|
|
||||||
item.ParentID = m_part.UUID;
|
|
||||||
item.ParentPartID = m_part.UUID;
|
|
||||||
item.Flags = m_items[item.ItemID].Flags;
|
|
||||||
|
|
||||||
// If group permissions have been set on, check that the groupID is up to date in case it has
|
// If group permissions have been set on, check that the groupID is up to date in case it has
|
||||||
// changed since permissions were last set.
|
// changed since permissions were last set.
|
||||||
if (item.GroupPermissions != (uint)PermissionMask.None)
|
if (item.GroupPermissions != (uint)PermissionMask.None)
|
||||||
item.GroupID = m_part.GroupID;
|
item.GroupID = m_part.GroupID;
|
||||||
|
|
||||||
if (item.AssetID == UUID.Zero)
|
if (item.AssetID == UUID.Zero)
|
||||||
{
|
item.AssetID = it.AssetID;
|
||||||
item.AssetID = m_items[item.ItemID].AssetID;
|
|
||||||
}
|
|
||||||
m_items[item.ItemID] = item;
|
|
||||||
m_inventorySerial++;
|
|
||||||
if (fireScriptEvents)
|
|
||||||
m_part.TriggerScriptChangedEvent(Changed.INVENTORY);
|
|
||||||
HasInventoryChanged = true;
|
|
||||||
m_part.ParentGroup.HasGroupChanged = true;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_log.ErrorFormat(
|
|
||||||
"[PRIM INVENTORY]: " +
|
|
||||||
"Tried to retrieve item ID {0} from prim {1}, {2} at {3} in {4} but the item does not exist in this inventory",
|
|
||||||
item.ItemID, m_part.Name, m_part.UUID,
|
|
||||||
m_part.AbsolutePosition, m_part.ParentGroup.Scene.RegionInfo.RegionName);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
lock (m_items)
|
||||||
|
{
|
||||||
|
m_items[item.ItemID] = item;
|
||||||
|
m_inventorySerial++;
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
|
if (fireScriptEvents)
|
||||||
|
m_part.TriggerScriptChangedEvent(Changed.INVENTORY);
|
||||||
|
|
||||||
|
HasInventoryChanged = true;
|
||||||
|
m_part.ParentGroup.HasGroupChanged = true;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_log.ErrorFormat(
|
||||||
|
"[PRIM INVENTORY]: " +
|
||||||
|
"Tried to retrieve item ID {0} from prim {1}, {2} at {3} in {4} but the item does not exist in this inventory",
|
||||||
|
item.ItemID, m_part.Name, m_part.UUID,
|
||||||
|
m_part.AbsolutePosition, m_part.ParentGroup.Scene.RegionInfo.RegionName);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -664,52 +635,37 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// in this prim's inventory.</returns>
|
/// in this prim's inventory.</returns>
|
||||||
public int RemoveInventoryItem(UUID itemID)
|
public int RemoveInventoryItem(UUID itemID)
|
||||||
{
|
{
|
||||||
lock (m_items)
|
TaskInventoryItem item = GetInventoryItem(itemID);
|
||||||
|
if (item != null)
|
||||||
{
|
{
|
||||||
if (m_items.ContainsKey(itemID))
|
int type = m_items[itemID].InvType;
|
||||||
|
if (type == 10) // Script
|
||||||
{
|
{
|
||||||
int type = m_items[itemID].InvType;
|
m_part.RemoveScriptEvents(itemID);
|
||||||
if (type == 10) // Script
|
m_part.ParentGroup.Scene.EventManager.TriggerRemoveScript(m_part.LocalId, itemID);
|
||||||
{
|
|
||||||
m_part.RemoveScriptEvents(itemID);
|
|
||||||
m_part.ParentGroup.Scene.EventManager.TriggerRemoveScript(m_part.LocalId, itemID);
|
|
||||||
}
|
|
||||||
m_items.Remove(itemID);
|
|
||||||
m_inventorySerial++;
|
|
||||||
m_part.TriggerScriptChangedEvent(Changed.INVENTORY);
|
|
||||||
|
|
||||||
HasInventoryChanged = true;
|
|
||||||
m_part.ParentGroup.HasGroupChanged = true;
|
|
||||||
|
|
||||||
int scriptcount = 0;
|
|
||||||
lock (m_items)
|
|
||||||
{
|
|
||||||
foreach (TaskInventoryItem item in m_items.Values)
|
|
||||||
{
|
|
||||||
if (item.Type == 10)
|
|
||||||
{
|
|
||||||
scriptcount++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (scriptcount <= 0)
|
|
||||||
{
|
|
||||||
m_part.RemFlag(PrimFlags.Scripted);
|
|
||||||
}
|
|
||||||
|
|
||||||
m_part.ScheduleFullUpdate();
|
|
||||||
|
|
||||||
return type;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_log.ErrorFormat(
|
|
||||||
"[PRIM INVENTORY]: " +
|
|
||||||
"Tried to remove item ID {0} from prim {1}, {2} at {3} in {4} but the item does not exist in this inventory",
|
|
||||||
itemID, m_part.Name, m_part.UUID,
|
|
||||||
m_part.AbsolutePosition, m_part.ParentGroup.Scene.RegionInfo.RegionName);
|
|
||||||
}
|
}
|
||||||
|
m_items.Remove(itemID);
|
||||||
|
m_inventorySerial++;
|
||||||
|
m_part.TriggerScriptChangedEvent(Changed.INVENTORY);
|
||||||
|
|
||||||
|
HasInventoryChanged = true;
|
||||||
|
m_part.ParentGroup.HasGroupChanged = true;
|
||||||
|
|
||||||
|
if (!ContainsScripts())
|
||||||
|
m_part.RemFlag(PrimFlags.Scripted);
|
||||||
|
|
||||||
|
m_part.ScheduleFullUpdate();
|
||||||
|
|
||||||
|
return type;
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_log.ErrorFormat(
|
||||||
|
"[PRIM INVENTORY]: " +
|
||||||
|
"Tried to remove item ID {0} from prim {1}, {2} at {3} in {4} but the item does not exist in this inventory",
|
||||||
|
itemID, m_part.Name, m_part.UUID,
|
||||||
|
m_part.AbsolutePosition, m_part.ParentGroup.Scene.RegionInfo.RegionName);
|
||||||
}
|
}
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -763,52 +719,50 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// isn't available (such as drag from prim inventory to agent inventory)
|
// isn't available (such as drag from prim inventory to agent inventory)
|
||||||
InventoryStringBuilder invString = new InventoryStringBuilder(m_part.UUID, UUID.Zero);
|
InventoryStringBuilder invString = new InventoryStringBuilder(m_part.UUID, UUID.Zero);
|
||||||
|
|
||||||
lock (m_items)
|
List<TaskInventoryItem> items = GetInventoryItems();
|
||||||
|
foreach (TaskInventoryItem item in items)
|
||||||
{
|
{
|
||||||
foreach (TaskInventoryItem item in m_items.Values)
|
UUID ownerID = item.OwnerID;
|
||||||
{
|
uint everyoneMask = 0;
|
||||||
UUID ownerID = item.OwnerID;
|
uint baseMask = item.BasePermissions;
|
||||||
uint everyoneMask = 0;
|
uint ownerMask = item.CurrentPermissions;
|
||||||
uint baseMask = item.BasePermissions;
|
uint groupMask = item.GroupPermissions;
|
||||||
uint ownerMask = item.CurrentPermissions;
|
|
||||||
uint groupMask = item.GroupPermissions;
|
|
||||||
|
|
||||||
invString.AddItemStart();
|
invString.AddItemStart();
|
||||||
invString.AddNameValueLine("item_id", item.ItemID.ToString());
|
invString.AddNameValueLine("item_id", item.ItemID.ToString());
|
||||||
invString.AddNameValueLine("parent_id", m_part.UUID.ToString());
|
invString.AddNameValueLine("parent_id", m_part.UUID.ToString());
|
||||||
|
|
||||||
invString.AddPermissionsStart();
|
invString.AddPermissionsStart();
|
||||||
|
|
||||||
invString.AddNameValueLine("base_mask", Utils.UIntToHexString(baseMask));
|
invString.AddNameValueLine("base_mask", Utils.UIntToHexString(baseMask));
|
||||||
invString.AddNameValueLine("owner_mask", Utils.UIntToHexString(ownerMask));
|
invString.AddNameValueLine("owner_mask", Utils.UIntToHexString(ownerMask));
|
||||||
invString.AddNameValueLine("group_mask", Utils.UIntToHexString(groupMask));
|
invString.AddNameValueLine("group_mask", Utils.UIntToHexString(groupMask));
|
||||||
invString.AddNameValueLine("everyone_mask", Utils.UIntToHexString(everyoneMask));
|
invString.AddNameValueLine("everyone_mask", Utils.UIntToHexString(everyoneMask));
|
||||||
invString.AddNameValueLine("next_owner_mask", Utils.UIntToHexString(item.NextPermissions));
|
invString.AddNameValueLine("next_owner_mask", Utils.UIntToHexString(item.NextPermissions));
|
||||||
|
|
||||||
invString.AddNameValueLine("creator_id", item.CreatorID.ToString());
|
invString.AddNameValueLine("creator_id", item.CreatorID.ToString());
|
||||||
invString.AddNameValueLine("owner_id", ownerID.ToString());
|
invString.AddNameValueLine("owner_id", ownerID.ToString());
|
||||||
|
|
||||||
invString.AddNameValueLine("last_owner_id", item.LastOwnerID.ToString());
|
invString.AddNameValueLine("last_owner_id", item.LastOwnerID.ToString());
|
||||||
|
|
||||||
invString.AddNameValueLine("group_id", item.GroupID.ToString());
|
invString.AddNameValueLine("group_id", item.GroupID.ToString());
|
||||||
invString.AddSectionEnd();
|
invString.AddSectionEnd();
|
||||||
|
|
||||||
invString.AddNameValueLine("asset_id", item.AssetID.ToString());
|
invString.AddNameValueLine("asset_id", item.AssetID.ToString());
|
||||||
invString.AddNameValueLine("type", TaskInventoryItem.Types[item.Type]);
|
invString.AddNameValueLine("type", TaskInventoryItem.Types[item.Type]);
|
||||||
invString.AddNameValueLine("inv_type", TaskInventoryItem.InvTypes[item.InvType]);
|
invString.AddNameValueLine("inv_type", TaskInventoryItem.InvTypes[item.InvType]);
|
||||||
invString.AddNameValueLine("flags", Utils.UIntToHexString(item.Flags));
|
invString.AddNameValueLine("flags", Utils.UIntToHexString(item.Flags));
|
||||||
|
|
||||||
invString.AddSaleStart();
|
invString.AddSaleStart();
|
||||||
invString.AddNameValueLine("sale_type", "not");
|
invString.AddNameValueLine("sale_type", "not");
|
||||||
invString.AddNameValueLine("sale_price", "0");
|
invString.AddNameValueLine("sale_price", "0");
|
||||||
invString.AddSectionEnd();
|
invString.AddSectionEnd();
|
||||||
|
|
||||||
invString.AddNameValueLine("name", item.Name + "|");
|
invString.AddNameValueLine("name", item.Name + "|");
|
||||||
invString.AddNameValueLine("desc", item.Description + "|");
|
invString.AddNameValueLine("desc", item.Description + "|");
|
||||||
|
|
||||||
invString.AddNameValueLine("creation_date", item.CreationDate.ToString());
|
invString.AddNameValueLine("creation_date", item.CreationDate.ToString());
|
||||||
invString.AddSectionEnd();
|
invString.AddSectionEnd();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fileData = Utils.StringToBytes(invString.BuildString);
|
fileData = Utils.StringToBytes(invString.BuildString);
|
||||||
|
@ -830,12 +784,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
if (HasInventoryChanged)
|
if (HasInventoryChanged)
|
||||||
{
|
{
|
||||||
lock (Items)
|
|
||||||
{
|
|
||||||
datastore.StorePrimInventory(m_part.UUID, Items.Values);
|
|
||||||
}
|
|
||||||
|
|
||||||
HasInventoryChanged = false;
|
HasInventoryChanged = false;
|
||||||
|
List<TaskInventoryItem> items = GetInventoryItems();
|
||||||
|
datastore.StorePrimInventory(m_part.UUID, items);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1000,6 +952,30 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<TaskInventoryItem> GetInventoryItems()
|
||||||
|
{
|
||||||
|
List<TaskInventoryItem> ret = new List<TaskInventoryItem>();
|
||||||
|
|
||||||
|
lock (m_items)
|
||||||
|
ret = new List<TaskInventoryItem>(m_items.Values);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<TaskInventoryItem> GetInventoryScripts()
|
||||||
|
{
|
||||||
|
List<TaskInventoryItem> ret = new List<TaskInventoryItem>();
|
||||||
|
|
||||||
|
lock (m_items)
|
||||||
|
{
|
||||||
|
foreach (TaskInventoryItem item in m_items.Values)
|
||||||
|
if (item.InvType == (int)InventoryType.LSL)
|
||||||
|
ret.Add(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
public Dictionary<UUID, string> GetScriptStates()
|
public Dictionary<UUID, string> GetScriptStates()
|
||||||
{
|
{
|
||||||
|
@ -1009,24 +985,20 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
if (engines == null) // No engine at all
|
if (engines == null) // No engine at all
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
lock (m_items)
|
List<TaskInventoryItem> scripts = GetInventoryScripts();
|
||||||
|
|
||||||
|
foreach (TaskInventoryItem item in scripts)
|
||||||
{
|
{
|
||||||
foreach (TaskInventoryItem item in m_items.Values)
|
foreach (IScriptModule e in engines)
|
||||||
{
|
{
|
||||||
if (item.InvType == (int)InventoryType.LSL)
|
if (e != null)
|
||||||
{
|
{
|
||||||
foreach (IScriptModule e in engines)
|
string n = e.GetXMLState(item.ItemID);
|
||||||
|
if (n != String.Empty)
|
||||||
{
|
{
|
||||||
if (e != null)
|
if (!ret.ContainsKey(item.ItemID))
|
||||||
{
|
ret[item.ItemID] = n;
|
||||||
string n = e.GetXMLState(item.ItemID);
|
break;
|
||||||
if (n != String.Empty)
|
|
||||||
{
|
|
||||||
if (!ret.ContainsKey(item.ItemID))
|
|
||||||
ret[item.ItemID] = n;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1041,25 +1013,22 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
if (engines == null)
|
if (engines == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
lock (m_items)
|
List<TaskInventoryItem> scripts = GetInventoryScripts();
|
||||||
|
|
||||||
|
foreach (TaskInventoryItem item in scripts)
|
||||||
{
|
{
|
||||||
foreach (TaskInventoryItem item in m_items.Values)
|
foreach (IScriptModule engine in engines)
|
||||||
{
|
{
|
||||||
if (item.InvType == (int)InventoryType.LSL)
|
if (engine != null)
|
||||||
{
|
{
|
||||||
foreach (IScriptModule engine in engines)
|
if (item.OwnerChanged)
|
||||||
{
|
engine.PostScriptEvent(item.ItemID, "changed", new Object[] { (int)Changed.OWNER });
|
||||||
if (engine != null)
|
item.OwnerChanged = false;
|
||||||
{
|
engine.ResumeScript(item.ItemID);
|
||||||
if (item.OwnerChanged)
|
|
||||||
engine.PostScriptEvent(item.ItemID, "changed", new Object[] { (int)Changed.OWNER });
|
|
||||||
item.OwnerChanged = false;
|
|
||||||
engine.ResumeScript(item.ItemID);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue