diff options
Diffstat (limited to 'OpenSim/Framework/Communications/Cache')
3 files changed, 47 insertions, 11 deletions
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; | |||
38 | 38 | ||
39 | namespace OpenSim.Framework.Communications.Caches | 39 | namespace OpenSim.Framework.Communications.Caches |
40 | { | 40 | { |
41 | public class CachedUserInfo | 41 | public class CachedUserInfo : MarshalByRefObject |
42 | { | 42 | { |
43 | private CommunicationsManager m_parentCommsManager; | 43 | private CommunicationsManager m_parentCommsManager; |
44 | // Fields | 44 | // Fields |
@@ -51,7 +51,7 @@ namespace OpenSim.Framework.Communications.Caches | |||
51 | } | 51 | } |
52 | 52 | ||
53 | // Methods | 53 | // Methods |
54 | public void FolderReceive(LLUUID userID, InventoryFolder folderInfo) | 54 | public void FolderReceive(LLUUID userID, InventoryFolderBase folderInfo) |
55 | { | 55 | { |
56 | if (userID == this.UserProfile.UUID) | 56 | if (userID == this.UserProfile.UUID) |
57 | { | 57 | { |
@@ -59,19 +59,19 @@ namespace OpenSim.Framework.Communications.Caches | |||
59 | { | 59 | { |
60 | if (folderInfo.parentID == LLUUID.Zero) | 60 | if (folderInfo.parentID == LLUUID.Zero) |
61 | { | 61 | { |
62 | this.RootFolder = folderInfo; | 62 | this.RootFolder = new InventoryFolder(folderInfo); |
63 | } | 63 | } |
64 | } | 64 | } |
65 | else if (this.RootFolder.folderID == folderInfo.parentID) | 65 | else if (this.RootFolder.folderID == folderInfo.parentID) |
66 | { | 66 | { |
67 | this.RootFolder.SubFolders.Add(folderInfo.folderID, folderInfo); | 67 | this.RootFolder.SubFolders.Add(folderInfo.folderID, new InventoryFolder(folderInfo)); |
68 | } | 68 | } |
69 | else | 69 | else |
70 | { | 70 | { |
71 | InventoryFolder folder = this.RootFolder.HasSubFolder(folderInfo.parentID); | 71 | InventoryFolder folder = this.RootFolder.HasSubFolder(folderInfo.parentID); |
72 | if (folder != null) | 72 | if (folder != null) |
73 | { | 73 | { |
74 | folder.SubFolders.Add(folderInfo.folderID, folderInfo); | 74 | folder.SubFolders.Add(folderInfo.folderID, new InventoryFolder(folderInfo)); |
75 | } | 75 | } |
76 | } | 76 | } |
77 | } | 77 | } |
@@ -131,3 +131,7 @@ namespace OpenSim.Framework.Communications.Caches | |||
131 | 131 | ||
132 | } | 132 | } |
133 | 133 | ||
134 | |||
135 | |||
136 | |||
137 | |||
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; | |||
35 | using OpenSim.Framework.Data; | 35 | using OpenSim.Framework.Data; |
36 | using OpenSim.Framework.Types; | 36 | using OpenSim.Framework.Types; |
37 | using OpenSim.Framework.Utilities; | 37 | using OpenSim.Framework.Utilities; |
38 | using OpenSim.Framework.Console; | ||
39 | |||
40 | using InventoryCategory = OpenSim.Framework.Data.InventoryCategory; | ||
38 | 41 | ||
39 | namespace OpenSim.Framework.Communications.Caches | 42 | namespace OpenSim.Framework.Communications.Caches |
40 | { | 43 | { |
@@ -60,7 +63,7 @@ namespace OpenSim.Framework.Communications.Caches | |||
60 | } | 63 | } |
61 | 64 | ||
62 | // Methods | 65 | // Methods |
63 | public InventoryFolder CreateNewSubFolder(LLUUID folderID, string folderName, ushort type) | 66 | public InventoryFolder CreateNewSubFolder(LLUUID folderID, string folderName, ushort type, InventoryCategory category) |
64 | { | 67 | { |
65 | InventoryFolder subFold = new InventoryFolder(); | 68 | InventoryFolder subFold = new InventoryFolder(); |
66 | subFold.name = folderName; | 69 | subFold.name = folderName; |
@@ -68,7 +71,12 @@ namespace OpenSim.Framework.Communications.Caches | |||
68 | subFold.type = (short) type; | 71 | subFold.type = (short) type; |
69 | subFold.parentID = this.folderID; | 72 | subFold.parentID = this.folderID; |
70 | subFold.agentID = this.agentID; | 73 | subFold.agentID = this.agentID; |
71 | this.SubFolders.Add(subFold.folderID, subFold); | 74 | subFold.category = category; |
75 | if (!SubFolders.ContainsKey(subFold.folderID)) | ||
76 | this.SubFolders.Add(subFold.folderID, subFold); | ||
77 | else | ||
78 | MainLog.Instance.Warn("INVENTORYCACHE", "Attempt to create a duplicate folder {0} {1}", folderName, folderID); | ||
79 | |||
72 | return subFold; | 80 | return subFold; |
73 | } | 81 | } |
74 | 82 | ||
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; | |||
35 | using OpenSim.Framework.Types; | 35 | using OpenSim.Framework.Types; |
36 | using OpenSim.Framework.Utilities; | 36 | using OpenSim.Framework.Utilities; |
37 | using OpenSim.Framework.Data; | 37 | using OpenSim.Framework.Data; |
38 | using InventoryCategory = OpenSim.Framework.Data.InventoryCategory; | ||
38 | 39 | ||
39 | namespace OpenSim.Framework.Communications.Caches | 40 | namespace OpenSim.Framework.Communications.Caches |
40 | { | 41 | { |
41 | public class UserProfileCache | 42 | public class UserProfileCache : MarshalByRefObject |
42 | { | 43 | { |
43 | // Fields | 44 | // Fields |
44 | private CommunicationsManager m_parent; | 45 | private CommunicationsManager m_parent; |
@@ -103,7 +104,7 @@ namespace OpenSim.Framework.Communications.Caches | |||
103 | CachedUserInfo info = this.UserProfiles[remoteClient.AgentId]; | 104 | CachedUserInfo info = this.UserProfiles[remoteClient.AgentId]; |
104 | if (info.RootFolder.folderID == parentID) | 105 | if (info.RootFolder.folderID == parentID) |
105 | { | 106 | { |
106 | InventoryFolder createdFolder = info.RootFolder.CreateNewSubFolder(folderID, folderName, folderType); | 107 | InventoryFolder createdFolder = info.RootFolder.CreateNewSubFolder(folderID, folderName, folderType, InventoryCategory.User); |
107 | if (createdFolder != null) | 108 | if (createdFolder != null) |
108 | { | 109 | { |
109 | this.m_parent.InventoryService.AddNewInventoryFolder(remoteClient.AgentId, createdFolder); | 110 | this.m_parent.InventoryService.AddNewInventoryFolder(remoteClient.AgentId, createdFolder); |
@@ -114,7 +115,7 @@ namespace OpenSim.Framework.Communications.Caches | |||
114 | InventoryFolder folder = info.RootFolder.HasSubFolder(parentID); | 115 | InventoryFolder folder = info.RootFolder.HasSubFolder(parentID); |
115 | if (folder != null) | 116 | if (folder != null) |
116 | { | 117 | { |
117 | folder.CreateNewSubFolder(folderID, folderName, folderType); | 118 | folder.CreateNewSubFolder(folderID, folderName, folderType, InventoryCategory.User); |
118 | } | 119 | } |
119 | } | 120 | } |
120 | } | 121 | } |
@@ -124,16 +125,21 @@ namespace OpenSim.Framework.Communications.Caches | |||
124 | public void HandleFecthInventoryDescendents(IClientAPI remoteClient, LLUUID folderID, LLUUID ownerID, bool fetchFolders, bool fetchItems, int sortOrder) | 125 | public void HandleFecthInventoryDescendents(IClientAPI remoteClient, LLUUID folderID, LLUUID ownerID, bool fetchFolders, bool fetchItems, int sortOrder) |
125 | { | 126 | { |
126 | InventoryFolder fold = null; | 127 | InventoryFolder fold = null; |
128 | |||
127 | if (folderID == libraryRoot.folderID ) | 129 | if (folderID == libraryRoot.folderID ) |
128 | { | 130 | { |
131 | // we are looking for the root of the shared inventory | ||
129 | remoteClient.SendInventoryFolderDetails(libraryRoot.agentID, libraryRoot.folderID, libraryRoot.RequestListOfItems()); | 132 | remoteClient.SendInventoryFolderDetails(libraryRoot.agentID, libraryRoot.folderID, libraryRoot.RequestListOfItems()); |
130 | } | 133 | } |
131 | else if (( fold = libraryRoot.HasSubFolder(folderID)) != null) | 134 | else if (( fold = libraryRoot.HasSubFolder(folderID)) != null) |
132 | { | 135 | { |
136 | // we are looking for a sub folder of the shared inventory | ||
133 | remoteClient.SendInventoryFolderDetails(libraryRoot.agentID, folderID, fold.RequestListOfItems()); | 137 | remoteClient.SendInventoryFolderDetails(libraryRoot.agentID, folderID, fold.RequestListOfItems()); |
134 | } | 138 | } |
135 | else if (this.UserProfiles.ContainsKey(remoteClient.AgentId)) | 139 | else if (this.UserProfiles.ContainsKey(remoteClient.AgentId)) |
136 | { | 140 | { |
141 | //if we get here, we are looking the inventory of an agent in this sim | ||
142 | //now we need to see if we already have the inventory cached | ||
137 | if (this.UserProfiles[remoteClient.AgentId].RootFolder != null) | 143 | if (this.UserProfiles[remoteClient.AgentId].RootFolder != null) |
138 | { | 144 | { |
139 | CachedUserInfo info = this.UserProfiles[remoteClient.AgentId]; | 145 | CachedUserInfo info = this.UserProfiles[remoteClient.AgentId]; |
@@ -153,9 +159,23 @@ namespace OpenSim.Framework.Communications.Caches | |||
153 | } | 159 | } |
154 | } | 160 | } |
155 | } | 161 | } |
162 | else | ||
163 | { | ||
164 | //nope, inventory wasn't cached, so go to the inventory server and ask for the inventory | ||
165 | m_parent.InventoryService.RequestInventoryForUser(remoteClient.AgentId, ReceiveFolderInfo, ReceiveItemInfo); | ||
166 | } | ||
156 | } | 167 | } |
157 | } | 168 | } |
158 | 169 | ||
170 | public void ReceiveFolderInfo(LLUUID userID, InventoryFolderBase folderInfo) | ||
171 | { | ||
172 | } | ||
173 | |||
174 | public void ReceiveItemInfo(LLUUID userID, InventoryItemBase itemInfo) | ||
175 | { | ||
176 | } | ||
177 | |||
178 | |||
159 | public void HandleFetchInventory(IClientAPI remoteClient, LLUUID itemID, LLUUID ownerID) | 179 | public void HandleFetchInventory(IClientAPI remoteClient, LLUUID itemID, LLUUID ownerID) |
160 | { | 180 | { |
161 | if (ownerID == libraryRoot.agentID) | 181 | if (ownerID == libraryRoot.agentID) |
@@ -181,7 +201,7 @@ namespace OpenSim.Framework.Communications.Caches | |||
181 | /// <param name="userID"></param> | 201 | /// <param name="userID"></param> |
182 | private void RequestInventoryForUser(LLUUID userID, CachedUserInfo userInfo) | 202 | private void RequestInventoryForUser(LLUUID userID, CachedUserInfo userInfo) |
183 | { | 203 | { |
184 | this.m_parent.InventoryService.RequestInventoryForUser(userID, userInfo.FolderReceive, userInfo.ItemReceive); | 204 | this.m_parent.InventoryService.RequestInventoryForUser(userID, userInfo.FolderReceive, userInfo.ItemReceive); |
185 | } | 205 | } |
186 | 206 | ||
187 | /// <summary> | 207 | /// <summary> |
@@ -221,3 +241,7 @@ namespace OpenSim.Framework.Communications.Caches | |||
221 | } | 241 | } |
222 | } | 242 | } |
223 | 243 | ||
244 | |||
245 | |||
246 | |||
247 | |||