From 55d3c9891732d730ad91f5d5b65f7b39d6501029 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 5 Sep 2010 18:24:16 +0100 Subject: Fix up presence connector in SimianGrid --- .../SimianGrid/SimianPresenceServiceConnector.cs | 34 ++++++++++++++-------- 1 file changed, 22 insertions(+), 12 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs index 778f3f4..fd667ed 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs @@ -59,6 +59,7 @@ namespace OpenSim.Services.Connectors.SimianGrid private string m_serverUrl = String.Empty; private SimianActivityDetector m_activityDetector; + private bool m_Enabled = false; #region ISharedRegionModule @@ -71,7 +72,7 @@ namespace OpenSim.Services.Connectors.SimianGrid public string Name { get { return "SimianPresenceServiceConnector"; } } public void AddRegion(Scene scene) { - if (!String.IsNullOrEmpty(m_serverUrl)) + if (m_Enabled) { scene.RegisterModuleInterface(this); scene.RegisterModuleInterface(this); @@ -83,7 +84,7 @@ namespace OpenSim.Services.Connectors.SimianGrid } public void RemoveRegion(Scene scene) { - if (!String.IsNullOrEmpty(m_serverUrl)) + if (m_Enabled) { scene.UnregisterModuleInterface(this); scene.UnregisterModuleInterface(this); @@ -103,20 +104,29 @@ namespace OpenSim.Services.Connectors.SimianGrid public void Initialise(IConfigSource source) { - IConfig gridConfig = source.Configs["PresenceService"]; - if (gridConfig != null) + IConfig moduleConfig = source.Configs["Modules"]; + if (moduleConfig != null) { - string serviceUrl = gridConfig.GetString("PresenceServerURI"); - if (!String.IsNullOrEmpty(serviceUrl)) + string name = moduleConfig.GetString("AssetServices", ""); + if (name == Name) { - if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("=")) - serviceUrl = serviceUrl + '/'; - m_serverUrl = serviceUrl; + IConfig gridConfig = source.Configs["PresenceService"]; + if (gridConfig != null) + { + string serviceUrl = gridConfig.GetString("PresenceServerURI"); + if (!String.IsNullOrEmpty(serviceUrl)) + { + if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("=")) + serviceUrl = serviceUrl + '/'; + m_serverUrl = serviceUrl; + m_Enabled = true; + } + } + + if (String.IsNullOrEmpty(m_serverUrl)) + m_log.Info("[SIMIAN PRESENCE CONNECTOR]: No PresenceServerURI specified, disabling connector"); } } - - if (String.IsNullOrEmpty(m_serverUrl)) - m_log.Info("[SIMIAN PRESENCE CONNECTOR]: No PresenceServerURI specified, disabling connector"); } #region IPresenceService -- cgit v1.1