From 107052b23db4d16c8d1d5f8c828da7d6f6afd6b4 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Sat, 4 Sep 2010 00:09:53 +0100
Subject: 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.
---
.../Archiver/Tests/InventoryArchiverTests.cs | 6 ++--
.../Inventory/LocalInventoryServiceConnector.cs | 6 ++--
OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 35 +++++++++++++++++-----
3 files changed, 33 insertions(+), 14 deletions(-)
(limited to 'OpenSim')
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
index 0218f86..d66a1d0 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
@@ -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;
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs
index 915b59e..06b40b3 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs
@@ -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;
}
}
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index 0674e62..7cedde0 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -92,25 +92,44 @@ namespace OpenSim.Region.Framework.Scenes
}
}
- public void AddInventoryItem(UUID AgentID, InventoryItemBase item)
+ ///
+ /// Add the given inventory item to a user's inventory.
+ ///
+ ///
+ 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;
- }
+ }
+ }
+
+ ///
+ /// Add the given inventory item to a user's inventory.
+ ///
+ ///
+ /// A
+ ///
+ ///
+ /// A
+ ///
+ [Obsolete("Use AddInventoryItem(InventoryItemBase item) instead. This was deprecated in OpenSim 0.7.1")]
+ public void AddInventoryItem(UUID AgentID, InventoryItemBase item)
+ {
+ AddInventoryItem(item);
}
///
@@ -121,7 +140,7 @@ namespace OpenSim.Region.Framework.Scenes
/// in which the item is to be placed.
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);
}
}
--
cgit v1.1