IRCBridgeModule: optional agent-alertbox for IRC enabled Regions look in OpenSimDefaults.ini / section [IRC]
http://opensimulator.org/mantis/view.php?id=6470 idea: https://github.com/ssm2017/IrcBridgeAlertuser_profiles
parent
41ae006e9b
commit
9c590e51b6
|
@ -199,7 +199,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat
|
||||||
m_log.DebugFormat("[IRC-Channel-{0}] PrivateMessageFormat : <{1}>", cs.idn, cs.PrivateMessageFormat);
|
m_log.DebugFormat("[IRC-Channel-{0}] PrivateMessageFormat : <{1}>", cs.idn, cs.PrivateMessageFormat);
|
||||||
cs.NoticeMessageFormat = Substitute(rs, config.GetString("noticeformat", cs.NoticeMessageFormat));
|
cs.NoticeMessageFormat = Substitute(rs, config.GetString("noticeformat", cs.NoticeMessageFormat));
|
||||||
m_log.DebugFormat("[IRC-Channel-{0}] NoticeMessageFormat : <{1}>", cs.idn, cs.NoticeMessageFormat);
|
m_log.DebugFormat("[IRC-Channel-{0}] NoticeMessageFormat : <{1}>", cs.idn, cs.NoticeMessageFormat);
|
||||||
cs.ClientReporting = Convert.ToInt32(Substitute(rs, config.GetString("verbosity", cs.ClientReporting?"1":"0"))) > 0;
|
cs.ClientReporting = Convert.ToInt32(Substitute(rs, config.GetString("verbosity", cs.ClientReporting ? "1" : "0"))) > 0;
|
||||||
m_log.DebugFormat("[IRC-Channel-{0}] ClientReporting : <{1}>", cs.idn, cs.ClientReporting);
|
m_log.DebugFormat("[IRC-Channel-{0}] ClientReporting : <{1}>", cs.idn, cs.ClientReporting);
|
||||||
cs.ClientReporting = Convert.ToBoolean(Substitute(rs, config.GetString("report_clients", Convert.ToString(cs.ClientReporting))));
|
cs.ClientReporting = Convert.ToBoolean(Substitute(rs, config.GetString("report_clients", Convert.ToString(cs.ClientReporting))));
|
||||||
m_log.DebugFormat("[IRC-Channel-{0}] ClientReporting : <{1}>", cs.idn, cs.ClientReporting);
|
m_log.DebugFormat("[IRC-Channel-{0}] ClientReporting : <{1}>", cs.idn, cs.ClientReporting);
|
||||||
|
@ -473,27 +473,27 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat
|
||||||
{
|
{
|
||||||
|
|
||||||
string vvar = arg.Match(result).ToString();
|
string vvar = arg.Match(result).ToString();
|
||||||
string var = vvar.Substring(1,vvar.Length-2).Trim();
|
string var = vvar.Substring(1, vvar.Length - 2).Trim();
|
||||||
|
|
||||||
switch (var.ToLower())
|
switch (var.ToLower())
|
||||||
{
|
{
|
||||||
case "%region" :
|
case "%region":
|
||||||
result = result.Replace(vvar, rs.Region);
|
result = result.Replace(vvar, rs.Region);
|
||||||
break;
|
break;
|
||||||
case "%host" :
|
case "%host":
|
||||||
result = result.Replace(vvar, rs.Host);
|
result = result.Replace(vvar, rs.Host);
|
||||||
break;
|
break;
|
||||||
case "%locx" :
|
case "%locx":
|
||||||
result = result.Replace(vvar, rs.LocX);
|
result = result.Replace(vvar, rs.LocX);
|
||||||
break;
|
break;
|
||||||
case "%locy" :
|
case "%locy":
|
||||||
result = result.Replace(vvar, rs.LocY);
|
result = result.Replace(vvar, rs.LocY);
|
||||||
break;
|
break;
|
||||||
case "%k" :
|
case "%k":
|
||||||
result = result.Replace(vvar, rs.IDK);
|
result = result.Replace(vvar, rs.IDK);
|
||||||
break;
|
break;
|
||||||
default :
|
default:
|
||||||
result = result.Replace(vvar, rs.config.GetString(var,var));
|
result = result.Replace(vvar, rs.config.GetString(var, var));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// m_log.DebugFormat("[IRC-Channel] Parse[2]: {0}", result);
|
// m_log.DebugFormat("[IRC-Channel] Parse[2]: {0}", result);
|
||||||
|
|
|
@ -46,7 +46,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat
|
||||||
{
|
{
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
internal static bool m_pluginEnabled = false;
|
internal static bool Enabled = false;
|
||||||
internal static IConfig m_config = null;
|
internal static IConfig m_config = null;
|
||||||
|
|
||||||
internal static List<ChannelState> m_channels = new List<ChannelState>();
|
internal static List<ChannelState> m_channels = new List<ChannelState>();
|
||||||
|
@ -72,13 +72,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat
|
||||||
m_config = config.Configs["IRC"];
|
m_config = config.Configs["IRC"];
|
||||||
if (m_config == null)
|
if (m_config == null)
|
||||||
{
|
{
|
||||||
// m_log.InfoFormat("[IRC-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("[IRC-Bridge] module disabled in configuration");
|
// m_log.InfoFormat("[IRC-Bridge] module disabled in configuration");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,19 +87,22 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat
|
||||||
m_password = config.Configs["RemoteAdmin"].GetString("access_password", m_password);
|
m_password = config.Configs["RemoteAdmin"].GetString("access_password", m_password);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_pluginEnabled = true;
|
Enabled = true;
|
||||||
m_log.InfoFormat("[IRC-Bridge]: Module enabled");
|
|
||||||
|
m_log.InfoFormat("[IRC-Bridge]: Module is enabled");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddRegion(Scene scene)
|
public void AddRegion(Scene scene)
|
||||||
{
|
{
|
||||||
if (m_pluginEnabled)
|
if (Enabled)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
m_log.InfoFormat("[IRC-Bridge] Connecting region {0}", scene.RegionInfo.RegionName);
|
m_log.InfoFormat("[IRC-Bridge] Connecting region {0}", scene.RegionInfo.RegionName);
|
||||||
|
|
||||||
if (!String.IsNullOrEmpty(m_password))
|
if (!String.IsNullOrEmpty(m_password))
|
||||||
MainServer.Instance.AddXmlRPCHandler("irc_admin", XmlRpcAdminMethod, false);
|
MainServer.Instance.AddXmlRPCHandler("irc_admin", XmlRpcAdminMethod, false);
|
||||||
|
|
||||||
m_region = new RegionState(scene, m_config);
|
m_region = new RegionState(scene, m_config);
|
||||||
lock (m_regions) m_regions.Add(m_region);
|
lock (m_regions) m_regions.Add(m_region);
|
||||||
m_region.Open();
|
m_region.Open();
|
||||||
|
@ -123,7 +126,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat
|
||||||
|
|
||||||
public void RemoveRegion(Scene scene)
|
public void RemoveRegion(Scene scene)
|
||||||
{
|
{
|
||||||
if (!m_pluginEnabled)
|
if (!Enabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (m_region == null)
|
if (m_region == null)
|
||||||
|
|
|
@ -295,15 +295,19 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat
|
||||||
m_nick, m_ircChannel, m_server));
|
m_nick, m_ircChannel, m_server));
|
||||||
m_writer.Flush();
|
m_writer.Flush();
|
||||||
}
|
}
|
||||||
catch (Exception) {}
|
catch (Exception) { }
|
||||||
|
|
||||||
|
|
||||||
m_connected = false;
|
m_connected = false;
|
||||||
|
|
||||||
try { m_writer.Close(); } catch (Exception) {}
|
try { m_writer.Close(); }
|
||||||
try { m_reader.Close(); } catch (Exception) {}
|
catch (Exception) { }
|
||||||
try { m_stream.Close(); } catch (Exception) {}
|
try { m_reader.Close(); }
|
||||||
try { m_tcp.Close(); } catch (Exception) {}
|
catch (Exception) { }
|
||||||
|
try { m_stream.Close(); }
|
||||||
|
catch (Exception) { }
|
||||||
|
try { m_tcp.Close(); }
|
||||||
|
catch (Exception) { }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -418,9 +422,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat
|
||||||
// the socket and it will disappear of its own accord, once this
|
// the socket and it will disappear of its own accord, once this
|
||||||
// processing is completed.
|
// processing is completed.
|
||||||
|
|
||||||
try { m_writer.Close(); } catch (Exception) {}
|
try { m_writer.Close(); }
|
||||||
try { m_reader.Close(); } catch (Exception) {}
|
catch (Exception) { }
|
||||||
try { m_tcp.Close(); } catch (Exception) {}
|
try { m_reader.Close(); }
|
||||||
|
catch (Exception) { }
|
||||||
|
try { m_tcp.Close(); }
|
||||||
|
catch (Exception) { }
|
||||||
|
|
||||||
m_connected = false;
|
m_connected = false;
|
||||||
m_pending = false;
|
m_pending = false;
|
||||||
|
@ -627,12 +634,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat
|
||||||
// ":" indicates that the remainder of the
|
// ":" indicates that the remainder of the
|
||||||
// line is a single parameter value.
|
// line is a single parameter value.
|
||||||
|
|
||||||
commArgs = command.Split(CS_SPACE,2);
|
commArgs = command.Split(CS_SPACE, 2);
|
||||||
|
|
||||||
if (commArgs[0].StartsWith(":"))
|
if (commArgs[0].StartsWith(":"))
|
||||||
{
|
{
|
||||||
pfx = commArgs[0].Substring(1);
|
pfx = commArgs[0].Substring(1);
|
||||||
commArgs = commArgs[1].Split(CS_SPACE,2);
|
commArgs = commArgs[1].Split(CS_SPACE, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd = commArgs[0];
|
cmd = commArgs[0];
|
||||||
|
@ -646,11 +653,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat
|
||||||
// Messages 001-004 are always sent
|
// Messages 001-004 are always sent
|
||||||
// following signon.
|
// following signon.
|
||||||
|
|
||||||
case "001" : // Welcome ...
|
case "001": // Welcome ...
|
||||||
case "002" : // Server information
|
case "002": // Server information
|
||||||
case "003" : // Welcome ...
|
case "003": // Welcome ...
|
||||||
break;
|
break;
|
||||||
case "004" : // Server information
|
case "004": // Server information
|
||||||
m_log.DebugFormat("[IRC-Connector-{0}] [{1}] parms = <{2}>", idn, cmd, parms);
|
m_log.DebugFormat("[IRC-Connector-{0}] [{1}] parms = <{2}>", idn, cmd, parms);
|
||||||
commArgs = parms.Split(CS_SPACE);
|
commArgs = parms.Split(CS_SPACE);
|
||||||
c_server = commArgs[1];
|
c_server = commArgs[1];
|
||||||
|
@ -659,31 +666,31 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat
|
||||||
usermod = commArgs[3];
|
usermod = commArgs[3];
|
||||||
chanmod = commArgs[4];
|
chanmod = commArgs[4];
|
||||||
break;
|
break;
|
||||||
case "005" : // Server information
|
case "005": // Server information
|
||||||
break;
|
break;
|
||||||
case "042" :
|
case "042":
|
||||||
case "250" :
|
case "250":
|
||||||
case "251" :
|
case "251":
|
||||||
case "252" :
|
case "252":
|
||||||
case "254" :
|
case "254":
|
||||||
case "255" :
|
case "255":
|
||||||
case "265" :
|
case "265":
|
||||||
case "266" :
|
case "266":
|
||||||
case "332" : // Subject
|
case "332": // Subject
|
||||||
case "333" : // Subject owner (?)
|
case "333": // Subject owner (?)
|
||||||
case "353" : // Name list
|
case "353": // Name list
|
||||||
case "366" : // End-of-Name list marker
|
case "366": // End-of-Name list marker
|
||||||
case "372" : // MOTD body
|
case "372": // MOTD body
|
||||||
case "375" : // MOTD start
|
case "375": // MOTD start
|
||||||
// m_log.InfoFormat("[IRC-Connector-{0}] [{1}] {2}", idn, cmd, parms.Split(CS_SPACE,2)[1]);
|
// m_log.InfoFormat("[IRC-Connector-{0}] [{1}] {2}", idn, cmd, parms.Split(CS_SPACE,2)[1]);
|
||||||
break;
|
break;
|
||||||
case "376" : // MOTD end
|
case "376": // MOTD end
|
||||||
// m_log.InfoFormat("[IRC-Connector-{0}] [{1}] {2}", idn, cmd, parms.Split(CS_SPACE,2)[1]);
|
// m_log.InfoFormat("[IRC-Connector-{0}] [{1}] {2}", idn, cmd, parms.Split(CS_SPACE,2)[1]);
|
||||||
motd = true;
|
motd = true;
|
||||||
break;
|
break;
|
||||||
case "451" : // Not registered
|
case "451": // Not registered
|
||||||
break;
|
break;
|
||||||
case "433" : // Nickname in use
|
case "433": // Nickname in use
|
||||||
// Gen a new name
|
// Gen a new name
|
||||||
m_nick = m_baseNick + Util.RandomClass.Next(1, 99);
|
m_nick = m_baseNick + Util.RandomClass.Next(1, 99);
|
||||||
m_log.ErrorFormat("[IRC-Connector-{0}]: [{1}] IRC SERVER reports NicknameInUse, trying {2}", idn, cmd, m_nick);
|
m_log.ErrorFormat("[IRC-Connector-{0}]: [{1}] IRC SERVER reports NicknameInUse, trying {2}", idn, cmd, m_nick);
|
||||||
|
@ -695,29 +702,29 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat
|
||||||
m_writer.WriteLine(String.Format("JOIN {0}", m_ircChannel));
|
m_writer.WriteLine(String.Format("JOIN {0}", m_ircChannel));
|
||||||
m_writer.Flush();
|
m_writer.Flush();
|
||||||
break;
|
break;
|
||||||
case "479" : // Bad channel name, etc. This will never work, so disable the connection
|
case "479": // Bad channel name, etc. This will never work, so disable the connection
|
||||||
m_log.ErrorFormat("[IRC-Connector-{0}] [{1}] {2}", idn, cmd, parms.Split(CS_SPACE,2)[1]);
|
m_log.ErrorFormat("[IRC-Connector-{0}] [{1}] {2}", idn, cmd, parms.Split(CS_SPACE, 2)[1]);
|
||||||
m_log.ErrorFormat("[IRC-Connector-{0}] [{1}] Connector disabled", idn, cmd);
|
m_log.ErrorFormat("[IRC-Connector-{0}] [{1}] Connector disabled", idn, cmd);
|
||||||
m_enabled = false;
|
m_enabled = false;
|
||||||
m_connected = false;
|
m_connected = false;
|
||||||
m_pending = false;
|
m_pending = false;
|
||||||
break;
|
break;
|
||||||
case "NOTICE" :
|
case "NOTICE":
|
||||||
// m_log.WarnFormat("[IRC-Connector-{0}] [{1}] {2}", idn, cmd, parms.Split(CS_SPACE,2)[1]);
|
// m_log.WarnFormat("[IRC-Connector-{0}] [{1}] {2}", idn, cmd, parms.Split(CS_SPACE,2)[1]);
|
||||||
break;
|
break;
|
||||||
case "ERROR" :
|
case "ERROR":
|
||||||
m_log.ErrorFormat("[IRC-Connector-{0}] [{1}] {2}", idn, cmd, parms.Split(CS_SPACE,2)[1]);
|
m_log.ErrorFormat("[IRC-Connector-{0}] [{1}] {2}", idn, cmd, parms.Split(CS_SPACE, 2)[1]);
|
||||||
if (parms.Contains("reconnect too fast"))
|
if (parms.Contains("reconnect too fast"))
|
||||||
ICCD_PERIOD++;
|
ICCD_PERIOD++;
|
||||||
m_pending = false;
|
m_pending = false;
|
||||||
Reconnect();
|
Reconnect();
|
||||||
break;
|
break;
|
||||||
case "PING" :
|
case "PING":
|
||||||
m_log.DebugFormat("[IRC-Connector-{0}] [{1}] parms = <{2}>", idn, cmd, parms);
|
m_log.DebugFormat("[IRC-Connector-{0}] [{1}] parms = <{2}>", idn, cmd, parms);
|
||||||
m_writer.WriteLine(String.Format("PONG {0}", parms));
|
m_writer.WriteLine(String.Format("PONG {0}", parms));
|
||||||
m_writer.Flush();
|
m_writer.Flush();
|
||||||
break;
|
break;
|
||||||
case "PONG" :
|
case "PONG":
|
||||||
break;
|
break;
|
||||||
case "JOIN":
|
case "JOIN":
|
||||||
if (m_pending)
|
if (m_pending)
|
||||||
|
@ -748,7 +755,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat
|
||||||
m_log.DebugFormat("[IRC-Connector-{0}] [{1}] parms = <{2}>", idn, cmd, parms);
|
m_log.DebugFormat("[IRC-Connector-{0}] [{1}] parms = <{2}>", idn, cmd, parms);
|
||||||
eventIrcQuit(pfx, cmd, parms);
|
eventIrcQuit(pfx, cmd, parms);
|
||||||
break;
|
break;
|
||||||
default :
|
default:
|
||||||
m_log.DebugFormat("[IRC-Connector-{0}] Command '{1}' ignored, parms = {2}", idn, cmd, parms);
|
m_log.DebugFormat("[IRC-Connector-{0}] Command '{1}' ignored, parms = {2}", idn, cmd, parms);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -759,7 +766,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat
|
||||||
|
|
||||||
public void eventIrcJoin(string prefix, string command, string parms)
|
public void eventIrcJoin(string prefix, string command, string parms)
|
||||||
{
|
{
|
||||||
string[] args = parms.Split(CS_SPACE,2);
|
string[] args = parms.Split(CS_SPACE, 2);
|
||||||
string IrcUser = prefix.Split('!')[0];
|
string IrcUser = prefix.Split('!')[0];
|
||||||
string IrcChannel = args[0];
|
string IrcChannel = args[0];
|
||||||
|
|
||||||
|
@ -772,7 +779,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat
|
||||||
|
|
||||||
public void eventIrcPart(string prefix, string command, string parms)
|
public void eventIrcPart(string prefix, string command, string parms)
|
||||||
{
|
{
|
||||||
string[] args = parms.Split(CS_SPACE,2);
|
string[] args = parms.Split(CS_SPACE, 2);
|
||||||
string IrcUser = prefix.Split('!')[0];
|
string IrcUser = prefix.Split('!')[0];
|
||||||
string IrcChannel = args[0];
|
string IrcChannel = args[0];
|
||||||
|
|
||||||
|
@ -782,7 +789,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat
|
||||||
|
|
||||||
public void eventIrcMode(string prefix, string command, string parms)
|
public void eventIrcMode(string prefix, string command, string parms)
|
||||||
{
|
{
|
||||||
string[] args = parms.Split(CS_SPACE,2);
|
string[] args = parms.Split(CS_SPACE, 2);
|
||||||
string UserMode = args[1];
|
string UserMode = args[1];
|
||||||
|
|
||||||
m_log.DebugFormat("[IRC-Connector-{0}] Event: IRCMode {1}:{2}", idn, m_server, m_ircChannel);
|
m_log.DebugFormat("[IRC-Connector-{0}] Event: IRCMode {1}:{2}", idn, m_server, m_ircChannel);
|
||||||
|
@ -794,7 +801,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat
|
||||||
|
|
||||||
public void eventIrcNickChange(string prefix, string command, string parms)
|
public void eventIrcNickChange(string prefix, string command, string parms)
|
||||||
{
|
{
|
||||||
string[] args = parms.Split(CS_SPACE,2);
|
string[] args = parms.Split(CS_SPACE, 2);
|
||||||
string UserOldNick = prefix.Split('!')[0];
|
string UserOldNick = prefix.Split('!')[0];
|
||||||
string UserNewNick = args[0].Remove(0, 1);
|
string UserNewNick = args[0].Remove(0, 1);
|
||||||
|
|
||||||
|
@ -804,7 +811,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat
|
||||||
|
|
||||||
public void eventIrcKick(string prefix, string command, string parms)
|
public void eventIrcKick(string prefix, string command, string parms)
|
||||||
{
|
{
|
||||||
string[] args = parms.Split(CS_SPACE,3);
|
string[] args = parms.Split(CS_SPACE, 3);
|
||||||
string UserKicker = prefix.Split('!')[0];
|
string UserKicker = prefix.Split('!')[0];
|
||||||
string IrcChannel = args[0];
|
string IrcChannel = args[0];
|
||||||
string UserKicked = args[1];
|
string UserKicked = args[1];
|
||||||
|
@ -842,7 +849,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat
|
||||||
|
|
||||||
// m_log.InfoFormat("[IRC-Watchdog] Status scan, pdk = {0}, icc = {1}", _pdk_, _icc_);
|
// m_log.InfoFormat("[IRC-Watchdog] Status scan, pdk = {0}, icc = {1}", _pdk_, _icc_);
|
||||||
|
|
||||||
_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
|
||||||
|
|
||||||
lock (m_connectors)
|
lock (m_connectors)
|
||||||
|
|
|
@ -41,7 +41,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat
|
||||||
|
|
||||||
internal class RegionState
|
internal class RegionState
|
||||||
{
|
{
|
||||||
|
|
||||||
private static readonly ILog m_log =
|
private static readonly ILog m_log =
|
||||||
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
|
@ -66,6 +65,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat
|
||||||
internal IConfig config = null; // configuration file reference
|
internal IConfig config = null; // configuration file reference
|
||||||
internal bool enabled = true;
|
internal bool enabled = true;
|
||||||
|
|
||||||
|
//AgentAlert
|
||||||
|
internal bool showAlert = false;
|
||||||
|
internal string alertMessage = String.Empty;
|
||||||
|
internal IDialogModule dialogModule = null;
|
||||||
|
|
||||||
// This list is used to keep track of who is here, and by
|
// This list is used to keep track of who is here, and by
|
||||||
// implication, who is not.
|
// implication, who is not.
|
||||||
|
|
||||||
|
@ -75,7 +79,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat
|
||||||
|
|
||||||
public RegionState(Scene p_scene, IConfig p_config)
|
public RegionState(Scene p_scene, IConfig p_config)
|
||||||
{
|
{
|
||||||
|
|
||||||
scene = p_scene;
|
scene = p_scene;
|
||||||
config = p_config;
|
config = p_config;
|
||||||
|
|
||||||
|
@ -85,6 +88,25 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat
|
||||||
LocY = Convert.ToString(scene.RegionInfo.RegionLocY);
|
LocY = Convert.ToString(scene.RegionInfo.RegionLocY);
|
||||||
IDK = Convert.ToString(_idk_++);
|
IDK = Convert.ToString(_idk_++);
|
||||||
|
|
||||||
|
showAlert = config.GetBoolean("alert_show", false);
|
||||||
|
string alertServerInfo = String.Empty;
|
||||||
|
|
||||||
|
if (showAlert)
|
||||||
|
{
|
||||||
|
bool showAlertServerInfo = config.GetBoolean("alert_show_serverinfo", true);
|
||||||
|
|
||||||
|
if (showAlertServerInfo)
|
||||||
|
alertServerInfo = String.Format("\nServer: {0}\nPort: {1}\nChannel: {2}\n\n",
|
||||||
|
config.GetString("server", ""), config.GetString("port", ""), config.GetString("channel", ""));
|
||||||
|
|
||||||
|
string alertPreMessage = config.GetString("alert_msg_pre", "This region is linked to Irc.");
|
||||||
|
string alertPostMessage = config.GetString("alert_msg_post", "Everything you say in public chat can be listened.");
|
||||||
|
|
||||||
|
alertMessage = String.Format("{0}\n{1}{2}", alertPreMessage, alertServerInfo, alertPostMessage);
|
||||||
|
|
||||||
|
dialogModule = scene.RequestModuleInterface<IDialogModule>();
|
||||||
|
}
|
||||||
|
|
||||||
// OpenChannel conditionally establishes a connection to the
|
// OpenChannel conditionally establishes a connection to the
|
||||||
// IRC server. The request will either succeed, or it will
|
// IRC server. The request will either succeed, or it will
|
||||||
// throw an exception.
|
// throw an exception.
|
||||||
|
@ -195,7 +217,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat
|
||||||
|
|
||||||
private void OnMakeRootAgent(ScenePresence presence)
|
private void OnMakeRootAgent(ScenePresence presence)
|
||||||
{
|
{
|
||||||
|
|
||||||
IClientAPI client = presence.ControllingClient;
|
IClientAPI client = presence.ControllingClient;
|
||||||
|
|
||||||
try
|
try
|
||||||
|
@ -216,17 +237,18 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (dialogModule != null && showAlert)
|
||||||
|
dialogModule.SendAlertToUser(client, alertMessage, true);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
m_log.ErrorFormat("[IRC-Region {0}]: MakeRootAgent exception: {1}", Region, ex.Message);
|
m_log.ErrorFormat("[IRC-Region {0}]: MakeRootAgent exception: {1}", Region, ex.Message);
|
||||||
m_log.Debug(ex);
|
m_log.Debug(ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// This handler detects chat events int he virtual world.
|
// This handler detects chat events int he virtual world.
|
||||||
|
|
||||||
public void OnSimChat(Object sender, OSChatMessage msg)
|
public void OnSimChat(Object sender, OSChatMessage msg)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
@ -1109,6 +1109,17 @@
|
||||||
|
|
||||||
;exclude_list=User 1,User 2,User 3
|
;exclude_list=User 1,User 2,User 3
|
||||||
|
|
||||||
|
;;Shows modal alertbox for entering agent on IRC enabled regions
|
||||||
|
;;
|
||||||
|
;; Enable Alert, default = false
|
||||||
|
;alert_show = false
|
||||||
|
;;
|
||||||
|
;; Show IRC serverinfo, default = true
|
||||||
|
;alert_show_serverinfo = true
|
||||||
|
;;
|
||||||
|
;alert_msg_pre = "This region is linked to Irc."
|
||||||
|
;alert_msg_post = "Everything you say in public chat can be listened."
|
||||||
|
|
||||||
|
|
||||||
; The following settings control the progression of daytime
|
; The following settings control the progression of daytime
|
||||||
; in the Sim. The defaults are the same as the commented out settings
|
; in the Sim. The defaults are the same as the commented out settings
|
||||||
|
|
Loading…
Reference in New Issue