aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJustin Clarke Casey2008-04-22 18:58:09 +0000
committerJustin Clarke Casey2008-04-22 18:58:09 +0000
commit68c6b6ece3f1f20a81806b08ffd5c73296324d6c (patch)
treeb92ea76ed8d505bf5f7cc3526e921b71e103bbfd
parent* Allow folder renaming to complete after an agent inventory has been receive... (diff)
downloadopensim-SC_OLD-68c6b6ece3f1f20a81806b08ffd5c73296324d6c.zip
opensim-SC_OLD-68c6b6ece3f1f20a81806b08ffd5c73296324d6c.tar.gz
opensim-SC_OLD-68c6b6ece3f1f20a81806b08ffd5c73296324d6c.tar.bz2
opensim-SC_OLD-68c6b6ece3f1f20a81806b08ffd5c73296324d6c.tar.xz
* Replace previous specific inventory callback code with generic alternative
-rw-r--r--OpenSim/Framework/Communications/Cache/CachedUserInfo.cs23
-rw-r--r--OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs47
2 files changed, 40 insertions, 30 deletions
diff --git a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
index 3d7ada3..9a7ce42 100644
--- a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
+++ b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
@@ -332,6 +332,29 @@ namespace OpenSim.Framework.Communications.Cache
332 /// </summary> 332 /// </summary>
333 public interface IInventoryRequest 333 public interface IInventoryRequest
334 { 334 {
335 /// <summary>
336 /// This is the method executed once we have received the user's inventory by which the request can be fulfilled.
337 /// </summary>
335 void Execute(); 338 void Execute();
336 } 339 }
340
341 /// <summary>
342 /// Generic inventory request
343 /// </summary>
344 public class InventoryRequest : IInventoryRequest
345 {
346 private Delegate m_delegat;
347 private Object[] m_args;
348
349 internal InventoryRequest(Delegate delegat, Object[] args)
350 {
351 m_delegat = delegat;
352 m_args = args;
353 }
354
355 public void Execute()
356 {
357 m_delegat.DynamicInvoke(m_args);
358 }
359 }
337} 360}
diff --git a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs
index cbf2ded..eb85ec8 100644
--- a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs
+++ b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs
@@ -25,14 +25,19 @@
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using System;
28using System.Collections.Generic; 29using System.Collections.Generic;
29using System.Reflection; 30using System.Reflection;
30using System.Threading; 31using System.Threading;
32
31using libsecondlife; 33using libsecondlife;
32using log4net; 34using log4net;
33 35
34namespace OpenSim.Framework.Communications.Cache 36namespace OpenSim.Framework.Communications.Cache
35{ 37{
38 internal delegate void UpdateInventoryFolderDelegate(
39 IClientAPI remoteClient, LLUUID folderID, ushort type, string name, LLUUID parentID);
40
36 /// <summary> 41 /// <summary>
37 /// Holds user profile information and retrieves it from backend services. 42 /// Holds user profile information and retrieves it from backend services.
38 /// </summary> 43 /// </summary>
@@ -221,7 +226,10 @@ namespace OpenSim.Framework.Communications.Cache
221 } 226 }
222 else 227 else
223 { 228 {
224 userProfile.AddRequest(new UpdateFolderRequest(this, remoteClient, folderID, type, name, parentID)); 229 userProfile.AddRequest(
230 new InventoryRequest(
231 Delegate.CreateDelegate(typeof(UpdateInventoryFolderDelegate), this, "HandleUpdateInventoryFolder"),
232 new object[] { remoteClient, folderID, type, name, parentID }));
225 } 233 }
226 } 234 }
227 } 235 }
@@ -234,6 +242,10 @@ namespace OpenSim.Framework.Communications.Cache
234 /// <param name="parentID"></param> 242 /// <param name="parentID"></param>
235 public void HandleMoveInventoryFolder(IClientAPI remoteClient, LLUUID folderID, LLUUID parentID) 243 public void HandleMoveInventoryFolder(IClientAPI remoteClient, LLUUID folderID, LLUUID parentID)
236 { 244 {
245 m_log.DebugFormat(
246 "[AGENT INVENTORY] Moving inventory folder {0} into folder {1} for {2} {3}",
247 parentID, remoteClient.Name, remoteClient.AgentId);
248
237 CachedUserInfo userProfile; 249 CachedUserInfo userProfile;
238 250
239 if (m_userProfiles.TryGetValue(remoteClient.AgentId, out userProfile)) 251 if (m_userProfiles.TryGetValue(remoteClient.AgentId, out userProfile))
@@ -246,6 +258,10 @@ namespace OpenSim.Framework.Communications.Cache
246 baseFolder.ParentID = parentID; 258 baseFolder.ParentID = parentID;
247 m_commsManager.InventoryService.MoveInventoryFolder(remoteClient.AgentId, baseFolder); 259 m_commsManager.InventoryService.MoveInventoryFolder(remoteClient.AgentId, baseFolder);
248 } 260 }
261// else
262// {
263// userProfile.AddRequest(new MoveFolderRequest(remoteClient, folderID, parentID));
264// }
249 } 265 }
250 } 266 }
251 267
@@ -499,33 +515,4 @@ namespace OpenSim.Framework.Communications.Cache
499 } 515 }
500 } 516 }
501 } 517 }
502
503 /// <summary>
504 /// Used to create an update folder request if we haven't yet received the user's inventory
505 /// </summary>
506 internal class UpdateFolderRequest : IInventoryRequest
507 {
508 private UserProfileCacheService m_userProfileCacheService;
509 private IClientAPI m_client;
510 private LLUUID m_folderID;
511 private ushort m_type;
512 private string m_name;
513 private LLUUID m_parentID;
514
515 internal UpdateFolderRequest(
516 UserProfileCacheService cacheService, IClientAPI client, LLUUID folderID, ushort type, string name, LLUUID parentID)
517 {
518 m_userProfileCacheService = cacheService;
519 m_client = client;
520 m_folderID = folderID;
521 m_type = type;
522 m_name = name;
523 m_parentID = parentID;
524 }
525
526 public void Execute()
527 {
528 m_userProfileCacheService.HandleUpdateInventoryFolder(m_client, m_folderID, m_type, m_name, m_parentID);
529 }
530 }
531} 518}