aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
diff options
context:
space:
mode:
authorJustin Clarke Casey2008-05-03 19:27:34 +0000
committerJustin Clarke Casey2008-05-03 19:27:34 +0000
commit45430a5403ec45abceac123a76cb7a0c61475b5e (patch)
tree995c5b0dfb04748fb4623641f717559e4033319f /OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
parent* Make user profile cache service complain if the caller assumes a profile ex... (diff)
downloadopensim-SC_OLD-45430a5403ec45abceac123a76cb7a0c61475b5e.zip
opensim-SC_OLD-45430a5403ec45abceac123a76cb7a0c61475b5e.tar.gz
opensim-SC_OLD-45430a5403ec45abceac123a76cb7a0c61475b5e.tar.bz2
opensim-SC_OLD-45430a5403ec45abceac123a76cb7a0c61475b5e.tar.xz
* Refactor: move UpdateFolder into CachedUserInfo
Diffstat (limited to 'OpenSim/Framework/Communications/Cache/CachedUserInfo.cs')
-rw-r--r--OpenSim/Framework/Communications/Cache/CachedUserInfo.cs49
1 files changed, 44 insertions, 5 deletions
diff --git a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
index f55b492..35c2002 100644
--- a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
+++ b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
@@ -37,6 +37,8 @@ namespace OpenSim.Framework.Communications.Cache
37{ 37{
38 internal delegate void CreateInventoryFolderDelegate( 38 internal delegate void CreateInventoryFolderDelegate(
39 string folderName, LLUUID folderID, ushort folderType, LLUUID parentID); 39 string folderName, LLUUID folderID, ushort folderType, LLUUID parentID);
40 internal delegate void UpdateInventoryFolderDelegate(
41 string name, LLUUID folderID, ushort type, LLUUID parentID);
40 42
41 /// <summary> 43 /// <summary>
42 /// Stores user profile and inventory data received from backend services for a particular user. 44 /// Stores user profile and inventory data received from backend services for a particular user.
@@ -336,7 +338,7 @@ namespace OpenSim.Framework.Communications.Cache
336 else 338 else
337 { 339 {
338 m_log.WarnFormat( 340 m_log.WarnFormat(
339 "[INVENTORY CACHE]: Tried to create folder {0} {1} but the folder already exists", 341 "[AGENT INVENTORY]: Tried to create folder {0} {1} but the folder already exists",
340 folderName, folderID); 342 folderName, folderID);
341 343
342 return false; 344 return false;
@@ -367,7 +369,7 @@ namespace OpenSim.Framework.Communications.Cache
367 else 369 else
368 { 370 {
369 m_log.WarnFormat( 371 m_log.WarnFormat(
370 "[INVENTORY CACHE]: Tried to create folder {0} {1} but the folder already exists", 372 "[AGENT INVENTORY]: Tried to create folder {0} {1} but the folder already exists",
371 folderName, folderID); 373 folderName, folderID);
372 374
373 return false; 375 return false;
@@ -376,7 +378,7 @@ namespace OpenSim.Framework.Communications.Cache
376 else 378 else
377 { 379 {
378 m_log.WarnFormat( 380 m_log.WarnFormat(
379 "[INVENTORY CACHE]: Could not find parent folder with id {0} in order to create folder {1} {2}", 381 "[AGENT INVENTORY]: Could not find parent folder with id {0} in order to create folder {1} {2}",
380 parentID, folderName, folderID); 382 parentID, folderName, folderID);
381 383
382 return false; 384 return false;
@@ -392,9 +394,46 @@ namespace OpenSim.Framework.Communications.Cache
392 394
393 return true; 395 return true;
394 } 396 }
395
396 return false;
397 } 397 }
398
399 /// <summary>
400 /// Handle a client request to update the inventory folder
401 ///
402 /// FIXME: We call add new inventory folder because in the data layer, we happen to use an SQL REPLACE
403 /// so this will work to rename an existing folder. Needless to say, to rely on this is very confusing,
404 /// and needs to be changed.
405 /// </summary>
406 /// <param name="folderID"></param>
407 /// <param name="type"></param>
408 /// <param name="name"></param>
409 /// <param name="parentID"></param>
410 public bool UpdateFolder(string name, LLUUID folderID, ushort type, LLUUID parentID)
411 {
412// m_log.DebugFormat(
413// "[AGENT INVENTORY]: Updating inventory folder {0} {1} for {2} {3}", folderID, name, remoteClient.Name, remoteClient.AgentId);
414
415 if (HasInventory)
416 {
417 InventoryFolderBase baseFolder = new InventoryFolderBase();
418 baseFolder.Owner = m_userProfile.ID;
419 baseFolder.ID = folderID;
420 baseFolder.Name = name;
421 baseFolder.ParentID = parentID;
422 baseFolder.Type = (short) type;
423 baseFolder.Version = RootFolder.Version;
424
425 m_commsManager.InventoryService.AddFolder(baseFolder);
426 }
427 else
428 {
429 AddRequest(
430 new InventoryRequest(
431 Delegate.CreateDelegate(typeof(UpdateInventoryFolderDelegate), this, "UpdateFolder"),
432 new object[] { name, folderID, type, parentID }));
433 }
434
435 return true;
436 }
398 437
399 /// <summary> 438 /// <summary>
400 /// Add an item to the user's inventory 439 /// Add an item to the user's inventory