aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs
diff options
context:
space:
mode:
authorteravus2012-11-15 10:05:16 -0500
committerteravus2012-11-15 10:05:16 -0500
commite9153e1d1aae50024d8cd05fe14a9bce34343a0e (patch)
treebc111d34f95a26b99c7e34d9e495dc14d1802cc3 /OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs
parentMerge master into teravuswork (diff)
downloadopensim-SC-e9153e1d1aae50024d8cd05fe14a9bce34343a0e.zip
opensim-SC-e9153e1d1aae50024d8cd05fe14a9bce34343a0e.tar.gz
opensim-SC-e9153e1d1aae50024d8cd05fe14a9bce34343a0e.tar.bz2
opensim-SC-e9153e1d1aae50024d8cd05fe14a9bce34343a0e.tar.xz
Revert "Merge master into teravuswork", it should have been avination, not master.
This reverts commit dfac269032300872c4d0dc507f4f9062d102b0f4, reversing changes made to 619c39e5144f15aca129d6d999bcc5c34133ee64.
Diffstat (limited to '')
-rw-r--r--OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs76
1 files changed, 7 insertions, 69 deletions
diff --git a/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs b/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs
index 784f136..6e4b68c 100644
--- a/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs
+++ b/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs
@@ -56,12 +56,10 @@ namespace OpenSim.Services.HypergridService
56 56
57 private string m_HomeURL; 57 private string m_HomeURL;
58 private IUserAccountService m_UserAccountService; 58 private IUserAccountService m_UserAccountService;
59 private IAvatarService m_AvatarService;
60 59
61// private UserAccountCache m_Cache; 60// private UserAccountCache m_Cache;
62 61
63 private ExpiringCache<UUID, List<XInventoryFolder>> m_SuitcaseTrees = new ExpiringCache<UUID, List<XInventoryFolder>>(); 62 private ExpiringCache<UUID, List<XInventoryFolder>> m_SuitcaseTrees = new ExpiringCache<UUID, List<XInventoryFolder>>();
64 private ExpiringCache<UUID, AvatarAppearance> m_Appearances = new ExpiringCache<UUID, AvatarAppearance>();
65 63
66 public HGSuitcaseInventoryService(IConfigSource config, string configName) 64 public HGSuitcaseInventoryService(IConfigSource config, string configName)
67 : base(config, configName) 65 : base(config, configName)
@@ -71,7 +69,7 @@ namespace OpenSim.Services.HypergridService
71 m_ConfigName = configName; 69 m_ConfigName = configName;
72 70
73 if (m_Database == null) 71 if (m_Database == null)
74 m_log.ErrorFormat("[HG SUITCASE INVENTORY SERVICE]: m_Database is null!"); 72 m_log.WarnFormat("[XXX]: m_Database is null!");
75 73
76 // 74 //
77 // Try reading the [InventoryService] section, if it exists 75 // Try reading the [InventoryService] section, if it exists
@@ -79,6 +77,7 @@ namespace OpenSim.Services.HypergridService
79 IConfig invConfig = config.Configs[m_ConfigName]; 77 IConfig invConfig = config.Configs[m_ConfigName];
80 if (invConfig != null) 78 if (invConfig != null)
81 { 79 {
80 // realm = authConfig.GetString("Realm", realm);
82 string userAccountsDll = invConfig.GetString("UserAccountsService", string.Empty); 81 string userAccountsDll = invConfig.GetString("UserAccountsService", string.Empty);
83 if (userAccountsDll == string.Empty) 82 if (userAccountsDll == string.Empty)
84 throw new Exception("Please specify UserAccountsService in HGInventoryService configuration"); 83 throw new Exception("Please specify UserAccountsService in HGInventoryService configuration");
@@ -88,14 +87,8 @@ namespace OpenSim.Services.HypergridService
88 if (m_UserAccountService == null) 87 if (m_UserAccountService == null)
89 throw new Exception(String.Format("Unable to create UserAccountService from {0}", userAccountsDll)); 88 throw new Exception(String.Format("Unable to create UserAccountService from {0}", userAccountsDll));
90 89
91 string avatarDll = invConfig.GetString("AvatarService", string.Empty); 90 // legacy configuration [obsolete]
92 if (avatarDll == string.Empty) 91 m_HomeURL = invConfig.GetString("ProfileServerURI", string.Empty);
93 throw new Exception("Please specify AvatarService in HGInventoryService configuration");
94
95 m_AvatarService = ServerUtils.LoadPlugin<IAvatarService>(avatarDll, args);
96 if (m_AvatarService == null)
97 throw new Exception(String.Format("Unable to create m_AvatarService from {0}", avatarDll));
98
99 // Preferred 92 // Preferred
100 m_HomeURL = invConfig.GetString("HomeURI", m_HomeURL); 93 m_HomeURL = invConfig.GetString("HomeURI", m_HomeURL);
101 94
@@ -301,7 +294,7 @@ namespace OpenSim.Services.HypergridService
301 294
302 public override bool AddFolder(InventoryFolderBase folder) 295 public override bool AddFolder(InventoryFolderBase folder)
303 { 296 {
304 //m_log.WarnFormat("[HG SUITCASE INVENTORY SERVICE]: AddFolder {0} {1}", folder.Name, folder.ParentID); 297 m_log.WarnFormat("[HG SUITCASE INVENTORY SERVICE]: AddFolder {0} {1}", folder.Name, folder.ParentID);
305 // Let's do a bit of sanity checking, more than the base service does 298 // Let's do a bit of sanity checking, more than the base service does
306 // make sure the given folder's parent folder exists under the suitcase tree of this user 299 // make sure the given folder's parent folder exists under the suitcase tree of this user
307 300
@@ -323,7 +316,7 @@ namespace OpenSim.Services.HypergridService
323 316
324 public override bool UpdateFolder(InventoryFolderBase folder) 317 public override bool UpdateFolder(InventoryFolderBase folder)
325 { 318 {
326 //m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: Update folder {0}, version {1}", folder.ID, folder.Version); 319 m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: Update folder {0}, version {1}", folder.ID, folder.Version);
327 if (!IsWithinSuitcaseTree(folder.Owner, folder.ID)) 320 if (!IsWithinSuitcaseTree(folder.Owner, folder.ID))
328 { 321 {
329 m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: folder {0} not within Suitcase tree", folder.Name); 322 m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: folder {0} not within Suitcase tree", folder.Name);
@@ -401,7 +394,7 @@ namespace OpenSim.Services.HypergridService
401 return null; 394 return null;
402 } 395 }
403 396
404 if (!IsWithinSuitcaseTree(it.Owner, it.Folder) && !IsPartOfAppearance(it.Owner, it.ID)) 397 if (!IsWithinSuitcaseTree(it.Owner, it.Folder))
405 { 398 {
406 m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: Item {0} (folder {1}) is not within Suitcase", 399 m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: Item {0} (folder {1}) is not within Suitcase",
407 it.Name, it.Folder); 400 it.Name, it.Folder);
@@ -460,15 +453,6 @@ namespace OpenSim.Services.HypergridService
460 453
461 if (folders != null && folders.Length > 0) 454 if (folders != null && folders.Length > 0)
462 return folders[0]; 455 return folders[0];
463
464 // OK, so the RootFolder type didn't work. Let's look for any type with parent UUID.Zero.
465 folders = m_Database.GetFolders(
466 new string[] { "agentID", "folderName", "parentFolderID" },
467 new string[] { principalID.ToString(), "My Inventory", UUID.Zero.ToString() });
468
469 if (folders != null && folders.Length > 0)
470 return folders[0];
471
472 return null; 456 return null;
473 } 457 }
474 458
@@ -565,52 +549,6 @@ namespace OpenSim.Services.HypergridService
565 else return true; 549 else return true;
566 } 550 }
567 #endregion 551 #endregion
568
569 #region Avatar Appearance
570
571 private AvatarAppearance GetAppearance(UUID principalID)
572 {
573 AvatarAppearance a = null;
574 if (m_Appearances.TryGetValue(principalID, out a))
575 return a;
576
577 a = m_AvatarService.GetAppearance(principalID);
578 m_Appearances.AddOrUpdate(principalID, a, 5 * 60); // 5minutes
579 return a;
580 }
581
582 private bool IsPartOfAppearance(UUID principalID, UUID itemID)
583 {
584 AvatarAppearance a = GetAppearance(principalID);
585
586 if (a == null)
587 return false;
588
589 // Check wearables (body parts and clothes)
590 for (int i = 0; i < a.Wearables.Length; i++)
591 {
592 for (int j = 0; j < a.Wearables[i].Count; j++)
593 {
594 if (a.Wearables[i][j].ItemID == itemID)
595 {
596 //m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: item {0} is a wearable", itemID);
597 return true;
598 }
599 }
600 }
601
602 // Check attachments
603 if (a.GetAttachmentForItem(itemID) != null)
604 {
605 //m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: item {0} is an attachment", itemID);
606 return true;
607 }
608
609 return false;
610 }
611
612 #endregion
613
614 } 552 }
615 553
616} 554}