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 Grimshaw 2010-07-24 10:43:57 -07:00
parent 3057974f31
commit 81186e76b6
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;
} }
} }
@ -76,7 +81,10 @@ 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)
{ {
scriptEngine.PostScriptEvent(itemID, "xmlrpc_uri", new Object[] {uri}); if (m_enabled)
{
scriptEngine.PostScriptEvent(itemID, "xmlrpc_uri", new Object[] { uri });
}
} }
public void ScriptRemoved(UUID itemID) public void ScriptRemoved(UUID itemID)