aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Communications/Cache
diff options
context:
space:
mode:
authorJustin Clarke Casey2008-05-01 20:47:33 +0000
committerJustin Clarke Casey2008-05-01 20:47:33 +0000
commit1de6cffa28348975a2492ce1e8a85c365df4dfaf (patch)
tree6431e5598defd603a4b2a8c5020b65d7df5a56a7 /OpenSim/Framework/Communications/Cache
parentcreate pass through of UserManagerBase to plugin calls (diff)
downloadopensim-SC-1de6cffa28348975a2492ce1e8a85c365df4dfaf.zip
opensim-SC-1de6cffa28348975a2492ce1e8a85c365df4dfaf.tar.gz
opensim-SC-1de6cffa28348975a2492ce1e8a85c365df4dfaf.tar.bz2
opensim-SC-1de6cffa28348975a2492ce1e8a85c365df4dfaf.tar.xz
* Refactor: Remove the unused userID parameter that was being passed into almost every inventory method
* This allows lots of redundant inventory methods with only slightly different names to be eliminated.
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/Communications/Cache/CachedUserInfo.cs81
-rw-r--r--OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs13
2 files changed, 46 insertions, 48 deletions
diff --git a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
index 7902240..adf01b9 100644
--- a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
+++ b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
@@ -166,12 +166,12 @@ namespace OpenSim.Framework.Communications.Cache
166 { 166 {
167 foreach (InventoryFolderImpl folder in folders) 167 foreach (InventoryFolderImpl folder in folders)
168 { 168 {
169 FolderReceive(userID, folder); 169 FolderReceive(folder);
170 } 170 }
171 171
172 foreach (InventoryItemBase item in items) 172 foreach (InventoryItemBase item in items)
173 { 173 {
174 ItemReceive(userID, item); 174 ItemReceive(item);
175 } 175 }
176 } 176 }
177 catch (Exception e) 177 catch (Exception e)
@@ -198,56 +198,53 @@ namespace OpenSim.Framework.Communications.Cache
198 /// </summary> 198 /// </summary>
199 /// <param name="userID"></param> 199 /// <param name="userID"></param>
200 /// <param name="folderInfo"></param> 200 /// <param name="folderInfo"></param>
201 private void FolderReceive(LLUUID userID, InventoryFolderImpl folderInfo) 201 private void FolderReceive(InventoryFolderImpl folderInfo)
202 { 202 {
203// m_log.DebugFormat( 203// m_log.DebugFormat(
204// "[INVENTORY CACHE]: Received folder {0} {1} for user {2}", 204// "[INVENTORY CACHE]: Received folder {0} {1} for user {2}",
205// folderInfo.Name, folderInfo.ID, userID); 205// folderInfo.Name, folderInfo.ID, userID);
206 206
207 if (userID == UserProfile.ID) 207 if (RootFolder == null)
208 { 208 {
209 if (RootFolder == null) 209 if (folderInfo.ParentID == LLUUID.Zero)
210 { 210 {
211 if (folderInfo.ParentID == LLUUID.Zero) 211 m_rootFolder = folderInfo;
212 {
213 m_rootFolder = folderInfo;
214 }
215 } 212 }
216 else if (RootFolder.ID == folderInfo.ParentID) 213 }
214 else if (RootFolder.ID == folderInfo.ParentID)
215 {
216 lock (RootFolder.SubFolders)
217 { 217 {
218 lock (RootFolder.SubFolders) 218 if (!RootFolder.SubFolders.ContainsKey(folderInfo.ID))
219 { 219 {
220 if (!RootFolder.SubFolders.ContainsKey(folderInfo.ID)) 220 RootFolder.SubFolders.Add(folderInfo.ID, folderInfo);
221 {
222 RootFolder.SubFolders.Add(folderInfo.ID, folderInfo);
223 }
224 else
225 {
226 AddPendingFolder(folderInfo);
227 }
228 } 221 }
222 else
223 {
224 AddPendingFolder(folderInfo);
225 }
229 } 226 }
230 else 227 }
228 else
229 {
230 InventoryFolderImpl folder = RootFolder.GetDescendentFolder(folderInfo.ParentID);
231 lock (folder.SubFolders)
231 { 232 {
232 InventoryFolderImpl folder = RootFolder.GetDescendentFolder(folderInfo.ParentID); 233 if (folder != null)
233 lock (folder.SubFolders)
234 { 234 {
235 if (folder != null) 235 if (!folder.SubFolders.ContainsKey(folderInfo.ID))
236 { 236 {
237 if (!folder.SubFolders.ContainsKey(folderInfo.ID)) 237 folder.SubFolders.Add(folderInfo.ID, folderInfo);
238 {
239 folder.SubFolders.Add(folderInfo.ID, folderInfo);
240 }
241 }
242 else
243 {
244 AddPendingFolder(folderInfo);
245 } 238 }
246 } 239 }
240 else
241 {
242 AddPendingFolder(folderInfo);
243 }
247 } 244 }
248
249 ResolvePendingFolders(folderInfo);
250 } 245 }
246
247 ResolvePendingFolders(folderInfo);
251 } 248 }
252 249
253 /// <summary> 250 /// <summary>
@@ -256,15 +253,14 @@ namespace OpenSim.Framework.Communications.Cache
256 /// We're assuming here that items are always received after all the folders have been 253 /// We're assuming here that items are always received after all the folders have been
257 /// received. 254 /// received.
258 /// </summary> 255 /// </summary>
259 /// <param name="userID"></param>
260 /// <param name="folderInfo"></param> 256 /// <param name="folderInfo"></param>
261 private void ItemReceive(LLUUID userID, InventoryItemBase itemInfo) 257 private void ItemReceive(InventoryItemBase itemInfo)
262 { 258 {
263// m_log.DebugFormat( 259// m_log.DebugFormat(
264// "[INVENTORY CACHE]: Received item {0} {1} for user {2}", 260// "[INVENTORY CACHE]: Received item {0} {1} for user {2}",
265// itemInfo.Name, itemInfo.ID, userID); 261// itemInfo.Name, itemInfo.ID, userID);
266 262
267 if ((userID == UserProfile.ID) && (RootFolder != null)) 263 if (RootFolder != null)
268 { 264 {
269 if (itemInfo.Folder == RootFolder.ID) 265 if (itemInfo.Folder == RootFolder.ID)
270 { 266 {
@@ -305,14 +301,13 @@ namespace OpenSim.Framework.Communications.Cache
305 /// <summary> 301 /// <summary>
306 /// Add an item to the user's inventory 302 /// Add an item to the user's inventory
307 /// </summary> 303 /// </summary>
308 /// <param name="userID"></param>
309 /// <param name="itemInfo"></param> 304 /// <param name="itemInfo"></param>
310 public void AddItem(LLUUID userID, InventoryItemBase itemInfo) 305 public void AddItem(LLUUID userID, InventoryItemBase itemInfo)
311 { 306 {
312 if ((userID == UserProfile.ID) && HasInventory) 307 if (HasInventory)
313 { 308 {
314 ItemReceive(userID, itemInfo); 309 ItemReceive(itemInfo);
315 m_commsManager.InventoryService.AddNewInventoryItem(userID, itemInfo); 310 m_commsManager.InventoryService.AddItem(itemInfo);
316 } 311 }
317 } 312 }
318 313
@@ -325,7 +320,7 @@ namespace OpenSim.Framework.Communications.Cache
325 { 320 {
326 if ((userID == UserProfile.ID) && HasInventory) 321 if ((userID == UserProfile.ID) && HasInventory)
327 { 322 {
328 m_commsManager.InventoryService.UpdateInventoryItem(userID, itemInfo); 323 m_commsManager.InventoryService.UpdateItem(itemInfo);
329 } 324 }
330 } 325 }
331 326
@@ -343,7 +338,7 @@ namespace OpenSim.Framework.Communications.Cache
343 result = RootFolder.DeleteItem(item.ID); 338 result = RootFolder.DeleteItem(item.ID);
344 if (result) 339 if (result)
345 { 340 {
346 m_commsManager.InventoryService.DeleteInventoryItem(userID, item); 341 m_commsManager.InventoryService.DeleteItem(item);
347 } 342 }
348 } 343 }
349 344
diff --git a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs
index 392d796..befb6c7 100644
--- a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs
+++ b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs
@@ -181,7 +181,8 @@ namespace OpenSim.Framework.Communications.Cache
181 createdBaseFolder.ParentID = createdFolder.ParentID; 181 createdBaseFolder.ParentID = createdFolder.ParentID;
182 createdBaseFolder.Type = createdFolder.Type; 182 createdBaseFolder.Type = createdFolder.Type;
183 createdBaseFolder.Version = createdFolder.Version; 183 createdBaseFolder.Version = createdFolder.Version;
184 m_commsManager.InventoryService.AddNewInventoryFolder(remoteClient.AgentId, createdBaseFolder); 184
185 m_commsManager.InventoryService.AddFolder(createdBaseFolder);
185 } 186 }
186 else 187 else
187 { 188 {
@@ -207,7 +208,7 @@ namespace OpenSim.Framework.Communications.Cache
207 createdBaseFolder.Type = createdFolder.Type; 208 createdBaseFolder.Type = createdFolder.Type;
208 createdBaseFolder.Version = createdFolder.Version; 209 createdBaseFolder.Version = createdFolder.Version;
209 210
210 m_commsManager.InventoryService.AddNewInventoryFolder(remoteClient.AgentId, createdBaseFolder); 211 m_commsManager.InventoryService.AddFolder(createdBaseFolder);
211 } 212 }
212 else 213 else
213 { 214 {
@@ -265,7 +266,8 @@ namespace OpenSim.Framework.Communications.Cache
265 baseFolder.ParentID = parentID; 266 baseFolder.ParentID = parentID;
266 baseFolder.Type = (short) type; 267 baseFolder.Type = (short) type;
267 baseFolder.Version = userProfile.RootFolder.Version; 268 baseFolder.Version = userProfile.RootFolder.Version;
268 m_commsManager.InventoryService.AddNewInventoryFolder(remoteClient.AgentId, baseFolder); 269
270 m_commsManager.InventoryService.AddFolder(baseFolder);
269 } 271 }
270 else 272 else
271 { 273 {
@@ -299,7 +301,8 @@ namespace OpenSim.Framework.Communications.Cache
299 baseFolder.Owner = remoteClient.AgentId; 301 baseFolder.Owner = remoteClient.AgentId;
300 baseFolder.ID = folderID; 302 baseFolder.ID = folderID;
301 baseFolder.ParentID = parentID; 303 baseFolder.ParentID = parentID;
302 m_commsManager.InventoryService.MoveInventoryFolder(remoteClient.AgentId, baseFolder); 304
305 m_commsManager.InventoryService.MoveFolder(baseFolder);
303 } 306 }
304 else 307 else
305 { 308 {
@@ -544,7 +547,7 @@ namespace OpenSim.Framework.Communications.Cache
544 purgedBaseFolder.Type = purgedFolder.Type; 547 purgedBaseFolder.Type = purgedFolder.Type;
545 purgedBaseFolder.Version = purgedFolder.Version; 548 purgedBaseFolder.Version = purgedFolder.Version;
546 549
547 m_commsManager.InventoryService.PurgeInventoryFolder(remoteClient.AgentId, purgedBaseFolder); 550 m_commsManager.InventoryService.PurgeFolder(purgedBaseFolder);
548 551
549 purgedFolder.Purge(); 552 purgedFolder.Purge();
550 } 553 }