From 190f9c258b6cd1efda214b2e188903f571e1c6e4 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Thu, 13 Sep 2012 10:00:29 -0700 Subject: Restarting to work on HGSuitcaseInventoryService: added the ability for the outside world to retrieve appearance items. Not ACLed yet. --- .../HypergridService/HGSuitcaseInventoryService.cs | 60 ++++++++++++++++++++-- 1 file changed, 56 insertions(+), 4 deletions(-) (limited to 'OpenSim/Services') diff --git a/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs b/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs index 6e4b68c..91cc6eb 100644 --- a/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs +++ b/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs @@ -56,10 +56,12 @@ namespace OpenSim.Services.HypergridService private string m_HomeURL; private IUserAccountService m_UserAccountService; + private IAvatarService m_AvatarService; // private UserAccountCache m_Cache; private ExpiringCache> m_SuitcaseTrees = new ExpiringCache>(); + private ExpiringCache m_Appearances = new ExpiringCache(); public HGSuitcaseInventoryService(IConfigSource config, string configName) : base(config, configName) @@ -77,7 +79,6 @@ namespace OpenSim.Services.HypergridService IConfig invConfig = config.Configs[m_ConfigName]; if (invConfig != null) { - // realm = authConfig.GetString("Realm", realm); string userAccountsDll = invConfig.GetString("UserAccountsService", string.Empty); if (userAccountsDll == string.Empty) throw new Exception("Please specify UserAccountsService in HGInventoryService configuration"); @@ -87,8 +88,14 @@ namespace OpenSim.Services.HypergridService if (m_UserAccountService == null) throw new Exception(String.Format("Unable to create UserAccountService from {0}", userAccountsDll)); - // legacy configuration [obsolete] - m_HomeURL = invConfig.GetString("ProfileServerURI", string.Empty); + string avatarDll = invConfig.GetString("AvatarService", string.Empty); + if (avatarDll == string.Empty) + throw new Exception("Please specify AvatarService in HGInventoryService configuration"); + + m_AvatarService = ServerUtils.LoadPlugin(avatarDll, args); + if (m_AvatarService == null) + throw new Exception(String.Format("Unable to create m_AvatarService from {0}", avatarDll)); + // Preferred m_HomeURL = invConfig.GetString("HomeURI", m_HomeURL); @@ -394,7 +401,7 @@ namespace OpenSim.Services.HypergridService return null; } - if (!IsWithinSuitcaseTree(it.Owner, it.Folder)) + if (!IsWithinSuitcaseTree(it.Owner, it.Folder) && !IsPartOfAppearance(it.Owner, it.ID)) { m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: Item {0} (folder {1}) is not within Suitcase", it.Name, it.Folder); @@ -549,6 +556,51 @@ namespace OpenSim.Services.HypergridService else return true; } #endregion + + #region Avatar Appearance + + private AvatarAppearance GetAppearance(UUID principalID) + { + AvatarAppearance a = null; + if (m_Appearances.TryGetValue(principalID, out a)) + return a; + + a = m_AvatarService.GetAppearance(principalID); + m_Appearances.AddOrUpdate(principalID, a, 5 * 60); // 5minutes + return a; + } + + private bool IsPartOfAppearance(UUID principalID, UUID itemID) + { + AvatarAppearance a = GetAppearance(principalID); + if (a == null) + return false; + + // Check wearables (body parts and clothes) + for (int i = 0; i < a.Wearables.Length; i++) + { + for (int j = 0; j < a.Wearables[i].Count; j++) + { + if (a.Wearables[i][j].ItemID == itemID) + { + m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: item {0} is a wearable", itemID); + return true; + } + } + } + + // Check attachments + if (a.GetAttachmentForItem(itemID) != null) + { + m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: item {0} is an attachment", itemID); + return true; + } + + return false; + } + + #endregion + } } -- cgit v1.1 From 1ec84ac8b160c1a6ee903b832c75635d1219fe5a Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 15 Sep 2012 02:12:26 +0100 Subject: Add basic asset connector tests to check behaviour for normal, local and temporary assets. Make AssetServiceConnector return more useful data on failure, such as what DLL it was trying to load Allow LocalAssetServiceConnector.GetData() to work without a cache present, as works for the other lasc Get* methods. --- OpenSim/Services/AssetService/AssetServiceBase.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Services') diff --git a/OpenSim/Services/AssetService/AssetServiceBase.cs b/OpenSim/Services/AssetService/AssetServiceBase.cs index 177c565..58ab052 100644 --- a/OpenSim/Services/AssetService/AssetServiceBase.cs +++ b/OpenSim/Services/AssetService/AssetServiceBase.cs @@ -84,7 +84,7 @@ namespace OpenSim.Services.AssetService m_Database = LoadPlugin(dllName); if (m_Database == null) - throw new Exception("Could not find a storage interface in the given module"); + throw new Exception(string.Format("Could not find a storage interface in the module {0}", dllName)); m_Database.Initialise(connString); @@ -96,7 +96,7 @@ namespace OpenSim.Services.AssetService m_AssetLoader = LoadPlugin(loaderName); if (m_AssetLoader == null) - throw new Exception("Asset loader could not be loaded"); + throw new Exception(string.Format("Asset loader could not be loaded from {0}", loaderName)); } } } -- cgit v1.1 From de69a24574786f7517e8dc3be62e413f9e0fae22 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sat, 15 Sep 2012 19:33:51 -0700 Subject: More on HG2.0: added the possibility of controlling the appearance that avies use to visit other grids. Not as good as I wanted, but good enough. Unfortunately we can't switch the appearance from under the avie without getting into a lot of weirdnesses because appearance is viewer-controlled. So instead, when this control is on, I'm disallowing HG-TP unless the user is wearing an allowed HG appearance -- the user gets a warning and needs to switch appearance. WARNING: I'm still not committing the config vars because this is still not ready for ppl to test. --- OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs | 1 + 1 file changed, 1 insertion(+) (limited to 'OpenSim/Services') diff --git a/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs b/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs index 91cc6eb..556a0da 100644 --- a/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs +++ b/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs @@ -573,6 +573,7 @@ namespace OpenSim.Services.HypergridService private bool IsPartOfAppearance(UUID principalID, UUID itemID) { AvatarAppearance a = GetAppearance(principalID); + if (a == null) return false; -- cgit v1.1