diff options
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r-- | OpenSim/Framework/Communications/Cache/CachedUserInfo.cs | 49 | ||||
-rw-r--r-- | OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs | 23 |
2 files changed, 48 insertions, 24 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 |
diff --git a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs index 71da8dc..f640fb8 100644 --- a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs +++ b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs | |||
@@ -36,8 +36,6 @@ namespace OpenSim.Framework.Communications.Cache | |||
36 | { | 36 | { |
37 | internal delegate void MoveInventoryFolderDelegate(IClientAPI remoteClient, LLUUID folderID, LLUUID parentID); | 37 | internal delegate void MoveInventoryFolderDelegate(IClientAPI remoteClient, LLUUID folderID, LLUUID parentID); |
38 | internal delegate void PurgeInventoryDescendentsDelegate(IClientAPI remoteClient, LLUUID folderID); | 38 | internal delegate void PurgeInventoryDescendentsDelegate(IClientAPI remoteClient, LLUUID folderID); |
39 | internal delegate void UpdateInventoryFolderDelegate( | ||
40 | IClientAPI remoteClient, LLUUID folderID, ushort type, string name, LLUUID parentID); | ||
41 | 39 | ||
42 | /// <summary> | 40 | /// <summary> |
43 | /// Holds user profile information and retrieves it from backend services. | 41 | /// Holds user profile information and retrieves it from backend services. |
@@ -198,24 +196,11 @@ namespace OpenSim.Framework.Communications.Cache | |||
198 | 196 | ||
199 | if (m_userProfiles.TryGetValue(remoteClient.AgentId, out userProfile)) | 197 | if (m_userProfiles.TryGetValue(remoteClient.AgentId, out userProfile)) |
200 | { | 198 | { |
201 | if (userProfile.HasInventory) | 199 | if (!userProfile.UpdateFolder(name, folderID, type, parentID)) |
202 | { | ||
203 | InventoryFolderBase baseFolder = new InventoryFolderBase(); | ||
204 | baseFolder.Owner = remoteClient.AgentId; | ||
205 | baseFolder.ID = folderID; | ||
206 | baseFolder.Name = name; | ||
207 | baseFolder.ParentID = parentID; | ||
208 | baseFolder.Type = (short) type; | ||
209 | baseFolder.Version = userProfile.RootFolder.Version; | ||
210 | |||
211 | m_commsManager.InventoryService.AddFolder(baseFolder); | ||
212 | } | ||
213 | else | ||
214 | { | 200 | { |
215 | userProfile.AddRequest( | 201 | m_log.ErrorFormat( |
216 | new InventoryRequest( | 202 | "[AGENT INVENTORY]: Failed to create folder for user {0} {1}", |
217 | Delegate.CreateDelegate(typeof(UpdateInventoryFolderDelegate), this, "HandleUpdateInventoryFolder"), | 203 | remoteClient.Name, remoteClient.AgentId); |
218 | new object[] { remoteClient, folderID, type, name, parentID })); | ||
219 | } | 204 | } |
220 | } | 205 | } |
221 | else | 206 | else |