Fix up presence connector in SimianGrid

viewer-2-initial-appearance
Melanie 2010-09-05 18:24:16 +01:00
parent 0ca48b2486
commit 55d3c98917
1 changed files with 22 additions and 12 deletions

View File

@ -59,6 +59,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
private string m_serverUrl = String.Empty; private string m_serverUrl = String.Empty;
private SimianActivityDetector m_activityDetector; private SimianActivityDetector m_activityDetector;
private bool m_Enabled = false;
#region ISharedRegionModule #region ISharedRegionModule
@ -71,7 +72,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
public string Name { get { return "SimianPresenceServiceConnector"; } } public string Name { get { return "SimianPresenceServiceConnector"; } }
public void AddRegion(Scene scene) public void AddRegion(Scene scene)
{ {
if (!String.IsNullOrEmpty(m_serverUrl)) if (m_Enabled)
{ {
scene.RegisterModuleInterface<IPresenceService>(this); scene.RegisterModuleInterface<IPresenceService>(this);
scene.RegisterModuleInterface<IGridUserService>(this); scene.RegisterModuleInterface<IGridUserService>(this);
@ -83,7 +84,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
} }
public void RemoveRegion(Scene scene) public void RemoveRegion(Scene scene)
{ {
if (!String.IsNullOrEmpty(m_serverUrl)) if (m_Enabled)
{ {
scene.UnregisterModuleInterface<IPresenceService>(this); scene.UnregisterModuleInterface<IPresenceService>(this);
scene.UnregisterModuleInterface<IGridUserService>(this); scene.UnregisterModuleInterface<IGridUserService>(this);
@ -103,20 +104,29 @@ namespace OpenSim.Services.Connectors.SimianGrid
public void Initialise(IConfigSource source) public void Initialise(IConfigSource source)
{ {
IConfig gridConfig = source.Configs["PresenceService"]; IConfig moduleConfig = source.Configs["Modules"];
if (gridConfig != null) if (moduleConfig != null)
{ {
string serviceUrl = gridConfig.GetString("PresenceServerURI"); string name = moduleConfig.GetString("AssetServices", "");
if (!String.IsNullOrEmpty(serviceUrl)) if (name == Name)
{ {
if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("=")) IConfig gridConfig = source.Configs["PresenceService"];
serviceUrl = serviceUrl + '/'; if (gridConfig != null)
m_serverUrl = serviceUrl; {
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 #region IPresenceService