aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Framework/Communications/Capabilities/Caps.cs22
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.Inventory.cs110
2 files changed, 89 insertions, 43 deletions
diff --git a/OpenSim/Framework/Communications/Capabilities/Caps.cs b/OpenSim/Framework/Communications/Capabilities/Caps.cs
index a72abbe..e00f49d 100644
--- a/OpenSim/Framework/Communications/Capabilities/Caps.cs
+++ b/OpenSim/Framework/Communications/Capabilities/Caps.cs
@@ -38,18 +38,18 @@ using OpenSim.Framework.Servers;
38namespace OpenSim.Region.Capabilities 38namespace OpenSim.Region.Capabilities
39{ 39{
40 public delegate void UpLoadedAsset( 40 public delegate void UpLoadedAsset(
41 string assetName, string description, LLUUID assetID, LLUUID inventoryItem, LLUUID parentFolder, byte[] data, 41 string assetName, string description, LLUUID assetID, LLUUID inventoryItem, LLUUID parentFolder,
42 string inventoryType, string assetType); 42 byte[] data, string inventoryType, string assetType);
43 43
44 public delegate LLUUID UpdateItem(LLUUID itemID, byte[] data); 44 public delegate LLUUID UpdateItem(LLUUID itemID, byte[] data);
45 45
46 public delegate LLUUID UpdateTaskScript(LLUUID itemID, LLUUID primID, bool isScriptRunning, byte[] data); 46 public delegate void UpdateTaskScript(LLUUID itemID, LLUUID primID, bool isScriptRunning, byte[] data);
47 47
48 public delegate void NewInventoryItem(LLUUID userID, InventoryItemBase item); 48 public delegate void NewInventoryItem(LLUUID userID, InventoryItemBase item);
49 49
50 public delegate LLUUID ItemUpdatedCallback(LLUUID userID, LLUUID itemID, byte[] data); 50 public delegate LLUUID ItemUpdatedCallback(LLUUID userID, LLUUID itemID, byte[] data);
51 51
52 public delegate LLUUID TaskScriptUpdatedCallback(LLUUID userID, LLUUID itemID, LLUUID primID, 52 public delegate void TaskScriptUpdatedCallback(LLUUID userID, LLUUID itemID, LLUUID primID,
53 bool isScriptRunning, byte[] data); 53 bool isScriptRunning, byte[] data);
54 54
55 public class Caps 55 public class Caps
@@ -349,7 +349,10 @@ namespace OpenSim.Region.Capabilities
349 uploadResponse.uploader = uploaderURL; 349 uploadResponse.uploader = uploaderURL;
350 uploadResponse.state = "upload"; 350 uploadResponse.state = "upload";
351 351
352 MainLog.Instance.Verbose("CAPS", "NoteCardAgentInventory response: {0}", LLSDHelpers.SerialiseLLSDReply(uploadResponse)); 352// MainLog.Instance.Verbose(
353// "CAPS",
354// "NoteCardAgentInventory response: {0}",
355// LLSDHelpers.SerialiseLLSDReply(uploadResponse));
353 356
354 return LLSDHelpers.SerialiseLLSDReply(uploadResponse); 357 return LLSDHelpers.SerialiseLLSDReply(uploadResponse);
355 } 358 }
@@ -461,14 +464,12 @@ namespace OpenSim.Region.Capabilities
461 /// <param name="primID">Prim containing item to update</param> 464 /// <param name="primID">Prim containing item to update</param>
462 /// <param name="isScriptRunning">Signals whether the script to update is currently running</param> 465 /// <param name="isScriptRunning">Signals whether the script to update is currently running</param>
463 /// <param name="data">New asset data</param> 466 /// <param name="data">New asset data</param>
464 public LLUUID TaskScriptUpdated(LLUUID itemID, LLUUID primID, bool isScriptRunning, byte[] data) 467 public void TaskScriptUpdated(LLUUID itemID, LLUUID primID, bool isScriptRunning, byte[] data)
465 { 468 {
466 if (TaskScriptUpdatedCall != null) 469 if (TaskScriptUpdatedCall != null)
467 { 470 {
468 return TaskScriptUpdatedCall(m_agentID, itemID, primID, isScriptRunning, data); 471 TaskScriptUpdatedCall(m_agentID, itemID, primID, isScriptRunning, data);
469 } 472 }
470
471 return LLUUID.Zero;
472 } 473 }
473 474
474 public class AssetUploader 475 public class AssetUploader
@@ -661,11 +662,10 @@ namespace OpenSim.Region.Capabilities
661 662
662 string res = ""; 663 string res = "";
663 LLSDTaskInventoryUploadComplete uploadComplete = new LLSDTaskInventoryUploadComplete(); 664 LLSDTaskInventoryUploadComplete uploadComplete = new LLSDTaskInventoryUploadComplete();
664 LLUUID assetID = LLUUID.Zero;
665 665
666 if (OnUpLoad != null) 666 if (OnUpLoad != null)
667 { 667 {
668 assetID = OnUpLoad(inventoryItemID, primID, isScriptRunning, data); 668 OnUpLoad(inventoryItemID, primID, isScriptRunning, data);
669 } 669 }
670 670
671 uploadComplete.item_id = inventoryItemID; 671 uploadComplete.item_id = inventoryItemID;
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