aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs')
-rw-r--r--OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs60
1 files changed, 30 insertions, 30 deletions
diff --git a/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs b/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs
index 3de2330..d158537 100644
--- a/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs
+++ b/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs
@@ -122,7 +122,7 @@ namespace OpenSim.Services.HypergridService
122 } 122 }
123 123
124 List<XInventoryFolder> tree = GetFolderTree(principalID, suitcase.folderID); 124 List<XInventoryFolder> tree = GetFolderTree(principalID, suitcase.folderID);
125 if (tree == null || (tree != null && tree.Count == 0)) 125 if (tree.Count == 0)
126 return null; 126 return null;
127 127
128 List<InventoryFolderBase> folders = new List<InventoryFolderBase>(); 128 List<InventoryFolderBase> folders = new List<InventoryFolderBase>();
@@ -164,8 +164,6 @@ namespace OpenSim.Services.HypergridService
164 m_log.ErrorFormat("[HG SUITCASE INVENTORY SERVICE]: Unable to create suitcase folder"); 164 m_log.ErrorFormat("[HG SUITCASE INVENTORY SERVICE]: Unable to create suitcase folder");
165 return null; 165 return null;
166 } 166 }
167
168 m_Database.StoreFolder(suitcase);
169 167
170 CreateSystemFolders(principalID, suitcase.folderID); 168 CreateSystemFolders(principalID, suitcase.folderID);
171 } 169 }
@@ -188,6 +186,10 @@ namespace OpenSim.Services.HypergridService
188 CreateFolder(principalID, rootID, (int)AssetType.CallingCard, "Calling Cards"); 186 CreateFolder(principalID, rootID, (int)AssetType.CallingCard, "Calling Cards");
189 if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)AssetType.Clothing) return true; return false; })) 187 if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)AssetType.Clothing) return true; return false; }))
190 CreateFolder(principalID, rootID, (int)AssetType.Clothing, "Clothing"); 188 CreateFolder(principalID, rootID, (int)AssetType.Clothing, "Clothing");
189 if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)AssetType.CurrentOutfitFolder) return true; return false; }))
190 CreateFolder(principalID, rootID, (int)AssetType.CurrentOutfitFolder, "Current Outfit");
191 if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)AssetType.FavoriteFolder) return true; return false; }))
192 CreateFolder(principalID, rootID, (int)AssetType.FavoriteFolder, "Favorites");
191 if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)AssetType.Gesture) return true; return false; })) 193 if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)AssetType.Gesture) return true; return false; }))
192 CreateFolder(principalID, rootID, (int)AssetType.Gesture, "Gestures"); 194 CreateFolder(principalID, rootID, (int)AssetType.Gesture, "Gestures");
193 if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)AssetType.Landmark) return true; return false; })) 195 if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)AssetType.Landmark) return true; return false; }))
@@ -208,11 +210,6 @@ namespace OpenSim.Services.HypergridService
208 CreateFolder(principalID, rootID, (int)AssetType.Texture, "Textures"); 210 CreateFolder(principalID, rootID, (int)AssetType.Texture, "Textures");
209 if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)AssetType.TrashFolder) return true; return false; })) 211 if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)AssetType.TrashFolder) return true; return false; }))
210 CreateFolder(principalID, rootID, (int)AssetType.TrashFolder, "Trash"); 212 CreateFolder(principalID, rootID, (int)AssetType.TrashFolder, "Trash");
211 if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)AssetType.FavoriteFolder) return true; return false; }))
212 CreateFolder(principalID, rootID, (int)AssetType.FavoriteFolder, "Favorites");
213 if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)AssetType.CurrentOutfitFolder) return true; return false; }))
214 CreateFolder(principalID, rootID, (int)AssetType.CurrentOutfitFolder, "Current Outfit");
215
216 } 213 }
217 214
218 public override InventoryFolderBase GetFolderForType(UUID principalID, AssetType type) 215 public override InventoryFolderBase GetFolderForType(UUID principalID, AssetType type)
@@ -249,7 +246,7 @@ namespace OpenSim.Services.HypergridService
249 246
250 if (!IsWithinSuitcaseTree(principalID, folderID)) 247 if (!IsWithinSuitcaseTree(principalID, folderID))
251 { 248 {
252 m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: GetFolderContent: folder {0} is not within Suitcase tree", folderID); 249 m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: GetFolderContent: folder {0} (user {1}) is not within Suitcase tree", folderID, principalID);
253 return new InventoryCollection(); 250 return new InventoryCollection();
254 } 251 }
255 252
@@ -269,7 +266,7 @@ namespace OpenSim.Services.HypergridService
269 // make sure the given folder exists under the suitcase tree of this user 266 // make sure the given folder exists under the suitcase tree of this user
270 if (!IsWithinSuitcaseTree(principalID, folderID)) 267 if (!IsWithinSuitcaseTree(principalID, folderID))
271 { 268 {
272 m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: GetFolderItems: folder {0} is not within Suitcase tree", folderID); 269 m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: GetFolderItems: folder {0} (user {1}) is not within Suitcase tree", folderID, principalID);
273 return new List<InventoryItemBase>(); 270 return new List<InventoryItemBase>();
274 } 271 }
275 272
@@ -284,7 +281,7 @@ namespace OpenSim.Services.HypergridService
284 281
285 if (!IsWithinSuitcaseTree(folder.Owner, folder.ParentID)) 282 if (!IsWithinSuitcaseTree(folder.Owner, folder.ParentID))
286 { 283 {
287 m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: AddFolder: folder {0} is not within Suitcase tree", folder.ParentID); 284 m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: AddFolder: folder {0} (user {1}) is not within Suitcase tree", folder.ParentID, folder.Owner);
288 return false; 285 return false;
289 } 286 }
290 287
@@ -306,7 +303,7 @@ namespace OpenSim.Services.HypergridService
306 //m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: Update folder {0}, version {1}", folder.ID, folder.Version); 303 //m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: Update folder {0}, version {1}", folder.ID, folder.Version);
307 if (!IsWithinSuitcaseTree(folder.Owner, folder.ID)) 304 if (!IsWithinSuitcaseTree(folder.Owner, folder.ID))
308 { 305 {
309 m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: UpdateFolder: folder {0}/{1} is not within Suitcase tree", folder.Name, folder.ID); 306 m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: UpdateFolder: folder {0}/{1} (user {2}) is not within Suitcase tree", folder.Name, folder.ID, folder.Owner);
310 return false; 307 return false;
311 } 308 }
312 309
@@ -318,13 +315,13 @@ namespace OpenSim.Services.HypergridService
318 { 315 {
319 if (!IsWithinSuitcaseTree(folder.Owner, folder.ID)) 316 if (!IsWithinSuitcaseTree(folder.Owner, folder.ID))
320 { 317 {
321 m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: MoveFolder: folder {0} is not within Suitcase tree", folder.ID); 318 m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: MoveFolder: folder {0} (user {1}) is not within Suitcase tree", folder.ID, folder.Owner);
322 return false; 319 return false;
323 } 320 }
324 321
325 if (!IsWithinSuitcaseTree(folder.Owner, folder.ParentID)) 322 if (!IsWithinSuitcaseTree(folder.Owner, folder.ParentID))
326 { 323 {
327 m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: MoveFolder: folder {0} is not within Suitcase tree", folder.ParentID); 324 m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: MoveFolder: folder {0} (user {1}) is not within Suitcase tree", folder.ParentID, folder.Owner);
328 return false; 325 return false;
329 } 326 }
330 327
@@ -349,7 +346,7 @@ namespace OpenSim.Services.HypergridService
349 // make sure the given folder's parent folder exists under the suitcase tree of this user 346 // make sure the given folder's parent folder exists under the suitcase tree of this user
350 if (!IsWithinSuitcaseTree(item.Owner, item.Folder)) 347 if (!IsWithinSuitcaseTree(item.Owner, item.Folder))
351 { 348 {
352 m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: AddItem: folder {0} is not within Suitcase tree", item.Folder); 349 m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: AddItem: folder {0} (user {1}) is not within Suitcase tree", item.Folder, item.Owner);
353 return false; 350 return false;
354 } 351 }
355 352
@@ -362,7 +359,7 @@ namespace OpenSim.Services.HypergridService
362 { 359 {
363 if (!IsWithinSuitcaseTree(item.Owner, item.Folder)) 360 if (!IsWithinSuitcaseTree(item.Owner, item.Folder))
364 { 361 {
365 m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: UpdateItem: folder {0} is not within Suitcase tree", item.Folder); 362 m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: UpdateItem: folder {0} (user {1}) is not within Suitcase tree", item.Folder, item.Owner);
366 return false; 363 return false;
367 } 364 }
368 365
@@ -378,7 +375,7 @@ namespace OpenSim.Services.HypergridService
378 { 375 {
379 if (!IsWithinSuitcaseTree(item.Owner, item.Folder)) 376 if (!IsWithinSuitcaseTree(item.Owner, item.Folder))
380 { 377 {
381 m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: MoveItems: folder {0} is not within Suitcase tree", item.Folder); 378 m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: MoveItems: folder {0} (user {1}) is not within Suitcase tree", item.Folder, item.Owner);
382 return false; 379 return false;
383 } 380 }
384 } 381 }
@@ -389,7 +386,7 @@ namespace OpenSim.Services.HypergridService
389 InventoryItemBase originalItem = base.GetItem(item); 386 InventoryItemBase originalItem = base.GetItem(item);
390 if (!IsWithinSuitcaseTree(originalItem.Owner, originalItem.Folder)) 387 if (!IsWithinSuitcaseTree(originalItem.Owner, originalItem.Folder))
391 { 388 {
392 m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: MoveItems: folder {0} is not within Suitcase tree", originalItem.Folder); 389 m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: MoveItems: folder {0} (user {1}) is not within Suitcase tree", item.Folder, item.Owner);
393 return false; 390 return false;
394 } 391 }
395 } 392 }
@@ -414,8 +411,8 @@ namespace OpenSim.Services.HypergridService
414 411
415 if (!IsWithinSuitcaseTree(it.Owner, it.Folder) && !IsPartOfAppearance(it.Owner, it.ID)) 412 if (!IsWithinSuitcaseTree(it.Owner, it.Folder) && !IsPartOfAppearance(it.Owner, it.ID))
416 { 413 {
417 m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: Item {0}/{1} (folder {2}) is not within Suitcase tree or Appearance", 414 m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: GetItem: item {0}/{1} (folder {2}) (user {3}) is not within Suitcase tree or Appearance",
418 it.Name, it.ID, it.Folder); 415 it.Name, it.ID, it.Folder, it.Owner);
419 return null; 416 return null;
420 } 417 }
421 418
@@ -437,8 +434,8 @@ namespace OpenSim.Services.HypergridService
437 { 434 {
438 if (!IsWithinSuitcaseTree(f.Owner, f.ID)) 435 if (!IsWithinSuitcaseTree(f.Owner, f.ID))
439 { 436 {
440 m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: Folder {0}/{1} is not within Suitcase tree", 437 m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: GetFolder: folder {0}/{1} (user {2}) is not within Suitcase tree",
441 f.Name, f.ID); 438 f.Name, f.ID, f.Owner);
442 return null; 439 return null;
443 } 440 }
444 } 441 }
@@ -537,13 +534,13 @@ namespace OpenSim.Services.HypergridService
537 534
538 private List<XInventoryFolder> GetFolderTree(UUID principalID, UUID folder) 535 private List<XInventoryFolder> GetFolderTree(UUID principalID, UUID folder)
539 { 536 {
540 List<XInventoryFolder> t = null; 537 List<XInventoryFolder> t;
541 if (m_SuitcaseTrees.TryGetValue(principalID, out t)) 538 if (m_SuitcaseTrees.TryGetValue(principalID, out t))
542 return t; 539 return t;
543 540
544 // Get the tree of the suitcase folder 541 // Get the tree of the suitcase folder
545 t = GetFolderTreeRecursive(folder); 542 t = GetFolderTreeRecursive(folder);
546 m_SuitcaseTrees.AddOrUpdate(principalID, t, 5*60); // 5minutes 543 m_SuitcaseTrees.AddOrUpdate(principalID, t, 5*60); // 5 minutes
547 return t; 544 return t;
548 } 545 }
549 546
@@ -554,8 +551,10 @@ namespace OpenSim.Services.HypergridService
554 new string[] { "parentFolderID" }, 551 new string[] { "parentFolderID" },
555 new string[] { root.ToString() }); 552 new string[] { root.ToString() });
556 553
557 if (folders == null || (folders != null && folders.Length == 0)) 554 if (folders == null || folders.Length == 0)
555 {
558 return tree; // empty tree 556 return tree; // empty tree
557 }
559 else 558 else
560 { 559 {
561 foreach (XInventoryFolder f in folders) 560 foreach (XInventoryFolder f in folders)
@@ -588,17 +587,18 @@ namespace OpenSim.Services.HypergridService
588 List<XInventoryFolder> tree = new List<XInventoryFolder>(); 587 List<XInventoryFolder> tree = new List<XInventoryFolder>();
589 tree.Add(suitcase); // Warp! the tree is the real root folder plus the children of the suitcase folder 588 tree.Add(suitcase); // Warp! the tree is the real root folder plus the children of the suitcase folder
590 tree.AddRange(GetFolderTree(principalID, suitcase.folderID)); 589 tree.AddRange(GetFolderTree(principalID, suitcase.folderID));
590
591 // Also add the Current Outfit folder to the list of available folders 591 // Also add the Current Outfit folder to the list of available folders
592 tree.Add(GetCurrentOutfitXFolder(principalID)); 592 XInventoryFolder folder = GetCurrentOutfitXFolder(principalID);
593 if (folder != null)
594 tree.Add(folder);
593 595
594 XInventoryFolder f = tree.Find(delegate(XInventoryFolder fl) 596 XInventoryFolder f = tree.Find(delegate(XInventoryFolder fl)
595 { 597 {
596 if (fl.folderID == folderID) return true; 598 return (fl.folderID == folderID);
597 else return false;
598 }); 599 });
599 600
600 if (f == null) return false; 601 return (f != null);
601 else return true;
602 } 602 }
603 #endregion 603 #endregion
604 604