diff options
author | Diva Canto | 2009-08-12 20:39:48 -0700 |
---|---|---|
committer | Diva Canto | 2009-08-12 20:39:48 -0700 |
commit | 7aa54593e0b6672979feec97b8151ed134388723 (patch) | |
tree | eaa145993ba39c61f6cbfcd202deb50fbd125fe6 /OpenSim/Region/CoreModules/Avatar | |
parent | * Added two new packet handler implementations for inventory ops. This is sta... (diff) | |
download | opensim-SC-7aa54593e0b6672979feec97b8151ed134388723.zip opensim-SC-7aa54593e0b6672979feec97b8151ed134388723.tar.gz opensim-SC-7aa54593e0b6672979feec97b8151ed134388723.tar.bz2 opensim-SC-7aa54593e0b6672979feec97b8151ed134388723.tar.xz |
Redirected all calls to CachedUserProfile methods to the inventory service. Redirection of the RootFolder property is still todo. This compiles but probably inventory will be inconsistent.
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar')
3 files changed, 83 insertions, 104 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs index b6250a2..49b2b5c 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs | |||
@@ -39,6 +39,7 @@ using OpenSim.Framework.Communications; | |||
39 | using OpenSim.Framework.Communications.Cache; | 39 | using OpenSim.Framework.Communications.Cache; |
40 | using OpenSim.Region.Framework.Interfaces; | 40 | using OpenSim.Region.Framework.Interfaces; |
41 | using OpenSim.Region.Framework.Scenes; | 41 | using OpenSim.Region.Framework.Scenes; |
42 | using OpenSim.Services.Interfaces; | ||
42 | 43 | ||
43 | namespace OpenSim.Region.CoreModules.Avatar.Friends | 44 | namespace OpenSim.Region.CoreModules.Avatar.Friends |
44 | { | 45 | { |
@@ -654,8 +655,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
654 | initiator.ControllingClient.SendAgentOnline(new UUID[] { fromAgentID }); | 655 | initiator.ControllingClient.SendAgentOnline(new UUID[] { fromAgentID }); |
655 | 656 | ||
656 | // find the folder for the friend... | 657 | // find the folder for the friend... |
657 | InventoryFolderImpl folder = | 658 | //InventoryFolderImpl folder = |
658 | initiator.Scene.CommsManager.UserProfileCacheService.GetUserDetails(toAgentID).FindFolderForType((int)InventoryType.CallingCard); | 659 | // initiator.Scene.CommsManager.UserProfileCacheService.GetUserDetails(toAgentID).FindFolderForType((int)InventoryType.CallingCard); |
660 | IInventoryService invService = initiator.Scene.InventoryService; | ||
661 | InventoryFolderBase folder = invService.GetFolderForType(toAgentID, AssetType.CallingCard); | ||
659 | if (folder != null) | 662 | if (folder != null) |
660 | { | 663 | { |
661 | // ... and add the calling card | 664 | // ... and add the calling card |
diff --git a/OpenSim/Region/CoreModules/Avatar/Gestures/GesturesModule.cs b/OpenSim/Region/CoreModules/Avatar/Gestures/GesturesModule.cs index 102feaf..e61648c 100644 --- a/OpenSim/Region/CoreModules/Avatar/Gestures/GesturesModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Gestures/GesturesModule.cs | |||
@@ -33,6 +33,7 @@ using OpenSim.Framework; | |||
33 | using OpenSim.Framework.Communications.Cache; | 33 | using OpenSim.Framework.Communications.Cache; |
34 | using OpenSim.Region.Framework.Interfaces; | 34 | using OpenSim.Region.Framework.Interfaces; |
35 | using OpenSim.Region.Framework.Scenes; | 35 | using OpenSim.Region.Framework.Scenes; |
36 | using OpenSim.Services.Interfaces; | ||
36 | 37 | ||
37 | namespace OpenSim.Region.CoreModules.Avatar.Gestures | 38 | namespace OpenSim.Region.CoreModules.Avatar.Gestures |
38 | { | 39 | { |
@@ -62,42 +63,32 @@ namespace OpenSim.Region.CoreModules.Avatar.Gestures | |||
62 | 63 | ||
63 | public virtual void ActivateGesture(IClientAPI client, UUID assetId, UUID gestureId) | 64 | public virtual void ActivateGesture(IClientAPI client, UUID assetId, UUID gestureId) |
64 | { | 65 | { |
65 | CachedUserInfo userInfo = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(client.AgentId); | 66 | IInventoryService invService = m_scene.InventoryService; |
66 | 67 | ||
67 | if (userInfo != null) | 68 | InventoryItemBase item = invService.QueryItem(new InventoryItemBase(gestureId)); |
69 | if (item != null) | ||
68 | { | 70 | { |
69 | InventoryItemBase item = userInfo.RootFolder.FindItem(gestureId); | 71 | item.Flags = 1; |
70 | if (item != null) | 72 | invService.UpdateItem(item); |
71 | { | ||
72 | item.Flags = 1; | ||
73 | userInfo.UpdateItem(item); | ||
74 | } | ||
75 | else | ||
76 | m_log.ErrorFormat( | ||
77 | "[GESTURES]: Unable to find gesture to activate {0} for {1}", gestureId, client.Name); | ||
78 | } | 73 | } |
79 | else | 74 | else |
80 | m_log.ErrorFormat("[GESTURES]: Unable to find user {0}", client.Name); | 75 | m_log.WarnFormat( |
76 | "[GESTURES]: Unable to find gesture {0} to activate for {1}", gestureId, client.Name); | ||
81 | } | 77 | } |
82 | 78 | ||
83 | public virtual void DeactivateGesture(IClientAPI client, UUID gestureId) | 79 | public virtual void DeactivateGesture(IClientAPI client, UUID gestureId) |
84 | { | 80 | { |
85 | CachedUserInfo userInfo = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(client.AgentId); | 81 | IInventoryService invService = m_scene.InventoryService; |
86 | 82 | ||
87 | if (userInfo != null) | 83 | InventoryItemBase item = invService.QueryItem(new InventoryItemBase(gestureId)); |
84 | if (item != null) | ||
88 | { | 85 | { |
89 | InventoryItemBase item = userInfo.RootFolder.FindItem(gestureId); | 86 | item.Flags = 0; |
90 | if (item != null) | 87 | invService.UpdateItem(item); |
91 | { | ||
92 | item.Flags = 0; | ||
93 | userInfo.UpdateItem(item); | ||
94 | } | ||
95 | else | ||
96 | m_log.ErrorFormat( | ||
97 | "[GESTURES]: Unable to find gesture to deactivate {0} for {1}", gestureId, client.Name); | ||
98 | } | 88 | } |
99 | else | 89 | else |
100 | m_log.ErrorFormat("[GESTURES]: Unable to find user {0}", client.Name); | 90 | m_log.ErrorFormat( |
91 | "[GESTURES]: Unable to find gesture to deactivate {0} for {1}", gestureId, client.Name); | ||
101 | } | 92 | } |
102 | } | 93 | } |
103 | } \ No newline at end of file | 94 | } \ No newline at end of file |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs index 811d4cc..b5650fd 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs | |||
@@ -35,6 +35,7 @@ using OpenSim.Framework; | |||
35 | using OpenSim.Framework.Communications.Cache; | 35 | using OpenSim.Framework.Communications.Cache; |
36 | using OpenSim.Region.Framework.Interfaces; | 36 | using OpenSim.Region.Framework.Interfaces; |
37 | using OpenSim.Region.Framework.Scenes; | 37 | using OpenSim.Region.Framework.Scenes; |
38 | using OpenSim.Services.Interfaces; | ||
38 | 39 | ||
39 | namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | 40 | namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer |
40 | { | 41 | { |
@@ -154,7 +155,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | |||
154 | "into agent {1}'s inventory", | 155 | "into agent {1}'s inventory", |
155 | folderID, new UUID(im.toAgentID)); | 156 | folderID, new UUID(im.toAgentID)); |
156 | 157 | ||
157 | InventoryFolderImpl folderCopy | 158 | InventoryFolderBase folderCopy |
158 | = scene.GiveInventoryFolder(new UUID(im.toAgentID), client.AgentId, folderID, UUID.Zero); | 159 | = scene.GiveInventoryFolder(new UUID(im.toAgentID), client.AgentId, folderID, UUID.Zero); |
159 | 160 | ||
160 | if (folderCopy == null) | 161 | if (folderCopy == null) |
@@ -247,52 +248,51 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | |||
247 | // It will have been pushed to the client, too | 248 | // It will have been pushed to the client, too |
248 | // | 249 | // |
249 | 250 | ||
250 | CachedUserInfo userInfo = | 251 | //CachedUserInfo userInfo = |
251 | scene.CommsManager.UserProfileCacheService. | 252 | // scene.CommsManager.UserProfileCacheService. |
252 | GetUserDetails(client.AgentId); | 253 | // GetUserDetails(client.AgentId); |
254 | IInventoryService invService = scene.InventoryService; | ||
253 | 255 | ||
254 | if (userInfo != null) | 256 | InventoryFolderBase trashFolder = |
255 | { | 257 | invService.GetFolderForType(client.AgentId, AssetType.TrashFolder); |
256 | InventoryFolderImpl trashFolder = | 258 | |
257 | userInfo.FindFolderForType((int)AssetType.TrashFolder); | 259 | UUID inventoryEntityID = new UUID(im.imSessionID); // The inventory item/folder, back from it's trip |
258 | |||
259 | UUID inventoryEntityID = new UUID(im.imSessionID); // The inventory item/folder, back from it's trip | ||
260 | |||
261 | InventoryItemBase item = userInfo.RootFolder.FindItem(inventoryEntityID); | ||
262 | InventoryFolderBase folder = null; | ||
263 | 260 | ||
264 | if (item != null && trashFolder != null) | 261 | InventoryItemBase item = invService.QueryItem(new InventoryItemBase(inventoryEntityID)); |
265 | { | 262 | InventoryFolderBase folder = null; |
266 | item.Folder = trashFolder.ID; | 263 | |
267 | 264 | if (item != null && trashFolder != null) | |
268 | userInfo.DeleteItem(inventoryEntityID); | 265 | { |
266 | item.Folder = trashFolder.ID; | ||
269 | 267 | ||
270 | scene.AddInventoryItem(client, item); | 268 | // Diva comment: can't we just update this item??? |
271 | } | 269 | invService.DeleteItem(item); |
272 | else | 270 | scene.AddInventoryItem(client, item); |
271 | } | ||
272 | else | ||
273 | { | ||
274 | folder = invService.QueryFolder(new InventoryFolderBase(inventoryEntityID)); | ||
275 | |||
276 | if (folder != null & trashFolder != null) | ||
273 | { | 277 | { |
274 | folder = userInfo.RootFolder.FindFolder(inventoryEntityID); | 278 | folder.ParentID = trashFolder.ID; |
275 | 279 | invService.MoveFolder(folder); | |
276 | if (folder != null & trashFolder != null) | ||
277 | { | ||
278 | userInfo.MoveFolder(inventoryEntityID, trashFolder.ID); | ||
279 | } | ||
280 | } | 280 | } |
281 | } | ||
282 | |||
283 | if ((null == item && null == folder) | null == trashFolder) | ||
284 | { | ||
285 | string reason = String.Empty; | ||
281 | 286 | ||
282 | if ((null == item && null == folder) | null == trashFolder) | 287 | if (trashFolder == null) |
283 | { | 288 | reason += " Trash folder not found."; |
284 | string reason = String.Empty; | 289 | if (item == null) |
285 | 290 | reason += " Item not found."; | |
286 | if (trashFolder == null) | 291 | if (folder == null) |
287 | reason += " Trash folder not found."; | 292 | reason += " Folder not found."; |
288 | if (item == null) | 293 | |
289 | reason += " Item not found."; | 294 | client.SendAgentAlertMessage("Unable to delete "+ |
290 | if (folder == null) | 295 | "received inventory" + reason, false); |
291 | reason += " Folder not found."; | ||
292 | |||
293 | client.SendAgentAlertMessage("Unable to delete "+ | ||
294 | "received inventory" + reason, false); | ||
295 | } | ||
296 | } | 296 | } |
297 | 297 | ||
298 | ScenePresence user = scene.GetScenePresence(new UUID(im.toAgentID)); | 298 | ScenePresence user = scene.GetScenePresence(new UUID(im.toAgentID)); |
@@ -405,17 +405,18 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | |||
405 | return; | 405 | return; |
406 | } | 406 | } |
407 | 407 | ||
408 | CachedUserInfo userInfo = | 408 | //CachedUserInfo userInfo = |
409 | scene.CommsManager.UserProfileCacheService. | 409 | // scene.CommsManager.UserProfileCacheService. |
410 | GetUserDetails(user.ControllingClient.AgentId); | 410 | // GetUserDetails(user.ControllingClient.AgentId); |
411 | 411 | ||
412 | if (userInfo == null) | 412 | //if (userInfo == null) |
413 | { | 413 | //{ |
414 | m_log.Debug("[INVENTORY TRANSFER] Can't find user info of recipient"); | 414 | // m_log.Debug("[INVENTORY TRANSFER] Can't find user info of recipient"); |
415 | return; | 415 | // return; |
416 | } | 416 | //} |
417 | 417 | ||
418 | AssetType assetType = (AssetType)msg.binaryBucket[0]; | 418 | AssetType assetType = (AssetType)msg.binaryBucket[0]; |
419 | IInventoryService invService = scene.InventoryService; | ||
419 | 420 | ||
420 | if (AssetType.Folder == assetType) | 421 | if (AssetType.Folder == assetType) |
421 | { | 422 | { |
@@ -425,31 +426,23 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | |||
425 | folder.ID = folderID; | 426 | folder.ID = folderID; |
426 | folder.Owner = user.ControllingClient.AgentId; | 427 | folder.Owner = user.ControllingClient.AgentId; |
427 | 428 | ||
428 | // Fetch from database | 429 | // Fetch from service |
429 | // | 430 | // |
430 | if (!userInfo.QueryFolder(folder)) | 431 | folder = invService.QueryFolder(folder); |
432 | if (folder == null) | ||
431 | { | 433 | { |
432 | m_log.Debug("[INVENTORY TRANSFER] Can't find folder to give"); | 434 | m_log.Debug("[INVENTORY TRANSFER] Can't find folder to give"); |
433 | return; | 435 | return; |
434 | } | 436 | } |
435 | 437 | ||
436 | // Get folder info | 438 | user.ControllingClient.SendBulkUpdateInventory(folder); |
437 | // | ||
438 | InventoryFolderImpl folderInfo = userInfo.RootFolder.FindFolder(folder.ID); | ||
439 | if (folderInfo == null) | ||
440 | { | ||
441 | m_log.Debug("[INVENTORY TRANSFER] Can't retrieve folder to give"); | ||
442 | return; | ||
443 | } | ||
444 | |||
445 | user.ControllingClient.SendBulkUpdateInventory(folderInfo); | ||
446 | 439 | ||
447 | // This unelegant, slow kludge is to reload the folders and | 440 | //// This unelegant, slow kludge is to reload the folders and |
448 | // items. Since a folder give can transfer subfolders and | 441 | //// items. Since a folder give can transfer subfolders and |
449 | // items, this is the easiest way to pull that stuff in | 442 | //// items, this is the easiest way to pull that stuff in |
450 | // | 443 | //// |
451 | userInfo.DropInventory(); | 444 | //userInfo.DropInventory(); |
452 | userInfo.FetchInventory(); | 445 | //userInfo.FetchInventory(); |
453 | 446 | ||
454 | // Deliver message | 447 | // Deliver message |
455 | // | 448 | // |
@@ -463,20 +456,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | |||
463 | item.ID = itemID; | 456 | item.ID = itemID; |
464 | item.Owner = user.ControllingClient.AgentId; | 457 | item.Owner = user.ControllingClient.AgentId; |
465 | 458 | ||
466 | // Fetch from database | 459 | // Fetch from service |
467 | // | ||
468 | if (!userInfo.QueryItem(item)) | ||
469 | { | ||
470 | m_log.Debug("[INVENTORY TRANSFER] Can't find item to give"); | ||
471 | return; | ||
472 | } | ||
473 | |||
474 | // Get item info | ||
475 | // | 460 | // |
476 | item = userInfo.RootFolder.FindItem(item.ID); | 461 | item = invService.QueryItem(item); |
477 | if (item == null) | 462 | if (item == null) |
478 | { | 463 | { |
479 | m_log.Debug("[INVENTORY TRANSFER] Can't retrieve item to give"); | 464 | m_log.Debug("[INVENTORY TRANSFER] Can't find item to give"); |
480 | return; | 465 | return; |
481 | } | 466 | } |
482 | 467 | ||