aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs')
-rw-r--r--OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs65
1 files changed, 13 insertions, 52 deletions
diff --git a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs
index f640fb8..0404477 100644
--- a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs
+++ b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs
@@ -33,10 +33,7 @@ using libsecondlife;
33using log4net; 33using log4net;
34 34
35namespace OpenSim.Framework.Communications.Cache 35namespace OpenSim.Framework.Communications.Cache
36{ 36{
37 internal delegate void MoveInventoryFolderDelegate(IClientAPI remoteClient, LLUUID folderID, LLUUID parentID);
38 internal delegate void PurgeInventoryDescendentsDelegate(IClientAPI remoteClient, LLUUID folderID);
39
40 /// <summary> 37 /// <summary>
41 /// Holds user profile information and retrieves it from backend services. 38 /// Holds user profile information and retrieves it from backend services.
42 /// </summary> 39 /// </summary>
@@ -199,7 +196,7 @@ namespace OpenSim.Framework.Communications.Cache
199 if (!userProfile.UpdateFolder(name, folderID, type, parentID)) 196 if (!userProfile.UpdateFolder(name, folderID, type, parentID))
200 { 197 {
201 m_log.ErrorFormat( 198 m_log.ErrorFormat(
202 "[AGENT INVENTORY]: Failed to create folder for user {0} {1}", 199 "[AGENT INVENTORY]: Failed to update folder for user {0} {1}",
203 remoteClient.Name, remoteClient.AgentId); 200 remoteClient.Name, remoteClient.AgentId);
204 } 201 }
205 } 202 }
@@ -219,29 +216,15 @@ namespace OpenSim.Framework.Communications.Cache
219 /// <param name="parentID"></param> 216 /// <param name="parentID"></param>
220 public void HandleMoveInventoryFolder(IClientAPI remoteClient, LLUUID folderID, LLUUID parentID) 217 public void HandleMoveInventoryFolder(IClientAPI remoteClient, LLUUID folderID, LLUUID parentID)
221 { 218 {
222// m_log.DebugFormat(
223// "[AGENT INVENTORY]: Moving inventory folder {0} into folder {1} for {2} {3}",
224// parentID, remoteClient.Name, remoteClient.Name, remoteClient.AgentId);
225
226 CachedUserInfo userProfile; 219 CachedUserInfo userProfile;
227 220
228 if (m_userProfiles.TryGetValue(remoteClient.AgentId, out userProfile)) 221 if (m_userProfiles.TryGetValue(remoteClient.AgentId, out userProfile))
229 { 222 {
230 if (userProfile.HasInventory) 223 if (!userProfile.MoveFolder(folderID, parentID))
231 {
232 InventoryFolderBase baseFolder = new InventoryFolderBase();
233 baseFolder.Owner = remoteClient.AgentId;
234 baseFolder.ID = folderID;
235 baseFolder.ParentID = parentID;
236
237 m_commsManager.InventoryService.MoveFolder(baseFolder);
238 }
239 else
240 { 224 {
241 userProfile.AddRequest( 225 m_log.ErrorFormat(
242 new InventoryRequest( 226 "[AGENT INVENTORY]: Failed to move folder for user {0} {1}",
243 Delegate.CreateDelegate(typeof(MoveInventoryFolderDelegate), this, "HandleMoveInventoryFolder"), 227 remoteClient.Name, remoteClient.AgentId);
244 new object[] { remoteClient, folderID, parentID }));
245 } 228 }
246 } 229 }
247 else 230 else
@@ -249,7 +232,7 @@ namespace OpenSim.Framework.Communications.Cache
249 m_log.ErrorFormat( 232 m_log.ErrorFormat(
250 "[AGENT INVENTORY]: Could not find user profile for {0} {1}", 233 "[AGENT INVENTORY]: Could not find user profile for {0} {1}",
251 remoteClient.Name, remoteClient.AgentId); 234 remoteClient.Name, remoteClient.AgentId);
252 } 235 }
253 } 236 }
254 237
255 /// <summary> 238 /// <summary>
@@ -463,37 +446,15 @@ namespace OpenSim.Framework.Communications.Cache
463 /// <param name="folderID"></param> 446 /// <param name="folderID"></param>
464 public void HandlePurgeInventoryDescendents(IClientAPI remoteClient, LLUUID folderID) 447 public void HandlePurgeInventoryDescendents(IClientAPI remoteClient, LLUUID folderID)
465 { 448 {
466// m_log.InfoFormat("[AGENT INVENTORY]: Purging folder {0} for {1} uuid {2}",
467// folderID, remoteClient.Name, remoteClient.AgentId);
468
469 CachedUserInfo userProfile; 449 CachedUserInfo userProfile;
450
470 if (m_userProfiles.TryGetValue(remoteClient.AgentId, out userProfile)) 451 if (m_userProfiles.TryGetValue(remoteClient.AgentId, out userProfile))
471 { 452 {
472 if (userProfile.HasInventory) 453 if (!userProfile.PurgeFolder(folderID))
473 { 454 {
474 InventoryFolderImpl purgedFolder = userProfile.RootFolder.GetDescendentFolder(folderID); 455 m_log.ErrorFormat(
475 if (purgedFolder != null) 456 "[AGENT INVENTORY]: Failed to purge folder for user {0} {1}",
476 { 457 remoteClient.Name, remoteClient.AgentId);
477 // XXX Nasty - have to create a new object to hold details we already have
478 InventoryFolderBase purgedBaseFolder = new InventoryFolderBase();
479 purgedBaseFolder.Owner = purgedFolder.Owner;
480 purgedBaseFolder.ID = purgedFolder.ID;
481 purgedBaseFolder.Name = purgedFolder.Name;
482 purgedBaseFolder.ParentID = purgedFolder.ParentID;
483 purgedBaseFolder.Type = purgedFolder.Type;
484 purgedBaseFolder.Version = purgedFolder.Version;
485
486 m_commsManager.InventoryService.PurgeFolder(purgedBaseFolder);
487
488 purgedFolder.Purge();
489 }
490 }
491 else
492 {
493 userProfile.AddRequest(
494 new InventoryRequest(
495 Delegate.CreateDelegate(typeof(PurgeInventoryDescendentsDelegate), this, "HandlePurgeInventoryDescendents"),
496 new object[] { remoteClient, folderID }));
497 } 458 }
498 } 459 }
499 else 460 else
@@ -501,7 +462,7 @@ namespace OpenSim.Framework.Communications.Cache
501 m_log.ErrorFormat( 462 m_log.ErrorFormat(
502 "[AGENT INVENTORY]: Could not find user profile for {0} {1}", 463 "[AGENT INVENTORY]: Could not find user profile for {0} {1}",
503 remoteClient.Name, remoteClient.AgentId); 464 remoteClient.Name, remoteClient.AgentId);
504 } 465 }
505 } 466 }
506 467
507 public void HandleFetchInventory(IClientAPI remoteClient, LLUUID itemID, LLUUID ownerID) 468 public void HandleFetchInventory(IClientAPI remoteClient, LLUUID itemID, LLUUID ownerID)