diff options
author | Melanie | 2012-09-16 04:11:20 +0100 |
---|---|---|
committer | Melanie | 2012-09-16 04:11:20 +0100 |
commit | db774d4292588db1e2ac4a9fafe977ddbec353ee (patch) | |
tree | 5fc381d7cb96cc0d2b47e4807821f488c339ec13 /OpenSim/Services/HypergridService | |
parent | Merge branch 'avination' into careminster (diff) | |
parent | Merge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff) | |
download | opensim-SC_OLD-db774d4292588db1e2ac4a9fafe977ddbec353ee.zip opensim-SC_OLD-db774d4292588db1e2ac4a9fafe977ddbec353ee.tar.gz opensim-SC_OLD-db774d4292588db1e2ac4a9fafe977ddbec353ee.tar.bz2 opensim-SC_OLD-db774d4292588db1e2ac4a9fafe977ddbec353ee.tar.xz |
Merge branch 'master' into careminster
Conflicts:
OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
OpenSim/Region/Framework/Scenes/EventManager.cs
Diffstat (limited to 'OpenSim/Services/HypergridService')
-rw-r--r-- | OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs | 61 |
1 files changed, 57 insertions, 4 deletions
diff --git a/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs b/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs index 6e4b68c..556a0da 100644 --- a/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs +++ b/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs | |||
@@ -56,10 +56,12 @@ 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; | ||
59 | 60 | ||
60 | // private UserAccountCache m_Cache; | 61 | // private UserAccountCache m_Cache; |
61 | 62 | ||
62 | private ExpiringCache<UUID, List<XInventoryFolder>> m_SuitcaseTrees = new ExpiringCache<UUID, List<XInventoryFolder>>(); | 63 | private ExpiringCache<UUID, List<XInventoryFolder>> m_SuitcaseTrees = new ExpiringCache<UUID, List<XInventoryFolder>>(); |
64 | private ExpiringCache<UUID, AvatarAppearance> m_Appearances = new ExpiringCache<UUID, AvatarAppearance>(); | ||
63 | 65 | ||
64 | public HGSuitcaseInventoryService(IConfigSource config, string configName) | 66 | public HGSuitcaseInventoryService(IConfigSource config, string configName) |
65 | : base(config, configName) | 67 | : base(config, configName) |
@@ -77,7 +79,6 @@ namespace OpenSim.Services.HypergridService | |||
77 | IConfig invConfig = config.Configs[m_ConfigName]; | 79 | IConfig invConfig = config.Configs[m_ConfigName]; |
78 | if (invConfig != null) | 80 | if (invConfig != null) |
79 | { | 81 | { |
80 | // realm = authConfig.GetString("Realm", realm); | ||
81 | string userAccountsDll = invConfig.GetString("UserAccountsService", string.Empty); | 82 | string userAccountsDll = invConfig.GetString("UserAccountsService", string.Empty); |
82 | if (userAccountsDll == string.Empty) | 83 | if (userAccountsDll == string.Empty) |
83 | throw new Exception("Please specify UserAccountsService in HGInventoryService configuration"); | 84 | throw new Exception("Please specify UserAccountsService in HGInventoryService configuration"); |
@@ -87,8 +88,14 @@ namespace OpenSim.Services.HypergridService | |||
87 | if (m_UserAccountService == null) | 88 | if (m_UserAccountService == null) |
88 | throw new Exception(String.Format("Unable to create UserAccountService from {0}", userAccountsDll)); | 89 | throw new Exception(String.Format("Unable to create UserAccountService from {0}", userAccountsDll)); |
89 | 90 | ||
90 | // legacy configuration [obsolete] | 91 | string avatarDll = invConfig.GetString("AvatarService", string.Empty); |
91 | m_HomeURL = invConfig.GetString("ProfileServerURI", string.Empty); | 92 | if (avatarDll == 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 | |||
92 | // Preferred | 99 | // Preferred |
93 | m_HomeURL = invConfig.GetString("HomeURI", m_HomeURL); | 100 | m_HomeURL = invConfig.GetString("HomeURI", m_HomeURL); |
94 | 101 | ||
@@ -394,7 +401,7 @@ namespace OpenSim.Services.HypergridService | |||
394 | return null; | 401 | return null; |
395 | } | 402 | } |
396 | 403 | ||
397 | if (!IsWithinSuitcaseTree(it.Owner, it.Folder)) | 404 | if (!IsWithinSuitcaseTree(it.Owner, it.Folder) && !IsPartOfAppearance(it.Owner, it.ID)) |
398 | { | 405 | { |
399 | m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: Item {0} (folder {1}) is not within Suitcase", | 406 | m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: Item {0} (folder {1}) is not within Suitcase", |
400 | it.Name, it.Folder); | 407 | it.Name, it.Folder); |
@@ -549,6 +556,52 @@ namespace OpenSim.Services.HypergridService | |||
549 | else return true; | 556 | else return true; |
550 | } | 557 | } |
551 | #endregion | 558 | #endregion |
559 | |||
560 | #region Avatar Appearance | ||
561 | |||
562 | private AvatarAppearance GetAppearance(UUID principalID) | ||
563 | { | ||
564 | AvatarAppearance a = null; | ||
565 | if (m_Appearances.TryGetValue(principalID, out a)) | ||
566 | return a; | ||
567 | |||
568 | a = m_AvatarService.GetAppearance(principalID); | ||
569 | m_Appearances.AddOrUpdate(principalID, a, 5 * 60); // 5minutes | ||
570 | return a; | ||
571 | } | ||
572 | |||
573 | private bool IsPartOfAppearance(UUID principalID, UUID itemID) | ||
574 | { | ||
575 | AvatarAppearance a = GetAppearance(principalID); | ||
576 | |||
577 | if (a == null) | ||
578 | return false; | ||
579 | |||
580 | // Check wearables (body parts and clothes) | ||
581 | for (int i = 0; i < a.Wearables.Length; i++) | ||
582 | { | ||
583 | for (int j = 0; j < a.Wearables[i].Count; j++) | ||
584 | { | ||
585 | if (a.Wearables[i][j].ItemID == itemID) | ||
586 | { | ||
587 | m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: item {0} is a wearable", itemID); | ||
588 | return true; | ||
589 | } | ||
590 | } | ||
591 | } | ||
592 | |||
593 | // Check attachments | ||
594 | if (a.GetAttachmentForItem(itemID) != null) | ||
595 | { | ||
596 | m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: item {0} is an attachment", itemID); | ||
597 | return true; | ||
598 | } | ||
599 | |||
600 | return false; | ||
601 | } | ||
602 | |||
603 | #endregion | ||
604 | |||
552 | } | 605 | } |
553 | 606 | ||
554 | } | 607 | } |