aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2010-09-04 00:09:53 +0100
committerJustin Clark-Casey (justincc)2010-09-04 00:09:53 +0100
commit107052b23db4d16c8d1d5f8c828da7d6f6afd6b4 (patch)
tree211bb13b37b35795ad7264f0ea6e56d4db7942b8 /OpenSim
parentMerge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff)
downloadopensim-SC_OLD-107052b23db4d16c8d1d5f8c828da7d6f6afd6b4.zip
opensim-SC_OLD-107052b23db4d16c8d1d5f8c828da7d6f6afd6b4.tar.gz
opensim-SC_OLD-107052b23db4d16c8d1d5f8c828da7d6f6afd6b4.tar.bz2
opensim-SC_OLD-107052b23db4d16c8d1d5f8c828da7d6f6afd6b4.tar.xz
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.
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs6
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs6
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs35
3 files changed, 33 insertions, 14 deletions
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
163 InventoryFolderBase objsFolder 163 InventoryFolderBase objsFolder
164 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, userId, "Objects")[0]; 164 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, userId, "Objects")[0];
165 item1.Folder = objsFolder.ID; 165 item1.Folder = objsFolder.ID;
166 scene.AddInventoryItem(userId, item1); 166 scene.AddInventoryItem(item1);
167 167
168 MemoryStream archiveWriteStream = new MemoryStream(); 168 MemoryStream archiveWriteStream = new MemoryStream();
169 archiverModule.OnInventoryArchiveSaved += SaveCompleted; 169 archiverModule.OnInventoryArchiveSaved += SaveCompleted;
@@ -282,7 +282,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
282 InventoryFolderBase objsFolder 282 InventoryFolderBase objsFolder
283 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, userId, "Objects")[0]; 283 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, userId, "Objects")[0];
284 item1.Folder = objsFolder.ID; 284 item1.Folder = objsFolder.ID;
285 scene.AddInventoryItem(userId, item1); 285 scene.AddInventoryItem(item1);
286 286
287 MemoryStream archiveWriteStream = new MemoryStream(); 287 MemoryStream archiveWriteStream = new MemoryStream();
288 archiverModule.OnInventoryArchiveSaved += SaveCompleted; 288 archiverModule.OnInventoryArchiveSaved += SaveCompleted;
@@ -485,7 +485,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
485 InventoryFolderBase objsFolder 485 InventoryFolderBase objsFolder
486 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, userId, "Objects")[0]; 486 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, userId, "Objects")[0];
487 item1.Folder = objsFolder.ID; 487 item1.Folder = objsFolder.ID;
488 scene.AddInventoryItem(userId, item1); 488 scene.AddInventoryItem(item1);
489 489
490 MemoryStream archiveWriteStream = new MemoryStream(); 490 MemoryStream archiveWriteStream = new MemoryStream();
491 archiverModule.OnInventoryArchiveSaved += SaveCompleted; 491 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
242 } 242 }
243 else 243 else
244 { 244 {
245// m_log.WarnFormat( 245 m_log.WarnFormat(
246// "[LOCAL INVENTORY SERVICES CONNECTOR]: Could not find root folder for {0} when trying to add item {1} with no parent folder specified", 246 "[LOCAL INVENTORY SERVICES CONNECTOR]: Could not find root folder for {0} when trying to add item {1} with no parent folder specified",
247// item.Owner, item.Name); 247 item.Owner, item.Name);
248 return false; 248 return false;
249 } 249 }
250 } 250 }
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
92 } 92 }
93 } 93 }
94 94
95 public void AddInventoryItem(UUID AgentID, InventoryItemBase item) 95 /// <summary>
96 /// Add the given inventory item to a user's inventory.
97 /// </summary>
98 /// <param name="item"></param>
99 public void AddInventoryItem(InventoryItemBase item)
96 { 100 {
97 if (InventoryService.AddItem(item)) 101 if (InventoryService.AddItem(item))
98 { 102 {
99 int userlevel = 0; 103 int userlevel = 0;
100 if (Permissions.IsGod(AgentID)) 104 if (Permissions.IsGod(item.Owner))
101 { 105 {
102 userlevel = 1; 106 userlevel = 1;
103 } 107 }
104 EventManager.TriggerOnNewInventoryItemUploadComplete(AgentID, item.AssetID, item.Name, userlevel); 108 EventManager.TriggerOnNewInventoryItemUploadComplete(item.Owner, item.AssetID, item.Name, userlevel);
105 } 109 }
106 else 110 else
107 { 111 {
108 m_log.WarnFormat( 112 m_log.WarnFormat(
109 "[AGENT INVENTORY]: Agent {0} could not add item {1} {2}", 113 "[AGENT INVENTORY]: Agent {0} could not add item {1} {2}",
110 AgentID, item.Name, item.ID); 114 item.Owner, item.Name, item.ID);
111 115
112 return; 116 return;
113 } 117 }
118 }
119
120 /// <summary>
121 /// Add the given inventory item to a user's inventory.
122 /// </summary>
123 /// <param name="AgentID">
124 /// A <see cref="UUID"/>
125 /// </param>
126 /// <param name="item">
127 /// A <see cref="InventoryItemBase"/>
128 /// </param>
129 [Obsolete("Use AddInventoryItem(InventoryItemBase item) instead. This was deprecated in OpenSim 0.7.1")]
130 public void AddInventoryItem(UUID AgentID, InventoryItemBase item)
131 {
132 AddInventoryItem(item);
114 } 133 }
115 134
116 /// <summary> 135 /// <summary>
@@ -121,7 +140,7 @@ namespace OpenSim.Region.Framework.Scenes
121 /// in which the item is to be placed.</param> 140 /// in which the item is to be placed.</param>
122 public void AddInventoryItem(IClientAPI remoteClient, InventoryItemBase item) 141 public void AddInventoryItem(IClientAPI remoteClient, InventoryItemBase item)
123 { 142 {
124 AddInventoryItem(remoteClient.AgentId, item); 143 AddInventoryItem(item);
125 remoteClient.SendInventoryItemCreateUpdate(item, 0); 144 remoteClient.SendInventoryItemCreateUpdate(item, 0);
126 } 145 }
127 146
@@ -1108,7 +1127,7 @@ namespace OpenSim.Region.Framework.Scenes
1108 1127
1109 agentItem.Folder = folderId; 1128 agentItem.Folder = folderId;
1110 1129
1111 AddInventoryItem(avatarId, agentItem); 1130 AddInventoryItem(agentItem);
1112 1131
1113 return agentItem; 1132 return agentItem;
1114 } 1133 }
@@ -1232,7 +1251,7 @@ namespace OpenSim.Region.Framework.Scenes
1232 { 1251 {
1233 agentItem.Folder = newFolderID; 1252 agentItem.Folder = newFolderID;
1234 1253
1235 AddInventoryItem(destID, agentItem); 1254 AddInventoryItem(agentItem);
1236 } 1255 }
1237 } 1256 }
1238 1257