From 226c082ed417f4a5f2295595e45eca2fcb1e42c9 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 11 Aug 2009 16:45:16 +0100
Subject: Establish CachedUserInfo.OnInventoryReceived event so that
region/test inventory code can be written with the async inventory fetch
---
.../Framework/Communications/Cache/CachedUserInfo.cs | 19 ++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)
(limited to 'OpenSim/Framework/Communications/Cache/CachedUserInfo.cs')
diff --git a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
index 10aff42..8ee1b1a 100644
--- a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
+++ b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
@@ -49,16 +49,24 @@ namespace OpenSim.Framework.Communications.Cache
IClientAPI client, UUID folderID, bool fetchFolders, bool fetchItems);
public delegate void OnItemReceivedDelegate(UUID itemID);
+ public delegate void OnInventoryReceivedDelegate(UUID userID);
///
/// Stores user profile and inventory data received from backend services for a particular user.
///
public class CachedUserInfo
- {
+ {
+ private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
+
+ ////
+ /// Fired when a particular item has been received from the inventory service
+ ///
public event OnItemReceivedDelegate OnItemReceived;
- private static readonly ILog m_log
- = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
+ ///
+ /// Fired once the entire inventory has been received for the user
+ ///
+ public event OnInventoryReceivedDelegate OnInventoryReceived;
///
/// The comms manager holds references to services (user, grid, inventory, etc.)
@@ -133,7 +141,9 @@ namespace OpenSim.Framework.Communications.Cache
UUID parentFolderId = folder.ParentID;
if (dictionary.ContainsKey(parentFolderId))
+ {
dictionary[parentFolderId].Add(folder);
+ }
else
{
IList folders = new List();
@@ -299,6 +309,9 @@ namespace OpenSim.Framework.Communications.Cache
request.Execute();
}
}
+
+ if (OnInventoryReceived != null)
+ OnInventoryReceived(UserProfile.ID);
}
///
--
cgit v1.1