completing move to refactored multi-channel capable IRCBridgeModule
parent
69ae33db1a
commit
add42f5e9b
|
@ -97,7 +97,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
|
||||||
|
|
||||||
// IRC connector reference
|
// IRC connector reference
|
||||||
|
|
||||||
internal XIRCConnector irc = null;
|
internal IRCConnector irc = null;
|
||||||
|
|
||||||
internal int idn = _idk_++;
|
internal int idn = _idk_++;
|
||||||
|
|
||||||
|
@ -256,7 +256,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
|
||||||
// values that, while independent of the IRC connetion, do still distinguish
|
// values that, while independent of the IRC connetion, do still distinguish
|
||||||
// this region's behavior.
|
// this region's behavior.
|
||||||
|
|
||||||
foreach (ChannelState xcs in XIRCBridgeModule.m_channels)
|
foreach (ChannelState xcs in IRCBridgeModule.m_channels)
|
||||||
{
|
{
|
||||||
if (cs.IsAPerfectMatchFor(xcs))
|
if (cs.IsAPerfectMatchFor(xcs))
|
||||||
{
|
{
|
||||||
|
@ -279,9 +279,9 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
|
||||||
|
|
||||||
m_log.DebugFormat("[IRC-Channel-{0}] New channel required", cs.idn);
|
m_log.DebugFormat("[IRC-Channel-{0}] New channel required", cs.idn);
|
||||||
|
|
||||||
if ((cs.irc = new XIRCConnector(cs)) != null)
|
if ((cs.irc = new IRCConnector(cs)) != null)
|
||||||
{
|
{
|
||||||
XIRCBridgeModule.m_channels.Add(cs);
|
IRCBridgeModule.m_channels.Add(cs);
|
||||||
|
|
||||||
m_log.InfoFormat("[IRC-Channel-{0}] New channel initialized for {1}, nick: {2}, commands {3}, private channels {4}",
|
m_log.InfoFormat("[IRC-Channel-{0}] New channel initialized for {1}, nick: {2}, commands {3}, private channels {4}",
|
||||||
cs.idn, rs.Region, cs.DefaultZone,
|
cs.idn, rs.Region, cs.DefaultZone,
|
||||||
|
@ -554,7 +554,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
|
||||||
// contains information that is not differentiating from an
|
// contains information that is not differentiating from an
|
||||||
// IRC point-of-view.
|
// IRC point-of-view.
|
||||||
|
|
||||||
public static void OSChat(XIRCConnector p_irc, OSChatMessage c, bool cmsg)
|
public static void OSChat(IRCConnector p_irc, OSChatMessage c, bool cmsg)
|
||||||
{
|
{
|
||||||
|
|
||||||
// m_log.DebugFormat("[IRC-OSCHAT] from {0}:{1}", p_irc.Server, p_irc.IrcChannel);
|
// m_log.DebugFormat("[IRC-OSCHAT] from {0}:{1}", p_irc.Server, p_irc.IrcChannel);
|
||||||
|
@ -568,7 +568,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
|
||||||
// Note that this code is responsible for completing some of the
|
// Note that this code is responsible for completing some of the
|
||||||
// settings for the inbound OSChatMessage
|
// settings for the inbound OSChatMessage
|
||||||
|
|
||||||
foreach (ChannelState cs in XIRCBridgeModule.m_channels)
|
foreach (ChannelState cs in IRCBridgeModule.m_channels)
|
||||||
{
|
{
|
||||||
if ( p_irc == cs.irc)
|
if ( p_irc == cs.irc)
|
||||||
{
|
{
|
||||||
|
|
|
@ -39,7 +39,7 @@ using OpenSim.Region.Environment.Scenes;
|
||||||
namespace OpenSim.Region.Environment.Modules.Avatar.Chat
|
namespace OpenSim.Region.Environment.Modules.Avatar.Chat
|
||||||
{
|
{
|
||||||
|
|
||||||
public class XIRCBridgeModule : IRegionModule
|
public class IRCBridgeModule : IRegionModule
|
||||||
{
|
{
|
||||||
|
|
||||||
private static readonly ILog m_log =
|
private static readonly ILog m_log =
|
||||||
|
@ -58,7 +58,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
|
||||||
|
|
||||||
public string Name
|
public string Name
|
||||||
{
|
{
|
||||||
get { return "XIRCBridgeModule"; }
|
get { return "IRCBridgeModule"; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsSharedModule
|
public bool IsSharedModule
|
||||||
|
@ -81,19 +81,19 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
|
||||||
{
|
{
|
||||||
if ((m_config = config.Configs["IRC"]) == null)
|
if ((m_config = config.Configs["IRC"]) == null)
|
||||||
{
|
{
|
||||||
m_log.InfoFormat("[XIRC-Bridge] module not configured");
|
m_log.InfoFormat("[IRC-Bridge] module not configured");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!m_config.GetBoolean("enabled", false))
|
if (!m_config.GetBoolean("enabled", false))
|
||||||
{
|
{
|
||||||
m_log.InfoFormat("[XIRC-Bridge] module disabled in configuration");
|
m_log.InfoFormat("[IRC-Bridge] module disabled in configuration");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
m_log.ErrorFormat("[XIRC-Bridge] configuration failed : {0}", e.Message);
|
m_log.ErrorFormat("[IRC-Bridge] configuration failed : {0}", e.Message);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
|
||||||
if (config.Configs["RemoteAdmin"] != null)
|
if (config.Configs["RemoteAdmin"] != null)
|
||||||
{
|
{
|
||||||
password = config.Configs["RemoteAdmin"].GetString("access_password", password);
|
password = config.Configs["RemoteAdmin"].GetString("access_password", password);
|
||||||
scene.CommsManager.HttpServer.AddXmlRPCHandler("xirc_admin", XmlRpcAdminMethod, false);
|
scene.CommsManager.HttpServer.AddXmlRPCHandler("irc_admin", XmlRpcAdminMethod, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -115,18 +115,18 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
m_log.InfoFormat("[XIRC-Bridge] Connecting region {0}", scene.RegionInfo.RegionName);
|
m_log.InfoFormat("[IRC-Bridge] Connecting region {0}", scene.RegionInfo.RegionName);
|
||||||
m_regions.Add(new RegionState(scene, m_config));
|
m_regions.Add(new RegionState(scene, m_config));
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
m_log.WarnFormat("[XIRC-Bridge] Region {0} not connected to IRC : {1}", scene.RegionInfo.RegionName, e.Message);
|
m_log.WarnFormat("[IRC-Bridge] Region {0} not connected to IRC : {1}", scene.RegionInfo.RegionName, e.Message);
|
||||||
m_log.Debug(e);
|
m_log.Debug(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_log.WarnFormat("[XIRC-Bridge] Not enabled. Connect for region {0} ignored", scene.RegionInfo.RegionName);
|
m_log.WarnFormat("[IRC-Bridge] Not enabled. Connect for region {0} ignored", scene.RegionInfo.RegionName);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -144,7 +144,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
|
||||||
|
|
||||||
foreach (RegionState region in m_regions)
|
foreach (RegionState region in m_regions)
|
||||||
{
|
{
|
||||||
m_log.InfoFormat("[XIRC-Bridge] Opening connection for {0}:{1} on IRC server {2}:{3}",
|
m_log.InfoFormat("[IRC-Bridge] Opening connection for {0}:{1} on IRC server {2}:{3}",
|
||||||
region.Region, region.cs.BaseNickname, region.cs.Server, region.cs.IrcChannel);
|
region.Region, region.cs.BaseNickname, region.cs.Server, region.cs.IrcChannel);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -152,7 +152,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
m_log.ErrorFormat("[XIRC-Bridge] Open failed for {0}:{1} on IRC server {2}:{3} : {4}",
|
m_log.ErrorFormat("[IRC-Bridge] Open failed for {0}:{1} on IRC server {2}:{3} : {4}",
|
||||||
region.Region, region.cs.BaseNickname, region.cs.Server, region.cs.IrcChannel,
|
region.Region, region.cs.BaseNickname, region.cs.Server, region.cs.IrcChannel,
|
||||||
e.Message);
|
e.Message);
|
||||||
}
|
}
|
||||||
|
@ -173,7 +173,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
|
||||||
|
|
||||||
foreach (RegionState region in m_regions)
|
foreach (RegionState region in m_regions)
|
||||||
{
|
{
|
||||||
m_log.InfoFormat("[XIRC-Bridge] Closing connection for {0}:{1} on IRC server {2}:{3}",
|
m_log.InfoFormat("[IRC-Bridge] Closing connection for {0}:{1} on IRC server {2}:{3}",
|
||||||
region.Region, region.cs.BaseNickname, region.cs.Server, region.cs.IrcChannel);
|
region.Region, region.cs.BaseNickname, region.cs.Server, region.cs.IrcChannel);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -181,7 +181,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
m_log.ErrorFormat("[XIRC-Bridge] Close failed for {0}:{1} on IRC server {2}:{3} : {4}",
|
m_log.ErrorFormat("[IRC-Bridge] Close failed for {0}:{1} on IRC server {2}:{3} : {4}",
|
||||||
region.Region, region.cs.BaseNickname, region.cs.Server, region.cs.IrcChannel,
|
region.Region, region.cs.BaseNickname, region.cs.Server, region.cs.IrcChannel,
|
||||||
e.Message);
|
e.Message);
|
||||||
}
|
}
|
||||||
|
@ -191,7 +191,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
|
||||||
|
|
||||||
foreach (ChannelState channel in m_channels)
|
foreach (ChannelState channel in m_channels)
|
||||||
{
|
{
|
||||||
m_log.InfoFormat("[XIRC-Bridge] Closing connection for {0} on IRC server {1}:{2}",
|
m_log.InfoFormat("[IRC-Bridge] Closing connection for {0} on IRC server {1}:{2}",
|
||||||
channel.BaseNickname, channel.Server, channel.IrcChannel);
|
channel.BaseNickname, channel.Server, channel.IrcChannel);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -199,7 +199,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
m_log.ErrorFormat("[XIRC-Bridge] Close failed for {0} on IRC server {1}:{2} : {3}",
|
m_log.ErrorFormat("[IRC-Bridge] Close failed for {0} on IRC server {1}:{2} : {3}",
|
||||||
channel.BaseNickname, channel.Server, channel.IrcChannel,
|
channel.BaseNickname, channel.Server, channel.IrcChannel,
|
||||||
e.Message);
|
e.Message);
|
||||||
}
|
}
|
||||||
|
@ -212,7 +212,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
|
||||||
public XmlRpcResponse XmlRpcAdminMethod(XmlRpcRequest request)
|
public XmlRpcResponse XmlRpcAdminMethod(XmlRpcRequest request)
|
||||||
{
|
{
|
||||||
|
|
||||||
m_log.Info("[XIRC-Bridge]: XML RPC Admin Entry");
|
m_log.Info("[IRC-Bridge]: XML RPC Admin Entry");
|
||||||
|
|
||||||
XmlRpcResponse response = new XmlRpcResponse();
|
XmlRpcResponse response = new XmlRpcResponse();
|
||||||
Hashtable responseData = new Hashtable();
|
Hashtable responseData = new Hashtable();
|
||||||
|
@ -258,7 +258,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
m_log.InfoFormat("[XIRC-Bridge] XML RPC Admin request failed : {0}", e.Message);
|
m_log.InfoFormat("[IRC-Bridge] XML RPC Admin request failed : {0}", e.Message);
|
||||||
|
|
||||||
responseData["success"] = "false";
|
responseData["success"] = "false";
|
||||||
responseData["error"] = e.Message;
|
responseData["error"] = e.Message;
|
||||||
|
@ -269,7 +269,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
|
||||||
response.Value = responseData;
|
response.Value = responseData;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_log.Debug("[XIRC-Bridge]: XML RPC Admin Exit");
|
m_log.Debug("[IRC-Bridge]: XML RPC Admin Exit");
|
||||||
|
|
||||||
return response;
|
return response;
|
||||||
|
|
|
@ -42,7 +42,7 @@ using OpenSim.Region.Environment.Scenes;
|
||||||
|
|
||||||
namespace OpenSim.Region.Environment.Modules.Avatar.Chat
|
namespace OpenSim.Region.Environment.Modules.Avatar.Chat
|
||||||
{
|
{
|
||||||
public class XIRCConnector
|
public class IRCConnector
|
||||||
{
|
{
|
||||||
|
|
||||||
#region Global (static) state
|
#region Global (static) state
|
||||||
|
@ -64,13 +64,13 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
|
||||||
|
|
||||||
// List of configured connectors
|
// List of configured connectors
|
||||||
|
|
||||||
private static List<XIRCConnector> m_connectors = new List<XIRCConnector>();
|
private static List<IRCConnector> m_connectors = new List<IRCConnector>();
|
||||||
|
|
||||||
// Watchdog state
|
// Watchdog state
|
||||||
|
|
||||||
private static System.Timers.Timer m_watchdog = null;
|
private static System.Timers.Timer m_watchdog = null;
|
||||||
|
|
||||||
static XIRCConnector()
|
static IRCConnector()
|
||||||
{
|
{
|
||||||
m_log.DebugFormat("[IRC-Connector]: Static initialization started");
|
m_log.DebugFormat("[IRC-Connector]: Static initialization started");
|
||||||
m_watchdog = new System.Timers.Timer(WD_INTERVAL);
|
m_watchdog = new System.Timers.Timer(WD_INTERVAL);
|
||||||
|
@ -168,7 +168,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
|
||||||
|
|
||||||
#region connector instance management
|
#region connector instance management
|
||||||
|
|
||||||
internal XIRCConnector(ChannelState cs)
|
internal IRCConnector(ChannelState cs)
|
||||||
{
|
{
|
||||||
|
|
||||||
// Prepare network interface
|
// Prepare network interface
|
||||||
|
@ -225,7 +225,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
~XIRCConnector()
|
~IRCConnector()
|
||||||
{
|
{
|
||||||
m_watchdog.Stop();
|
m_watchdog.Stop();
|
||||||
Close();
|
Close();
|
||||||
|
@ -797,7 +797,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
|
||||||
_pdk_ = (_pdk_+1)%PING_PERIOD; // cycle the ping trigger
|
_pdk_ = (_pdk_+1)%PING_PERIOD; // cycle the ping trigger
|
||||||
_icc_++; // increment the inter-consecutive-connect-delay counter
|
_icc_++; // increment the inter-consecutive-connect-delay counter
|
||||||
|
|
||||||
foreach (XIRCConnector connector in m_connectors)
|
foreach (IRCConnector connector in m_connectors)
|
||||||
{
|
{
|
||||||
if (connector.Enabled)
|
if (connector.Enabled)
|
||||||
{
|
{
|
Loading…
Reference in New Issue