From f4bf581b96347b8d7f115eca74fa84a644eb729c Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sat, 26 Sep 2009 21:00:51 -0700 Subject: Moved all HG1 operations to HGGridConnector.cs and HypergridServerConnector.cs/HypergridServiceConnector.cs, away from Region.Communications and HGNetworkServersInfo. Fixed small bugs with hyperlinked regions' map positions. --- .../Framework/Scenes/Hypergrid/HGAssetMapper.cs | 33 ++++++++++------------ .../Hypergrid/HGSceneCommunicationService.cs | 19 +++++++++---- 2 files changed, 29 insertions(+), 23 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/Hypergrid') diff --git a/OpenSim/Region/Framework/Scenes/Hypergrid/HGAssetMapper.cs b/OpenSim/Region/Framework/Scenes/Hypergrid/HGAssetMapper.cs index 62efd60..b6fa41d 100644 --- a/OpenSim/Region/Framework/Scenes/Hypergrid/HGAssetMapper.cs +++ b/OpenSim/Region/Framework/Scenes/Hypergrid/HGAssetMapper.cs @@ -35,6 +35,7 @@ using OpenSim.Framework; using OpenSim.Framework.Communications.Cache; using OpenSim.Framework.Communications.Clients; using OpenSim.Region.Framework.Scenes.Serialization; +using OpenSim.Services.Interfaces; //using HyperGrid.Framework; //using OpenSim.Region.Communications.Hypergrid; @@ -50,6 +51,18 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid // private Dictionary m_inventoryServers = new Dictionary(); private Scene m_scene; + + private IHyperlinkService m_hyper; + IHyperlinkService HyperlinkService + { + get + { + if (m_hyper == null) + m_hyper = m_scene.RequestModuleInterface(); + return m_hyper; + } + } + #endregion #region Constructor @@ -79,22 +92,6 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid // return null; // } - private bool IsLocalUser(UUID userID) - { - CachedUserInfo uinfo = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(userID); - - if (uinfo != null) - { - if (HGNetworkServersInfo.Singleton.IsLocalUser(uinfo.UserProfile)) - { - m_log.Debug("[HGScene]: Home user " + uinfo.UserProfile.FirstName + " " + uinfo.UserProfile.SurName); - return true; - } - } - - m_log.Debug("[HGScene]: Foreign user " + uinfo.UserProfile.FirstName + " " + uinfo.UserProfile.SurName); - return false; - } public AssetBase FetchAsset(string url, UUID assetID) { @@ -170,7 +167,7 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid public void Get(UUID assetID, UUID ownerID) { - if (!IsLocalUser(ownerID)) + if (!HyperlinkService.IsLocalUser(ownerID)) { // Get the item from the remote asset server onto the local AssetCache // and place an entry in m_assetMap @@ -228,7 +225,7 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid public void Post(UUID assetID, UUID ownerID) { - if (!IsLocalUser(ownerID)) + if (!HyperlinkService.IsLocalUser(ownerID)) { // Post the item from the local AssetCache onto the remote asset server // and place an entry in m_assetMap diff --git a/OpenSim/Region/Framework/Scenes/Hypergrid/HGSceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/Hypergrid/HGSceneCommunicationService.cs index ee5eb90..1217f9b 100644 --- a/OpenSim/Region/Framework/Scenes/Hypergrid/HGSceneCommunicationService.cs +++ b/OpenSim/Region/Framework/Scenes/Hypergrid/HGSceneCommunicationService.cs @@ -38,6 +38,7 @@ using OpenSim.Framework.Communications; using OpenSim.Framework.Communications.Cache; using OpenSim.Framework.Capabilities; using OpenSim.Region.Framework.Interfaces; +using OpenSim.Services.Interfaces; using GridRegion = OpenSim.Services.Interfaces.GridRegion; namespace OpenSim.Region.Framework.Scenes.Hypergrid @@ -46,11 +47,19 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - public readonly IHyperlink m_hg; + private IHyperlinkService m_hg; + IHyperlinkService HyperlinkService + { + get + { + if (m_hg == null) + m_hg = m_scene.RequestModuleInterface(); + return m_hg; + } + } - public HGSceneCommunicationService(CommunicationsManager commsMan, IHyperlink hg) : base(commsMan) + public HGSceneCommunicationService(CommunicationsManager commsMan) : base(commsMan) { - m_hg = hg; } @@ -129,13 +138,13 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid /// Hypergrid mod start /// /// - bool isHyperLink = m_hg.IsHyperlinkRegion(reg.RegionHandle); + bool isHyperLink = (HyperlinkService.GetHyperlinkRegion(reg.RegionHandle) != null); bool isHomeUser = true; ulong realHandle = regionHandle; CachedUserInfo uinfo = m_commsProvider.UserProfileCacheService.GetUserDetails(avatar.UUID); if (uinfo != null) { - isHomeUser = HGNetworkServersInfo.Singleton.IsLocalUser(uinfo.UserProfile); + isHomeUser = HyperlinkService.IsLocalUser(uinfo.UserProfile.ID); realHandle = m_hg.FindRegionHandle(regionHandle); m_log.Debug("XXX ---- home user? " + isHomeUser + " --- hyperlink? " + isHyperLink + " --- real handle: " + realHandle.ToString()); } -- cgit v1.1