Add an m_enabled flag to XmlRpcRouterModule so it won't try to bind the xmlrpc_uri event if it's not mentioned in the ini.

avinationmerge
Tom 2010-08-01 10:24:17 -07:00
parent b860c8021e
commit 763dc8bb76
1 changed files with 10 additions and 2 deletions

View File

@ -42,7 +42,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.XmlRpcRouterModule
public class XmlRpcRouter : IRegionModule, IXmlRpcRouter public class XmlRpcRouter : IRegionModule, IXmlRpcRouter
{ {
//private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private bool m_enabled = false;
public void Initialise(Scene scene, IConfigSource config) public void Initialise(Scene scene, IConfigSource config)
{ {
IConfig startupConfig = config.Configs["Startup"]; IConfig startupConfig = config.Configs["Startup"];
@ -53,6 +53,11 @@ namespace OpenSim.Region.OptionalModules.Scripting.XmlRpcRouterModule
"XmlRpcRouterModule") == "XmlRpcRouterModule") "XmlRpcRouterModule") == "XmlRpcRouterModule")
{ {
scene.RegisterModuleInterface<IXmlRpcRouter>(this); scene.RegisterModuleInterface<IXmlRpcRouter>(this);
m_enabled = true;
}
else
{
m_enabled = false;
} }
} }
@ -75,9 +80,12 @@ namespace OpenSim.Region.OptionalModules.Scripting.XmlRpcRouterModule
} }
public void RegisterNewReceiver(IScriptModule scriptEngine, UUID channel, UUID objectID, UUID itemID, string uri) public void RegisterNewReceiver(IScriptModule scriptEngine, UUID channel, UUID objectID, UUID itemID, string uri)
{
if (m_enabled)
{ {
scriptEngine.PostScriptEvent(itemID, "xmlrpc_uri", new Object[] { uri }); scriptEngine.PostScriptEvent(itemID, "xmlrpc_uri", new Object[] { uri });
} }
}
public void ScriptRemoved(UUID itemID) public void ScriptRemoved(UUID itemID)
{ {