Create Scene.Inventory.cs.AddInventoryItem(InventoryItemBase item)
The agentID in AddInventoryItem(UUID agentID, InventoryItemBase item) is redundant since it's contained in item.Owner, and it doesn't make sense for agentID != item.Owner, hence the method is deprecated.prebuild-update
parent
d4b572d2a5
commit
107052b23d
|
@ -163,7 +163,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
|
|||
InventoryFolderBase objsFolder
|
||||
= InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, userId, "Objects")[0];
|
||||
item1.Folder = objsFolder.ID;
|
||||
scene.AddInventoryItem(userId, item1);
|
||||
scene.AddInventoryItem(item1);
|
||||
|
||||
MemoryStream archiveWriteStream = new MemoryStream();
|
||||
archiverModule.OnInventoryArchiveSaved += SaveCompleted;
|
||||
|
@ -282,7 +282,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
|
|||
InventoryFolderBase objsFolder
|
||||
= InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, userId, "Objects")[0];
|
||||
item1.Folder = objsFolder.ID;
|
||||
scene.AddInventoryItem(userId, item1);
|
||||
scene.AddInventoryItem(item1);
|
||||
|
||||
MemoryStream archiveWriteStream = new MemoryStream();
|
||||
archiverModule.OnInventoryArchiveSaved += SaveCompleted;
|
||||
|
@ -485,7 +485,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
|
|||
InventoryFolderBase objsFolder
|
||||
= InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, userId, "Objects")[0];
|
||||
item1.Folder = objsFolder.ID;
|
||||
scene.AddInventoryItem(userId, item1);
|
||||
scene.AddInventoryItem(item1);
|
||||
|
||||
MemoryStream archiveWriteStream = new MemoryStream();
|
||||
archiverModule.OnInventoryArchiveSaved += SaveCompleted;
|
||||
|
|
|
@ -242,9 +242,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
|||
}
|
||||
else
|
||||
{
|
||||
// m_log.WarnFormat(
|
||||
// "[LOCAL INVENTORY SERVICES CONNECTOR]: Could not find root folder for {0} when trying to add item {1} with no parent folder specified",
|
||||
// item.Owner, item.Name);
|
||||
m_log.WarnFormat(
|
||||
"[LOCAL INVENTORY SERVICES CONNECTOR]: Could not find root folder for {0} when trying to add item {1} with no parent folder specified",
|
||||
item.Owner, item.Name);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -92,27 +92,46 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
}
|
||||
}
|
||||
|
||||
public void AddInventoryItem(UUID AgentID, InventoryItemBase item)
|
||||
/// <summary>
|
||||
/// Add the given inventory item to a user's inventory.
|
||||
/// </summary>
|
||||
/// <param name="item"></param>
|
||||
public void AddInventoryItem(InventoryItemBase item)
|
||||
{
|
||||
if (InventoryService.AddItem(item))
|
||||
{
|
||||
int userlevel = 0;
|
||||
if (Permissions.IsGod(AgentID))
|
||||
if (Permissions.IsGod(item.Owner))
|
||||
{
|
||||
userlevel = 1;
|
||||
}
|
||||
EventManager.TriggerOnNewInventoryItemUploadComplete(AgentID, item.AssetID, item.Name, userlevel);
|
||||
EventManager.TriggerOnNewInventoryItemUploadComplete(item.Owner, item.AssetID, item.Name, userlevel);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.WarnFormat(
|
||||
"[AGENT INVENTORY]: Agent {0} could not add item {1} {2}",
|
||||
AgentID, item.Name, item.ID);
|
||||
item.Owner, item.Name, item.ID);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add the given inventory item to a user's inventory.
|
||||
/// </summary>
|
||||
/// <param name="AgentID">
|
||||
/// A <see cref="UUID"/>
|
||||
/// </param>
|
||||
/// <param name="item">
|
||||
/// A <see cref="InventoryItemBase"/>
|
||||
/// </param>
|
||||
[Obsolete("Use AddInventoryItem(InventoryItemBase item) instead. This was deprecated in OpenSim 0.7.1")]
|
||||
public void AddInventoryItem(UUID AgentID, InventoryItemBase item)
|
||||
{
|
||||
AddInventoryItem(item);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add an inventory item to an avatar's inventory.
|
||||
/// </summary>
|
||||
|
@ -121,7 +140,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
/// in which the item is to be placed.</param>
|
||||
public void AddInventoryItem(IClientAPI remoteClient, InventoryItemBase item)
|
||||
{
|
||||
AddInventoryItem(remoteClient.AgentId, item);
|
||||
AddInventoryItem(item);
|
||||
remoteClient.SendInventoryItemCreateUpdate(item, 0);
|
||||
}
|
||||
|
||||
|
@ -1108,7 +1127,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
agentItem.Folder = folderId;
|
||||
|
||||
AddInventoryItem(avatarId, agentItem);
|
||||
AddInventoryItem(agentItem);
|
||||
|
||||
return agentItem;
|
||||
}
|
||||
|
@ -1232,7 +1251,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
{
|
||||
agentItem.Folder = newFolderID;
|
||||
|
||||
AddInventoryItem(destID, agentItem);
|
||||
AddInventoryItem(agentItem);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue