aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework/Communications/Cache/CachedUserInfo.cs')
-rw-r--r--OpenSim/Framework/Communications/Cache/CachedUserInfo.cs81
1 files changed, 38 insertions, 43 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