public void AddRegion(Scene scene)
        {
            if (Enabled)
            {
                try
                {
                    m_log.InfoFormat("[IRC-Bridge] Connecting region {0}", scene.RegionInfo.RegionName);

                    if (!String.IsNullOrEmpty(m_password))
                    {
                        MainServer.Instance.AddXmlRPCHandler("irc_admin", XmlRpcAdminMethod, false);
                    }

                    m_region = new RegionState(scene, m_config);
                    lock (m_regions) m_regions.Add(m_region);
                    m_region.Open();
                }
                catch (Exception e)
                {
                    m_log.WarnFormat("[IRC-Bridge] Region {0} not connected to IRC : {1}", scene.RegionInfo.RegionName, e.Message);
                    m_log.Debug(e);
                }
            }
            else
            {
                //m_log.DebugFormat("[IRC-Bridge] Not enabled. Connect for region {0} ignored", scene.RegionInfo.RegionName);
            }
        }
 public void AddRegion(Scene scene)
 {
     if (m_pluginEnabled)
     {
         try
         {
             m_log.InfoFormat("[IRC-Bridge] Connecting region {0}", scene.RegionInfo.RegionName);
             if (!String.IsNullOrEmpty(m_password))
                 MainServer.Instance.AddXmlRPCHandler("irc_admin", XmlRpcAdminMethod, false);
             m_region = new RegionState(scene, m_config);
             lock (m_regions) m_regions.Add(m_region);
             m_region.Open();
         }
         catch (Exception e)
         {
             m_log.WarnFormat("[IRC-Bridge] Region {0} not connected to IRC : {1}", scene.RegionInfo.RegionName, e.Message);
             m_log.Debug(e);
         }
     }
     else
     {
         m_log.WarnFormat("[IRC-Bridge] Not enabled. Connect for region {0} ignored", scene.RegionInfo.RegionName);
     }
 }
Exemplo n.º 3
0
        public void Initialise(Scene scene, IConfigSource config)
        {
            // Do a once-only scan of the configuration file to make
            // sure it's basically intact.

            if (!configured)
            {
                configured = true;

                try
                {
                    if ((m_config = config.Configs["IRC"]) == null)
                    {
                        m_log.InfoFormat("[IRC-Bridge] module not configured");
                        return;
                    }

                    if (!m_config.GetBoolean("enabled", false))
                    {
                        m_log.InfoFormat("[IRC-Bridge] module disabled in configuration");
                        return;
                    }
                }
                catch (Exception e)
                {
                    m_log.ErrorFormat("[IRC-Bridge] configuration failed : {0}", e.Message);
                    return;
                }

                enabled = true;

                if (config.Configs["RemoteAdmin"] != null)
                {
                    password = config.Configs["RemoteAdmin"].GetString("access_password", password);
                    scene.CommsManager.HttpServer.AddXmlRPCHandler("irc_admin", XmlRpcAdminMethod, false);
                }
            }

            // Iff the IRC bridge is enabled, then each new region may be
            // connected to IRC. But it should NOT be obligatory (and it
            // is not).
            // We have to do ALL of the startup here because PostInitialize
            // is not called when a region gets created in-flight from the
            // command line.

            if (enabled)
            {
                try
                {
                    m_log.InfoFormat("[IRC-Bridge] Connecting region {0}", scene.RegionInfo.RegionName);
                    region = new RegionState(scene, m_config);
                    lock (m_regions) m_regions.Add(region);
                    region.Open();
                }
                catch (Exception e)
                {
                    m_log.WarnFormat("[IRC-Bridge] Region {0} not connected to IRC : {1}", scene.RegionInfo.RegionName, e.Message);
                    m_log.Debug(e);
                }
            }
            else
            {
                m_log.WarnFormat("[IRC-Bridge] Not enabled. Connect for region {0} ignored", scene.RegionInfo.RegionName);
            }
        }