diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.Inventory.cs | 110 |
1 files changed, 78 insertions, 32 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs index 531e8de..c087c59 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs | |||
@@ -41,17 +41,13 @@ namespace OpenSim.Region.Environment.Scenes | |||
41 | { | 41 | { |
42 | //split these method into this partial as a lot of these (hopefully) are only temporary and won't be needed once Caps is more complete | 42 | //split these method into this partial as a lot of these (hopefully) are only temporary and won't be needed once Caps is more complete |
43 | // or at least some of they can be moved somewhere else | 43 | // or at least some of they can be moved somewhere else |
44 | 44 | ||
45 | public void AddInventoryItem(LLUUID avatarId, InventoryItemBase item) | 45 | /// <summary> |
46 | { | 46 | /// Add an inventory item to an avatar's inventory. |
47 | ScenePresence avatar; | 47 | /// </summary> |
48 | 48 | /// <param name="remoteClient">The remote client controlling the avatar</param> | |
49 | if (TryGetAvatar(avatarId, out avatar)) | 49 | /// <param name="item">The item. This structure contains all the item metadata, including the folder |
50 | { | 50 | /// in which the item is to be placed.</param> |
51 | AddInventoryItem(avatar.ControllingClient, item); | ||
52 | } | ||
53 | } | ||
54 | |||
55 | public void AddInventoryItem(IClientAPI remoteClient, InventoryItemBase item) | 51 | public void AddInventoryItem(IClientAPI remoteClient, InventoryItemBase item) |
56 | { | 52 | { |
57 | CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); | 53 | CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); |
@@ -61,17 +57,25 @@ namespace OpenSim.Region.Environment.Scenes | |||
61 | remoteClient.SendInventoryItemCreateUpdate(item); | 57 | remoteClient.SendInventoryItemCreateUpdate(item); |
62 | } | 58 | } |
63 | } | 59 | } |
64 | 60 | ||
65 | public LLUUID CapsUpdateInventoryItemAsset(LLUUID avatarId, LLUUID itemID, byte[] data) | 61 | /// <summary> |
62 | /// <see>AddInventoryItem(LLUUID, InventoryItemBase)</see> | ||
63 | /// </summary> | ||
64 | /// <param name="avatarId">The ID of the avatar</param> | ||
65 | /// <param name="item">The item. This structure contains all the item metadata, including the folder | ||
66 | /// in which the item is to be placed.</param> | ||
67 | public void AddInventoryItem(LLUUID avatarId, InventoryItemBase item) | ||
66 | { | 68 | { |
67 | ScenePresence avatar; | 69 | ScenePresence avatar; |
68 | 70 | ||
69 | if (TryGetAvatar(avatarId, out avatar)) | 71 | if (!TryGetAvatar(avatarId, out avatar)) |
70 | { | 72 | { |
71 | return CapsUpdateInventoryItemAsset(avatar.ControllingClient, itemID, data); | 73 | MainLog.Instance.Error( |
74 | "AGENTINVENTORY", "Could not find avatar {0} to add inventory item", avatarId); | ||
75 | return; | ||
72 | } | 76 | } |
73 | 77 | ||
74 | return LLUUID.Zero; | 78 | AddInventoryItem(avatar.ControllingClient, item); |
75 | } | 79 | } |
76 | 80 | ||
77 | /// <summary> | 81 | /// <summary> |
@@ -115,6 +119,28 @@ namespace OpenSim.Region.Environment.Scenes | |||
115 | } | 119 | } |
116 | 120 | ||
117 | /// <summary> | 121 | /// <summary> |
122 | /// <see>CapsUpdatedInventoryItemAsset(IClientAPI, LLUUID, byte[])</see> | ||
123 | /// </summary> | ||
124 | private LLUUID CapsUpdateInventoryItemAsset(LLUUID avatarId, LLUUID itemID, byte[] data) | ||
125 | { | ||
126 | ScenePresence avatar; | ||
127 | |||
128 | if (TryGetAvatar(avatarId, out avatar)) | ||
129 | { | ||
130 | return CapsUpdateInventoryItemAsset(avatar.ControllingClient, itemID, data); | ||
131 | } | ||
132 | else | ||
133 | { | ||
134 | MainLog.Instance.Error( | ||
135 | "AGENTINVENTORY", | ||
136 | "Avatar {0} cannot be found to update its inventory item asset", | ||
137 | avatarId); | ||
138 | } | ||
139 | |||
140 | return LLUUID.Zero; | ||
141 | } | ||
142 | |||
143 | /// <summary> | ||
118 | /// Capability originating call to update the asset of a script in a prim's (task's) inventory | 144 | /// Capability originating call to update the asset of a script in a prim's (task's) inventory |
119 | /// </summary> | 145 | /// </summary> |
120 | /// <param name="remoteClient"></param> | 146 | /// <param name="remoteClient"></param> |
@@ -123,8 +149,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
123 | /// <param name="isScriptRunning">Indicates whether the script to update is currently running</param> | 149 | /// <param name="isScriptRunning">Indicates whether the script to update is currently running</param> |
124 | /// <param name="data"></param> | 150 | /// <param name="data"></param> |
125 | /// <returns>Asset LLUID created</returns> | 151 | /// <returns>Asset LLUID created</returns> |
126 | public LLUUID CapsUpdateTaskInventoryScriptAsset(LLUUID avatarID, LLUUID itemID, | 152 | public void CapsUpdateTaskInventoryScriptAsset(IClientAPI remoteClient, LLUUID itemId, |
127 | LLUUID primID, bool isScriptRunning, byte[] data) | 153 | LLUUID primId, bool isScriptRunning, byte[] data) |
128 | { | 154 | { |
129 | // TODO Not currently doing anything with the isScriptRunning bool | 155 | // TODO Not currently doing anything with the isScriptRunning bool |
130 | 156 | ||
@@ -132,7 +158,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
132 | "PRIMINVENTORY", | 158 | "PRIMINVENTORY", |
133 | "Prim inventory script save functionality not yet implemented." | 159 | "Prim inventory script save functionality not yet implemented." |
134 | + " remoteClient: {0}, itemID: {1}, primID: {2}, isScriptRunning: {3}", | 160 | + " remoteClient: {0}, itemID: {1}, primID: {2}, isScriptRunning: {3}", |
135 | avatarID, itemID, primID, isScriptRunning); | 161 | remoteClient, itemId, primId, isScriptRunning); |
136 | 162 | ||
137 | // TODO | 163 | // TODO |
138 | // Retrieve client LLUID | 164 | // Retrieve client LLUID |
@@ -143,8 +169,28 @@ namespace OpenSim.Region.Environment.Scenes | |||
143 | // Trigger SOG update (see RezScript) | 169 | // Trigger SOG update (see RezScript) |
144 | // Trigger rerunning of script (use TriggerRezScript event, see RezScript) | 170 | // Trigger rerunning of script (use TriggerRezScript event, see RezScript) |
145 | // return new asset id | 171 | // return new asset id |
146 | 172 | } | |
147 | return null; | 173 | |
174 | /// <summary> | ||
175 | /// <see>CapsUpdateTaskInventoryScriptAsset(IClientAPI, LLUUID, LLUUID, bool, byte[])</see> | ||
176 | /// </summary> | ||
177 | private void CapsUpdateTaskInventoryScriptAsset(LLUUID avatarId, LLUUID itemId, | ||
178 | LLUUID primId, bool isScriptRunning, byte[] data) | ||
179 | { | ||
180 | ScenePresence avatar; | ||
181 | |||
182 | if (TryGetAvatar(avatarId, out avatar)) | ||
183 | { | ||
184 | CapsUpdateTaskInventoryScriptAsset( | ||
185 | avatar.ControllingClient, itemId, primId, isScriptRunning, data); | ||
186 | } | ||
187 | else | ||
188 | { | ||
189 | MainLog.Instance.Error( | ||
190 | "PRIMINVENTORY", | ||
191 | "Avatar {0} cannot be found to update its prim item asset", | ||
192 | avatarId); | ||
193 | } | ||
148 | } | 194 | } |
149 | 195 | ||
150 | /// <summary> | 196 | /// <summary> |
@@ -213,14 +259,14 @@ namespace OpenSim.Region.Environment.Scenes | |||
213 | else | 259 | else |
214 | { | 260 | { |
215 | MainLog.Instance.Warn( | 261 | MainLog.Instance.Warn( |
216 | "INVENTORY", | 262 | "AGENTINVENTORY", |
217 | "Item ID " + itemID + " not found for an inventory item update."); | 263 | "Item ID " + itemID + " not found for an inventory item update."); |
218 | } | 264 | } |
219 | } | 265 | } |
220 | else | 266 | else |
221 | { | 267 | { |
222 | MainLog.Instance.Warn( | 268 | MainLog.Instance.Warn( |
223 | "INVENTORY", | 269 | "AGENTINVENTORY", |
224 | "Agent ID " + remoteClient.AgentId + " not found for an inventory item update."); | 270 | "Agent ID " + remoteClient.AgentId + " not found for an inventory item update."); |
225 | } | 271 | } |
226 | } | 272 | } |
@@ -233,7 +279,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
233 | CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(oldAgentID); | 279 | CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(oldAgentID); |
234 | if (userInfo == null) | 280 | if (userInfo == null) |
235 | { | 281 | { |
236 | MainLog.Instance.Warn("INVENTORY", "Failed to find user " + oldAgentID.ToString()); | 282 | MainLog.Instance.Warn("AGENTINVENTORY", "Failed to find user " + oldAgentID.ToString()); |
237 | return; | 283 | return; |
238 | } | 284 | } |
239 | 285 | ||
@@ -242,13 +288,13 @@ namespace OpenSim.Region.Environment.Scenes | |||
242 | item = userInfo.RootFolder.HasItem(oldItemID); | 288 | item = userInfo.RootFolder.HasItem(oldItemID); |
243 | if (item == null) | 289 | if (item == null) |
244 | { | 290 | { |
245 | MainLog.Instance.Warn("INVENTORY", "Failed to find item " + oldItemID.ToString()); | 291 | MainLog.Instance.Warn("AGENTINVENTORY", "Failed to find item " + oldItemID.ToString()); |
246 | return; | 292 | return; |
247 | } | 293 | } |
248 | } | 294 | } |
249 | else | 295 | else |
250 | { | 296 | { |
251 | MainLog.Instance.Warn("INVENTORY", "Failed to find item " + oldItemID.ToString()); | 297 | MainLog.Instance.Warn("AGENTINVENTORY", "Failed to find item " + oldItemID.ToString()); |
252 | return; | 298 | return; |
253 | } | 299 | } |
254 | } | 300 | } |
@@ -257,7 +303,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
257 | AssetBase asset = AssetCache.CopyAsset(item.assetID); | 303 | AssetBase asset = AssetCache.CopyAsset(item.assetID); |
258 | if (asset == null) | 304 | if (asset == null) |
259 | { | 305 | { |
260 | MainLog.Instance.Warn("INVENTORY", "Failed to find asset " + item.assetID.ToString()); | 306 | MainLog.Instance.Warn("AGENTINVENTORY", "Failed to find asset " + item.assetID.ToString()); |
261 | return; | 307 | return; |
262 | } | 308 | } |
263 | 309 | ||
@@ -282,13 +328,13 @@ namespace OpenSim.Region.Environment.Scenes | |||
282 | public void MoveInventoryItem(IClientAPI remoteClient,LLUUID folderID, LLUUID itemID, int length, string newName) | 328 | public void MoveInventoryItem(IClientAPI remoteClient,LLUUID folderID, LLUUID itemID, int length, string newName) |
283 | { | 329 | { |
284 | MainLog.Instance.Verbose( | 330 | MainLog.Instance.Verbose( |
285 | "INVENTORY", | 331 | "AGENTINVENTORY", |
286 | "Moving item for " + remoteClient.AgentId.ToString()); | 332 | "Moving item for " + remoteClient.AgentId.ToString()); |
287 | 333 | ||
288 | CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); | 334 | CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); |
289 | if (userInfo == null) | 335 | if (userInfo == null) |
290 | { | 336 | { |
291 | MainLog.Instance.Warn("INVENTORY", "Failed to find user " + remoteClient.AgentId.ToString()); | 337 | MainLog.Instance.Warn("AGENTINVENTORY", "Failed to find user " + remoteClient.AgentId.ToString()); |
292 | return; | 338 | return; |
293 | } | 339 | } |
294 | 340 | ||
@@ -309,13 +355,13 @@ namespace OpenSim.Region.Environment.Scenes | |||
309 | } | 355 | } |
310 | else | 356 | else |
311 | { | 357 | { |
312 | MainLog.Instance.Warn("INVENTORY", "Failed to find item " + itemID.ToString()); | 358 | MainLog.Instance.Warn("AGENTINVENTORY", "Failed to find item " + itemID.ToString()); |
313 | return; | 359 | return; |
314 | } | 360 | } |
315 | } | 361 | } |
316 | else | 362 | else |
317 | { | 363 | { |
318 | MainLog.Instance.Warn("INVENTORY", "Failed to find item " + itemID.ToString() + ", no root folder"); | 364 | MainLog.Instance.Warn("AGENTINVENTORY", "Failed to find item " + itemID.ToString() + ", no root folder"); |
319 | return; | 365 | return; |
320 | } | 366 | } |
321 | 367 | ||