From 8143c597fc5f62ec0d931d2d5b887730e06aec04 Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Thu, 27 Sep 2007 13:25:45 +0000 Subject: * Tleiades grid mode inventory (#444) - thanx Tleiades! * updated to rev 1413 on libsecondlife.dll and libsecondlife.dll.config (#423) --- .../Communications/Cache/CachedUserInfo.cs | 14 ++++++---- .../Communications/Cache/InventoryFolder.cs | 12 ++++++-- .../Communications/Cache/UserProfileCache.cs | 32 +++++++++++++++++++--- 3 files changed, 47 insertions(+), 11 deletions(-) (limited to 'OpenSim/Framework/Communications/Cache') diff --git a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs index 99dc45a..9e8c239 100644 --- a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs +++ b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs @@ -38,7 +38,7 @@ using OpenSim.Framework.Utilities; namespace OpenSim.Framework.Communications.Caches { - public class CachedUserInfo + public class CachedUserInfo : MarshalByRefObject { private CommunicationsManager m_parentCommsManager; // Fields @@ -51,7 +51,7 @@ namespace OpenSim.Framework.Communications.Caches } // Methods - public void FolderReceive(LLUUID userID, InventoryFolder folderInfo) + public void FolderReceive(LLUUID userID, InventoryFolderBase folderInfo) { if (userID == this.UserProfile.UUID) { @@ -59,19 +59,19 @@ namespace OpenSim.Framework.Communications.Caches { if (folderInfo.parentID == LLUUID.Zero) { - this.RootFolder = folderInfo; + this.RootFolder = new InventoryFolder(folderInfo); } } else if (this.RootFolder.folderID == folderInfo.parentID) { - this.RootFolder.SubFolders.Add(folderInfo.folderID, folderInfo); + this.RootFolder.SubFolders.Add(folderInfo.folderID, new InventoryFolder(folderInfo)); } else { InventoryFolder folder = this.RootFolder.HasSubFolder(folderInfo.parentID); if (folder != null) { - folder.SubFolders.Add(folderInfo.folderID, folderInfo); + folder.SubFolders.Add(folderInfo.folderID, new InventoryFolder(folderInfo)); } } } @@ -131,3 +131,7 @@ namespace OpenSim.Framework.Communications.Caches } + + + + diff --git a/OpenSim/Framework/Communications/Cache/InventoryFolder.cs b/OpenSim/Framework/Communications/Cache/InventoryFolder.cs index 885cffc..a212614 100644 --- a/OpenSim/Framework/Communications/Cache/InventoryFolder.cs +++ b/OpenSim/Framework/Communications/Cache/InventoryFolder.cs @@ -35,6 +35,9 @@ using OpenSim.Framework.Interfaces; using OpenSim.Framework.Data; using OpenSim.Framework.Types; using OpenSim.Framework.Utilities; +using OpenSim.Framework.Console; + +using InventoryCategory = OpenSim.Framework.Data.InventoryCategory; namespace OpenSim.Framework.Communications.Caches { @@ -60,7 +63,7 @@ namespace OpenSim.Framework.Communications.Caches } // Methods - public InventoryFolder CreateNewSubFolder(LLUUID folderID, string folderName, ushort type) + public InventoryFolder CreateNewSubFolder(LLUUID folderID, string folderName, ushort type, InventoryCategory category) { InventoryFolder subFold = new InventoryFolder(); subFold.name = folderName; @@ -68,7 +71,12 @@ namespace OpenSim.Framework.Communications.Caches subFold.type = (short) type; subFold.parentID = this.folderID; subFold.agentID = this.agentID; - this.SubFolders.Add(subFold.folderID, subFold); + subFold.category = category; + if (!SubFolders.ContainsKey(subFold.folderID)) + this.SubFolders.Add(subFold.folderID, subFold); + else + MainLog.Instance.Warn("INVENTORYCACHE", "Attempt to create a duplicate folder {0} {1}", folderName, folderID); + return subFold; } diff --git a/OpenSim/Framework/Communications/Cache/UserProfileCache.cs b/OpenSim/Framework/Communications/Cache/UserProfileCache.cs index 390b938..3dadf9c 100644 --- a/OpenSim/Framework/Communications/Cache/UserProfileCache.cs +++ b/OpenSim/Framework/Communications/Cache/UserProfileCache.cs @@ -35,10 +35,11 @@ using OpenSim.Framework.Interfaces; using OpenSim.Framework.Types; using OpenSim.Framework.Utilities; using OpenSim.Framework.Data; +using InventoryCategory = OpenSim.Framework.Data.InventoryCategory; namespace OpenSim.Framework.Communications.Caches { - public class UserProfileCache + public class UserProfileCache : MarshalByRefObject { // Fields private CommunicationsManager m_parent; @@ -103,7 +104,7 @@ namespace OpenSim.Framework.Communications.Caches CachedUserInfo info = this.UserProfiles[remoteClient.AgentId]; if (info.RootFolder.folderID == parentID) { - InventoryFolder createdFolder = info.RootFolder.CreateNewSubFolder(folderID, folderName, folderType); + InventoryFolder createdFolder = info.RootFolder.CreateNewSubFolder(folderID, folderName, folderType, InventoryCategory.User); if (createdFolder != null) { this.m_parent.InventoryService.AddNewInventoryFolder(remoteClient.AgentId, createdFolder); @@ -114,7 +115,7 @@ namespace OpenSim.Framework.Communications.Caches InventoryFolder folder = info.RootFolder.HasSubFolder(parentID); if (folder != null) { - folder.CreateNewSubFolder(folderID, folderName, folderType); + folder.CreateNewSubFolder(folderID, folderName, folderType, InventoryCategory.User); } } } @@ -124,16 +125,21 @@ namespace OpenSim.Framework.Communications.Caches public void HandleFecthInventoryDescendents(IClientAPI remoteClient, LLUUID folderID, LLUUID ownerID, bool fetchFolders, bool fetchItems, int sortOrder) { InventoryFolder fold = null; + if (folderID == libraryRoot.folderID ) { + // we are looking for the root of the shared inventory remoteClient.SendInventoryFolderDetails(libraryRoot.agentID, libraryRoot.folderID, libraryRoot.RequestListOfItems()); } else if (( fold = libraryRoot.HasSubFolder(folderID)) != null) { + // we are looking for a sub folder of the shared inventory remoteClient.SendInventoryFolderDetails(libraryRoot.agentID, folderID, fold.RequestListOfItems()); } else if (this.UserProfiles.ContainsKey(remoteClient.AgentId)) { + //if we get here, we are looking the inventory of an agent in this sim + //now we need to see if we already have the inventory cached if (this.UserProfiles[remoteClient.AgentId].RootFolder != null) { CachedUserInfo info = this.UserProfiles[remoteClient.AgentId]; @@ -153,9 +159,23 @@ namespace OpenSim.Framework.Communications.Caches } } } + else + { + //nope, inventory wasn't cached, so go to the inventory server and ask for the inventory + m_parent.InventoryService.RequestInventoryForUser(remoteClient.AgentId, ReceiveFolderInfo, ReceiveItemInfo); + } } } + public void ReceiveFolderInfo(LLUUID userID, InventoryFolderBase folderInfo) + { + } + + public void ReceiveItemInfo(LLUUID userID, InventoryItemBase itemInfo) + { + } + + public void HandleFetchInventory(IClientAPI remoteClient, LLUUID itemID, LLUUID ownerID) { if (ownerID == libraryRoot.agentID) @@ -181,7 +201,7 @@ namespace OpenSim.Framework.Communications.Caches /// private void RequestInventoryForUser(LLUUID userID, CachedUserInfo userInfo) { - this.m_parent.InventoryService.RequestInventoryForUser(userID, userInfo.FolderReceive, userInfo.ItemReceive); + this.m_parent.InventoryService.RequestInventoryForUser(userID, userInfo.FolderReceive, userInfo.ItemReceive); } /// @@ -221,3 +241,7 @@ namespace OpenSim.Framework.Communications.Caches } } + + + + -- cgit v1.1