From 29530f30296271f2d5641091e45d5f396a7d4dec Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Tue, 19 Aug 2008 07:11:58 +0000 Subject: Attachment persistence!!! Patch #9170 (Mantis #1171) Attachments now persist across logouts. Mostly untested. --- OpenSim/Framework/AvatarAppearance.cs | 14 +++++++++----- OpenSim/Framework/Communications/Cache/CachedUserInfo.cs | 7 +++++++ 2 files changed, 16 insertions(+), 5 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index 3459504..81cf372 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -528,22 +528,26 @@ namespace OpenSim.Framework m_attachments[attachpoint][1] = asset; } - public void DetachAttachment(LLUUID itemID) + public int GetAttachpoint(LLUUID itemID) { - int attachpoint = 0; - foreach (KeyValuePair kvp in m_attachments) { if(kvp.Value[0] == itemID) { - attachpoint = kvp.Key; - break; + return kvp.Key; } } + return 0; + } + + public void DetachAttachment(LLUUID itemID) + { + int attachpoint = GetAttachpoint(itemID); if(attachpoint > 0) m_attachments.Remove(attachpoint); } + string GetAttachmentsString() { List strings = new List(); diff --git a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs index c337907..a7d6349 100644 --- a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs +++ b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs @@ -47,11 +47,15 @@ namespace OpenSim.Framework.Communications.Cache internal delegate void SendInventoryDescendentsDelegate( IClientAPI client, LLUUID folderID, bool fetchFolders, bool fetchItems); + public delegate void OnItemReceivedDelegate(LLUUID itemID); + /// /// Stores user profile and inventory data received from backend services for a particular user. /// public class CachedUserInfo { + public event OnItemReceivedDelegate OnItemReceived; + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -306,6 +310,9 @@ namespace OpenSim.Framework.Communications.Cache { folder.Items[itemInfo.ID] = itemInfo; } + + if (OnItemReceived != null) + OnItemReceived(itemInfo.ID); } /// -- cgit v1.1