aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Modules/Avatar/Chat/RegionState.cs
diff options
context:
space:
mode:
authorDr Scofield2008-11-03 16:20:13 +0000
committerDr Scofield2008-11-03 16:20:13 +0000
commitd6d2a38e7634835ced32bba3629de41f4fd3cf9d (patch)
treea542fdff36e10c1598f3999aa0447db2b352836c /OpenSim/Region/Environment/Modules/Avatar/Chat/RegionState.cs
parentThanks diva for a patch that removes an unnecessary dependency on Communicati... (diff)
downloadopensim-SC-d6d2a38e7634835ced32bba3629de41f4fd3cf9d.zip
opensim-SC-d6d2a38e7634835ced32bba3629de41f4fd3cf9d.tar.gz
opensim-SC-d6d2a38e7634835ced32bba3629de41f4fd3cf9d.tar.bz2
opensim-SC-d6d2a38e7634835ced32bba3629de41f4fd3cf9d.tar.xz
merging changes from IRCBridgeModule in to XIRCBridgeModule; swapping
OpenSim.ini config tags in preparation for merge of IRCBridgeModule and XIRCBridgeModule.
Diffstat (limited to 'OpenSim/Region/Environment/Modules/Avatar/Chat/RegionState.cs')
-rw-r--r--OpenSim/Region/Environment/Modules/Avatar/Chat/RegionState.cs47
1 files changed, 16 insertions, 31 deletions
diff --git a/OpenSim/Region/Environment/Modules/Avatar/Chat/RegionState.cs b/OpenSim/Region/Environment/Modules/Avatar/Chat/RegionState.cs
index cf2154f..0251388 100644
--- a/OpenSim/Region/Environment/Modules/Avatar/Chat/RegionState.cs
+++ b/OpenSim/Region/Environment/Modules/Avatar/Chat/RegionState.cs
@@ -28,6 +28,7 @@
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Reflection; 30using System.Reflection;
31using System.Text.RegularExpressions;
31using log4net; 32using log4net;
32using Nini.Config; 33using Nini.Config;
33using OpenSim.Framework; 34using OpenSim.Framework;
@@ -331,27 +332,16 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
331 if (!enabled) 332 if (!enabled)
332 return; 333 return;
333 334
334 // drop all messages coming in on a private channel, 335 // drop messages unless they are on a valid in-world
335 // except if we are relaying private channels, in which 336 // channel as configured in the ChannelState
336 // case we drop if the private channel is not the
337 // configured m_relayChannelOut
338 337
339 if (cs.RelayPrivateChannels) 338 if (!cs.ValidInWorldChannels.Contains(msg.Channel))
340 {
341 if (msg.Channel != 0 && msg.Channel != DEBUG_CHANNEL && msg.Channel != cs.RelayChannelOut)
342 {
343 m_log.DebugFormat("[IRC-Region {0}] dropping message {1} on channel {2}", Region, msg, msg.Channel);
344 return;
345 }
346 }
347 else if (msg.Channel != 0 && msg.Channel != DEBUG_CHANNEL)
348 { 339 {
349 m_log.DebugFormat("[IRC-Region {0}] dropping message {1} on channel {2}", Region, msg, msg.Channel); 340 m_log.DebugFormat("[IRC-Region {0}] dropping message {1} on channel {2}", Region, msg, msg.Channel);
350 return; 341 return;
351 } 342 }
352 343
353 ScenePresence avatar = null; 344 ScenePresence avatar = null;
354
355 string fromName = msg.From; 345 string fromName = msg.From;
356 346
357 if (msg.Sender != null) 347 if (msg.Sender != null)
@@ -368,31 +358,26 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
368 358
369 m_log.DebugFormat("[IRC-Region {0}] heard on channel {1} : {2}", Region, msg.Channel, msg.Message); 359 m_log.DebugFormat("[IRC-Region {0}] heard on channel {1} : {2}", Region, msg.Channel, msg.Message);
370 360
371 if (null != avatar) 361 if (null != avatar && cs.RelayChat && (msg.Channel == 0 || msg.Channel == DEBUG_CHANNEL))
372 { 362 {
373 string txt = msg.Message; 363 string txt = msg.Message;
374 if (txt.StartsWith("/me ")) 364 if (txt.StartsWith("/me "))
375 txt = String.Format("{0} {1}", fromName, msg.Message.Substring(4)); 365 txt = String.Format("{0} {1}", fromName, msg.Message.Substring(4));
376 366
377 cs.irc.PrivMsg(cs.PrivateMessageFormat, fromName, Region, txt); 367 cs.irc.PrivMsg(cs.PrivateMessageFormat, fromName, Region, txt);
368 return;
378 } 369 }
379 else
380 {
381 //Message came from an object
382 char[] splits = { ',' };
383 string[] tokens = msg.Message.Split(splits,3); // This is certainly wrong
384 370
385 if (tokens.Length == 3) 371 if (null == avatar && cs.RelayPrivateChannels && null != cs.AccessPassword &&
372 msg.Channel == cs.RelayChannelOut)
373 {
374 Match m = cs.AccessPasswordRegex.Match(msg.Message);
375 if (null != m)
386 { 376 {
387 if (tokens[0] == cs.AccessPassword) // This is my really simple check 377 m_log.DebugFormat("[IRC] relaying message from {0}: {1}", m.Groups["avatar"].ToString(),
388 { 378 m.Groups["message"].ToString());
389 m_log.DebugFormat("[IRC-Region {0}] message from object {1}, {2}", Region, tokens[0], tokens[1]); 379 cs.irc.PrivMsg(cs.PrivateMessageFormat, m.Groups["avatar"].ToString(),
390 cs.irc.PrivMsg(cs.PrivateMessageFormat, tokens[1], scene.RegionInfo.RegionName, tokens[2]); 380 scene.RegionInfo.RegionName, m.Groups["message"].ToString());
391 }
392 else
393 {
394 m_log.WarnFormat("[IRC-Region {0}] prim security key mismatch <{1}> not <{2}>", Region, tokens[0], cs.AccessPassword);
395 }
396 } 381 }
397 } 382 }
398 } 383 }