aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorJustin Clarke Casey2008-12-09 18:35:09 +0000
committerJustin Clarke Casey2008-12-09 18:35:09 +0000
commit762712c02e4abf332d2d9a0ba583d6fe6f406aff (patch)
tree673471a2715e6a73dc051dbbd5b8dbed57cde8c2 /OpenSim
parent* Apply terrain flip patch from http://opensimulator.org/mantis/view.php?id=2315 (diff)
downloadopensim-SC_OLD-762712c02e4abf332d2d9a0ba583d6fe6f406aff.zip
opensim-SC_OLD-762712c02e4abf332d2d9a0ba583d6fe6f406aff.tar.gz
opensim-SC_OLD-762712c02e4abf332d2d9a0ba583d6fe6f406aff.tar.bz2
opensim-SC_OLD-762712c02e4abf332d2d9a0ba583d6fe6f406aff.tar.xz
* Actually update subfolders of parent folders in the inventory cache when a folder gets moved
* This was causing inventory folder transfer code to not work properly (this is still temporarily disabled)
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Framework/Communications/Cache/CachedUserInfo.cs34
-rw-r--r--OpenSim/Framework/Communications/Cache/InventoryFolderImpl.cs36
-rw-r--r--OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs4
3 files changed, 65 insertions, 9 deletions
diff --git a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
index b4e7bfa..c8656d5 100644
--- a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
+++ b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
@@ -397,14 +397,14 @@ namespace OpenSim.Framework.Communications.Cache
397 397
398 /// <summary> 398 /// <summary>
399 /// Handle a client request to update the inventory folder 399 /// Handle a client request to update the inventory folder
400 /// </summary>
400 /// 401 ///
401 /// If the inventory service has not yet delievered the inventory 402 /// If the inventory service has not yet delievered the inventory
402 /// for this user then the request will be queued. 403 /// for this user then the request will be queued.
403 /// 404 ///
404 /// FIXME: We call add new inventory folder because in the data layer, we happen to use an SQL REPLACE 405 /// FIXME: We call add new inventory folder because in the data layer, we happen to use an SQL REPLACE
405 /// so this will work to rename an existing folder. Needless to say, to rely on this is very confusing, 406 /// so this will work to rename an existing folder. Needless to say, to rely on this is very confusing,
406 /// and needs to be changed. 407 /// and needs to be changed.
407 /// </summary>
408 /// 408 ///
409 /// <param name="folderID"></param> 409 /// <param name="folderID"></param>
410 /// <param name="type"></param> 410 /// <param name="type"></param>
@@ -461,6 +461,10 @@ namespace OpenSim.Framework.Communications.Cache
461 /// 461 ///
462 /// <param name="folderID"></param> 462 /// <param name="folderID"></param>
463 /// <param name="parentID"></param> 463 /// <param name="parentID"></param>
464 /// <returns>
465 /// true if the delete was successful, or if it was queued pending folder receipt
466 /// false if the folder to be deleted did not exist.
467 /// </returns>
464 public bool MoveFolder(UUID folderID, UUID parentID) 468 public bool MoveFolder(UUID folderID, UUID parentID)
465 { 469 {
466 // m_log.DebugFormat( 470 // m_log.DebugFormat(
@@ -482,10 +486,27 @@ namespace OpenSim.Framework.Communications.Cache
482 { 486 {
483 m_commsManager.InventoryService.MoveFolder(baseFolder); 487 m_commsManager.InventoryService.MoveFolder(baseFolder);
484 } 488 }
485 489
486 InventoryFolderImpl folder = RootFolder.FindFolder(folderID); 490 InventoryFolderImpl folder = RootFolder.FindFolder(folderID);
487 if (folder != null) 491 InventoryFolderImpl parentFolder = RootFolder.FindFolder(parentID);
488 folder.ParentID = parentID; 492 if (parentFolder != null && folder != null)
493 {
494 InventoryFolderImpl oldParentFolder = RootFolder.FindFolder(folder.ParentID);
495
496 if (oldParentFolder != null)
497 {
498 oldParentFolder.RemoveChildFolder(folderID);
499 parentFolder.AddChildFolder(folder);
500 }
501 else
502 {
503 return false;
504 }
505 }
506 else
507 {
508 return false;
509 }
489 510
490 return true; 511 return true;
491 } 512 }
@@ -502,10 +523,9 @@ namespace OpenSim.Framework.Communications.Cache
502 523
503 /// <summary> 524 /// <summary>
504 /// This method will delete all the items and folders in the given folder. 525 /// This method will delete all the items and folders in the given folder.
505 /// 526 /// </summary>
506 /// If the inventory service has not yet delievered the inventory 527 /// If the inventory service has not yet delievered the inventory
507 /// for this user then the request will be queued. 528 /// for this user then the request will be queued.
508 /// </summary>
509 /// 529 ///
510 /// <param name="folderID"></param> 530 /// <param name="folderID"></param>
511 public bool PurgeFolder(UUID folderID) 531 public bool PurgeFolder(UUID folderID)
diff --git a/OpenSim/Framework/Communications/Cache/InventoryFolderImpl.cs b/OpenSim/Framework/Communications/Cache/InventoryFolderImpl.cs
index 0704232..83ac239 100644
--- a/OpenSim/Framework/Communications/Cache/InventoryFolderImpl.cs
+++ b/OpenSim/Framework/Communications/Cache/InventoryFolderImpl.cs
@@ -92,6 +92,42 @@ namespace OpenSim.Framework.Communications.Cache
92 92
93 return null; 93 return null;
94 } 94 }
95
96 /// <summary>
97 /// Add a folder that already exists.
98 /// </summary>
99 /// <param name="folder"></param>
100 public void AddChildFolder(InventoryFolderImpl folder)
101 {
102 lock (SubFolders)
103 {
104 folder.ParentID = ID;
105 SubFolders[folder.ID] = folder;
106 }
107 }
108
109 /// <summary>
110 /// Removes the given child subfolder.
111 /// </summary>
112 /// <param name="folderID"></param>
113 /// <returns>
114 /// The folder removed, or null if the folder was not present.
115 /// </returns>
116 public InventoryFolderImpl RemoveChildFolder(UUID folderID)
117 {
118 InventoryFolderImpl removedFolder = null;
119
120 lock (SubFolders)
121 {
122 if (SubFolders.ContainsKey(folderID))
123 {
124 removedFolder = SubFolders[folderID];
125 SubFolders.Remove(folderID);
126 }
127 }
128
129 return removedFolder;
130 }
95 131
96 /// <summary> 132 /// <summary>
97 /// Delete all the folders and items in this folder. 133 /// Delete all the folders and items in this folder.
diff --git a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs
index 45102d8..b4f3e9f 100644
--- a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs
+++ b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs
@@ -274,8 +274,8 @@ namespace OpenSim.Framework.Communications.Cache
274 if (!userProfile.MoveFolder(folderID, parentID)) 274 if (!userProfile.MoveFolder(folderID, parentID))
275 { 275 {
276 m_log.ErrorFormat( 276 m_log.ErrorFormat(
277 "[AGENT INVENTORY]: Failed to move folder for user {0} {1}", 277 "[AGENT INVENTORY]: Failed to move folder {0} to {1} for user {2}",
278 remoteClient.Name, remoteClient.AgentId); 278 folderID, parentID, remoteClient.Name);
279 } 279 }
280 } 280 }
281 else 281 else