diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs
index 8737c227fe..d2ee770224 100644
--- a/OpenSim/Framework/IClientAPI.cs
+++ b/OpenSim/Framework/IClientAPI.cs
@@ -363,7 +363,7 @@ namespace OpenSim.Framework
// [Obsolete("LLClientView Specific - Replace with more bare-bones arguments.")]
event ImprovedInstantMessage OnInstantMessage;
// [Obsolete("LLClientView Specific - Replace with more bare-bones arguments. Rename OnChat.")]
- event ChatMessage OnChatFromViewer;
+ event ChatMessage OnChatFromClient;
// [Obsolete("LLClientView Specific - Replace with more bare-bones arguments.")]
event TextureRequest OnRequestTexture;
// [Obsolete("LLClientView Specific - Remove bitbuckets. Adam, can you be more specific here.. as I don't see any bit buckets.")]
diff --git a/OpenSim/Framework/OSChatMessage.cs b/OpenSim/Framework/OSChatMessage.cs
index fbeb7badf0..15701f0741 100644
--- a/OpenSim/Framework/OSChatMessage.cs
+++ b/OpenSim/Framework/OSChatMessage.cs
@@ -140,6 +140,11 @@ namespace OpenSim.Framework
set { m_scene = value; }
}
+ public override string ToString()
+ {
+ return m_message;
+ }
+
#endregion
}
}
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index af760ae786..199954efe4 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -124,8 +124,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
private GenericMessage handlerGenericMessage = null;
private RequestAvatarProperties handlerRequestAvatarProperties = null; //OnRequestAvatarProperties;
private UpdateAvatarProperties handlerUpdateAvatarProperties = null; // OnUpdateAvatarProperties;
- private ChatMessage handlerChatFromViewer = null; //OnChatFromViewer;
- private ChatMessage handlerChatFromViewer2 = null; //OnChatFromViewer;
+ private ChatMessage handlerChatFromClient = null; //OnChatFromClient;
+ private ChatMessage handlerChatFromClient2 = null; //OnChatFromClient;
private ImprovedInstantMessage handlerInstantMessage = null; //OnInstantMessage;
private FriendActionDelegate handlerApproveFriendRequest = null; //OnApproveFriendRequest;
private FriendshipTermination handlerTerminateFriendship = null; //OnTerminateFriendship;
@@ -393,7 +393,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
///
///
public LLClientView(EndPoint remoteEP, IScene scene, AssetCache assetCache, LLPacketServer packServer,
- AgentCircuitManager authenSessions, UUID agentId, UUID sessionId, uint circuitCode, EndPoint proxyEP)
+ AgentCircuitManager authenSessions, UUID agentId, UUID sessionId, uint circuitCode, EndPoint proxyEP)
{
m_moneyBalance = 1000;
@@ -833,7 +833,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public event Action OnConnectionClosed;
public event ViewerEffectEventHandler OnViewerEffect;
public event ImprovedInstantMessage OnInstantMessage;
- public event ChatMessage OnChatFromViewer;
+ public event ChatMessage OnChatFromClient;
public event TextureRequest OnRequestTexture;
public event RezObject OnRezObject;
public event GenericCall4 OnDeRezObject;
@@ -4008,7 +4008,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
int channel = inchatpack.ChatData.Channel;
- if (OnChatFromViewer != null)
+ if (OnChatFromClient != null)
{
OSChatMessage args = new OSChatMessage();
args.Channel = channel;
@@ -4020,9 +4020,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
args.Scene = Scene;
args.Sender = this;
- handlerChatFromViewer = OnChatFromViewer;
- if (handlerChatFromViewer != null)
- handlerChatFromViewer(this, args);
+ handlerChatFromClient = OnChatFromClient;
+ if (handlerChatFromClient != null)
+ handlerChatFromClient(this, args);
}
break;
case PacketType.AvatarPropertiesUpdate:
@@ -4047,7 +4047,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
ScriptDialogReplyPacket rdialog = (ScriptDialogReplyPacket)Pack;
int ch = rdialog.Data.ChatChannel;
byte[] msg = rdialog.Data.ButtonLabel;
- if (OnChatFromViewer != null)
+ if (OnChatFromClient != null)
{
OSChatMessage args = new OSChatMessage();
args.Channel = ch;
@@ -4057,9 +4057,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
args.Position = new Vector3();
args.Scene = Scene;
args.Sender = this;
- handlerChatFromViewer2 = OnChatFromViewer;
- if (handlerChatFromViewer2 != null)
- handlerChatFromViewer2(this, args);
+ handlerChatFromClient2 = OnChatFromClient;
+ if (handlerChatFromClient2 != null)
+ handlerChatFromClient2(this, args);
}
break;
diff --git a/OpenSim/Region/Environment/Modules/Avatar/Chat/ChatModule.cs b/OpenSim/Region/Environment/Modules/Avatar/Chat/ChatModule.cs
index 606ce7efa3..34a604e49b 100644
--- a/OpenSim/Region/Environment/Modules/Avatar/Chat/ChatModule.cs
+++ b/OpenSim/Region/Environment/Modules/Avatar/Chat/ChatModule.cs
@@ -64,26 +64,25 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
{
m_scenes.Add(scene);
scene.EventManager.OnNewClient += OnNewClient;
- scene.EventManager.OnChatFromWorld += OnSimChat;
- scene.EventManager.OnChatBroadcast += OnSimBroadcast;
+ scene.EventManager.OnChatFromWorld += OnChatFromWorld;
+ scene.EventManager.OnChatBroadcast += OnChatBroadcast;
}
-
- // wrap this in a try block so that defaults will work if
- // the config file doesn't specify otherwise.
- try
- {
- m_whisperdistance = config.Configs["Chat"].GetInt("whisper_distance", m_whisperdistance);
- m_saydistance = config.Configs["Chat"].GetInt("say_distance", m_saydistance);
- m_shoutdistance = config.Configs["Chat"].GetInt("shout_distance", m_shoutdistance);
- }
- catch (Exception)
- {
- }
- m_log.InfoFormat("[CHAT] initialized for {0} w:{1} s:{2} S:{3}", scene.RegionInfo.RegionName,
- m_whisperdistance, m_saydistance, m_shoutdistance);
}
- }
+ // wrap this in a try block so that defaults will work if
+ // the config file doesn't specify otherwise.
+ try
+ {
+ m_whisperdistance = config.Configs["Chat"].GetInt("whisper_distance", m_whisperdistance);
+ m_saydistance = config.Configs["Chat"].GetInt("say_distance", m_saydistance);
+ m_shoutdistance = config.Configs["Chat"].GetInt("shout_distance", m_shoutdistance);
+ }
+ catch (Exception)
+ {
+ }
+ m_log.InfoFormat("[CHAT] initialized for {0} w:{1} s:{2} S:{3}", scene.RegionInfo.RegionName,
+ m_whisperdistance, m_saydistance, m_shoutdistance);
+ }
public void PostInitialise()
{
}
@@ -104,8 +103,89 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
#endregion
- #region ISimChat Members
- public void OnSimBroadcast(Object sender, OSChatMessage c)
+
+ public void OnNewClient(IClientAPI client)
+ {
+ try
+ {
+ client.OnChatFromClient += OnChatFromClient;
+ }
+ catch (Exception ex)
+ {
+ m_log.Error("[CHAT]: NewClient exception trap:" + ex.ToString());
+ }
+ }
+
+ public virtual void OnChatFromClient(Object sender, OSChatMessage e)
+ {
+ // redistribute to interested subscribers
+ Scene scene = (Scene)e.Scene;
+ scene.EventManager.TriggerOnChatFromClient(sender, e);
+
+ // early return if not on public or debug channel
+ if (e.Channel != 0 && e.Channel != DEBUG_CHANNEL) return;
+
+ // sanity check:
+ if (e.Sender == null)
+ {
+ m_log.ErrorFormat("[CHAT] OnChatFromClient from {0} has empty Sender field!", sender);
+ return;
+ }
+
+ string message = e.Message;
+ if (e.Channel == DEBUG_CHANNEL) e.Type = ChatTypeEnum.DebugChannel;
+
+ ScenePresence avatar = scene.GetScenePresence(e.Sender.AgentId);
+ Vector3 fromPos = avatar.AbsolutePosition;
+ Vector3 regionPos = new Vector3(scene.RegionInfo.RegionLocX * Constants.RegionSize,
+ scene.RegionInfo.RegionLocY * Constants.RegionSize, 0);
+ string fromName = avatar.Firstname + " " + avatar.Lastname;
+ UUID fromID = e.Sender.AgentId;
+
+ DeliverChatToAvatars(fromPos, regionPos, fromID, fromName, e.Type, ChatSourceType.Agent, message);
+ }
+
+ public void OnChatFromWorld(Object sender, OSChatMessage e)
+ {
+ Scene scene = (Scene) e.Scene;
+
+ // early return if not on public or debug channel
+ if (e.Channel != 0 && e.Channel != DEBUG_CHANNEL) return;
+
+ // Filled in since it's easier than rewriting right now.
+ Vector3 fromPos = e.Position;
+ Vector3 regionPos = new Vector3(scene.RegionInfo.RegionLocX * Constants.RegionSize,
+ scene.RegionInfo.RegionLocY * Constants.RegionSize, 0);
+
+ string fromName = e.From;
+ string message = e.Message;
+ UUID fromID = e.SenderUUID;
+
+ if (e.Channel == DEBUG_CHANNEL)
+ e.Type = ChatTypeEnum.DebugChannel;
+
+ DeliverChatToAvatars(fromPos, regionPos, fromID, fromName, e.Type, ChatSourceType.Object, message);
+ }
+
+ protected void DeliverChatToAvatars(Vector3 pos, Vector3 regionPos, UUID uuid, string name,
+ ChatTypeEnum chatType, ChatSourceType sourceType, string message)
+ {
+ // iterate over message
+ if (message.Length >= 1000) // libomv limit
+ message = message.Substring(0, 1000);
+
+ foreach (Scene s in m_scenes)
+ {
+ s.ForEachScenePresence(delegate(ScenePresence presence)
+ {
+ TrySendChatMessage(presence, pos, regionPos, uuid, name,
+ chatType, message, sourceType);
+ });
+ }
+ }
+
+
+ public void OnChatBroadcast(Object sender, OSChatMessage c)
{
// We only want to relay stuff on channel 0 and on the debug channel
if (c.Channel != 0 && c.Channel != DEBUG_CHANNEL) return;
@@ -153,83 +233,6 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
});
}
- public void OnSimChat(Object sender, OSChatMessage e)
- {
- // early return if not on public or debug channel
- if (e.Channel != 0 && e.Channel != DEBUG_CHANNEL) return;
-
- ScenePresence avatar = null;
- Scene scene = (Scene) e.Scene;
-
- //TODO: Remove the need for this check
- if (scene == null)
- scene = m_scenes[0];
-
- // Filled in since it's easier than rewriting right now.
- Vector3 fromPos = e.Position;
- Vector3 regionPos = new Vector3(scene.RegionInfo.RegionLocX * Constants.RegionSize,
- scene.RegionInfo.RegionLocY * Constants.RegionSize, 0);
-
- string fromName = e.From;
- string message = e.Message;
- UUID fromID = e.SenderUUID;
-
- if (message.Length >= 1000) // libomv limit
- message = message.Substring(0, 1000);
-
- if (e.Sender != null)
- {
- avatar = scene.GetScenePresence(e.Sender.AgentId);
- }
-
- if (avatar != null)
- {
- fromPos = avatar.AbsolutePosition;
- regionPos = new Vector3(scene.RegionInfo.RegionLocX * Constants.RegionSize,
- scene.RegionInfo.RegionLocY * Constants.RegionSize, 0);
- fromName = avatar.Firstname + " " + avatar.Lastname;
- fromID = e.Sender.AgentId;
- }
-
- if (e.Channel == DEBUG_CHANNEL)
- e.Type = ChatTypeEnum.DebugChannel;
-
- // chat works by redistributing every incoming chat
- // message to each avatar in the scene
- foreach (Scene s in m_scenes)
- {
- s.ForEachScenePresence(
- delegate(ScenePresence presence)
- {
- if (e.Channel == DEBUG_CHANNEL)
- {
- TrySendChatMessage(presence, fromPos, regionPos,
- fromID, fromName, e.Type,
- message, ChatSourceType.Object);
- }
- else
- {
- TrySendChatMessage(presence, fromPos, regionPos,
- fromID, fromName, e.Type,
- message, ChatSourceType.Agent);
- }
- });
- }
- }
-
- #endregion
-
- public void OnNewClient(IClientAPI client)
- {
- try
- {
- client.OnChatFromViewer += OnSimChat;
- }
- catch (Exception ex)
- {
- m_log.Error("[CHAT]: NewClient exception trap:" + ex.ToString());
- }
- }
private void TrySendChatMessage(ScenePresence presence, Vector3 fromPos, Vector3 regionPos,
UUID fromAgentID, string fromName, ChatTypeEnum type,
diff --git a/OpenSim/Region/Environment/Modules/Avatar/Chat/IRCBridgeModule.cs b/OpenSim/Region/Environment/Modules/Avatar/Chat/IRCBridgeModule.cs
index eba65a94c6..5840cb2336 100644
--- a/OpenSim/Region/Environment/Modules/Avatar/Chat/IRCBridgeModule.cs
+++ b/OpenSim/Region/Environment/Modules/Avatar/Chat/IRCBridgeModule.cs
@@ -93,6 +93,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
m_scenes.Add(scene);
scene.EventManager.OnNewClient += OnNewClient;
scene.EventManager.OnChatFromWorld += OnSimChat;
+ scene.EventManager.OnChatFromClient += OnSimChat;
scene.EventManager.OnMakeRootAgent += OnMakeRootAgent;
scene.EventManager.OnMakeChildAgent += OnMakeChildAgent;
}
@@ -236,7 +237,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
if (avatar != null)
{
- fromName = avatar.Firstname + " " + avatar.Lastname;
+ fromName = avatar.Name;
}
// Try to reconnect to server if not connected
@@ -277,21 +278,19 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
{
try
{
- string clientName = String.Format("{0} {1}", client.FirstName, client.LastName);
-
- client.OnChatFromViewer += OnSimChat;
+ // client.OnChatFromViewer += OnSimChat;
client.OnLogout += OnClientLoggedOut;
client.OnConnectionClosed += OnClientLoggedOut;
- if (clientName != m_last_new_user)
+ if (client.Name != m_last_new_user)
{
if ((m_irc.Enabled) && (m_irc.Connected))
{
- m_log.DebugFormat("[IRC] {0} logging on", clientName);
+ m_log.DebugFormat("[IRC] {0} logging on", client.Name);
m_irc.PrivMsg(m_irc.Nick, "Sim",
- String.Format("notices {0} logging on", clientName));
+ String.Format("notices {0} logging on", client.Name));
}
- m_last_new_user = clientName;
+ m_last_new_user = client.Name;
}
}
catch (Exception ex)
@@ -343,21 +342,20 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
{
if ((m_irc.Enabled) && (m_irc.Connected))
{
- string clientName = String.Format("{0} {1}", client.FirstName, client.LastName);
// handles simple case. May not work for hundred connecting in per second.
// and the NewClients calles getting interleved
// but filters out multiple reports
- if (clientName != m_last_leaving_user)
+ if (client.Name != m_last_leaving_user)
{
Console.WriteLine("Avatar was seen logging out.");
//Console.ReadLine();
Console.WriteLine();
- m_last_leaving_user = clientName;
- m_irc.PrivMsg(m_irc.Nick, "Sim", String.Format("notices {0} logging out", clientName));
- m_log.InfoFormat("[IRC]: {0} logging out", clientName);
+ m_last_leaving_user = client.Name;
+ m_irc.PrivMsg(m_irc.Nick, "Sim", String.Format("notices {0} logging out", client.Name));
+ m_log.InfoFormat("[IRC]: {0} logging out", client.Name);
}
- if (m_last_new_user == clientName)
+ if (m_last_new_user == client.Name)
m_last_new_user = null;
}
}
diff --git a/OpenSim/Region/Environment/Modules/Avatar/Concierge/ConciergeModule.cs b/OpenSim/Region/Environment/Modules/Avatar/Concierge/ConciergeModule.cs
index 0c0f553638..d9730dda43 100644
--- a/OpenSim/Region/Environment/Modules/Avatar/Concierge/ConciergeModule.cs
+++ b/OpenSim/Region/Environment/Modules/Avatar/Concierge/ConciergeModule.cs
@@ -50,7 +50,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Concierge
private int _conciergeChannel = 42;
private List _scenes = new List();
private IConfig _config;
- private string _whoami = null;
+ private string _whoami = "conferencier";
internal object _syncy = new object();
@@ -78,8 +78,12 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Concierge
return;
}
- _conciergeChannel = config.Configs["Concierge"].GetInt("concierge_channel", _conciergeChannel);
- _whoami = _config.GetString("concierge_name", "conferencier");
+ if (_config != null)
+ {
+ _conciergeChannel = config.Configs["Concierge"].GetInt("concierge_channel", _conciergeChannel);
+ _whoami = _config.GetString("whoami", "conferencier");
+ }
+ _log.InfoFormat("[Concierge] reporting as \"{0}\" to our users", _whoami);
lock (_syncy)
{
@@ -88,8 +92,9 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Concierge
_scenes.Add(scene);
// subscribe to NewClient events
scene.EventManager.OnNewClient += OnNewClient;
+ scene.EventManager.OnNewClient += OnNewClient;
- // subscribe to *Chat events
+ // subscribe to *Chat events and FilterChat* events
scene.EventManager.OnChatFromWorld += OnSimChat;
scene.EventManager.OnChatBroadcast += OnSimBroadcast;
@@ -124,18 +129,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Concierge
#region ISimChat Members
public void OnSimBroadcast(Object sender, OSChatMessage c)
{
- if (_conciergeChannel == c.Channel)
- {
- // concierge request: interpret
- return;
- }
-
- if (0 == c.Channel || DEBUG_CHANNEL == c.Channel)
- {
- // log as avatar/prim chat
- return;
- }
-
+ // log to buffer?
return;
}
@@ -149,6 +143,11 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Concierge
if (0 == c.Channel || DEBUG_CHANNEL == c.Channel)
{
+ // if (_amplify)
+ // {
+
+ // }
+
// log as avatar/prim chat
return;
}
@@ -161,14 +160,20 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Concierge
public void OnNewClient(IClientAPI client)
{
- try
- {
- client.OnChatFromViewer += OnSimChat;
- }
- catch (Exception ex)
- {
- _log.Error("[Concierge]: NewClient exception trap:" + ex.ToString());
- }
+ client.OnLogout += OnClientLoggedOut;
+ client.OnConnectionClosed += OnClientLoggedOut;
+
+ _log.DebugFormat("[Concierge] {0} logs on to {1}", client.Name, client.Scene.RegionInfo.RegionName);
+ AnnounceToAgentsRegion(client, String.Format("{0} logs on to {1}", client.Name, client.Scene.RegionInfo.RegionName));
+ }
+
+ public void OnClientLoggedOut(IClientAPI client)
+ {
+ client.OnLogout -= OnClientLoggedOut;
+ client.OnConnectionClosed -= OnClientLoggedOut;
+
+ _log.DebugFormat("[Concierge] {0} logs off from {1}", client.Name, client.Scene.RegionInfo.RegionName);
+ AnnounceToAgentsRegion(client, String.Format("{0} logs off from {1}", client.Name, client.Scene.RegionInfo.RegionName));
}
@@ -188,13 +193,22 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Concierge
public void ClientLoggedOut(IClientAPI client)
{
- string clientName = String.Format("{0} {1}", client.FirstName, client.LastName);
- _log.DebugFormat("[CONCIERGE] {0} logging off.", clientName);
+ _log.DebugFormat("[Concierge] {0} logs out of {1}", client.Name, client.Scene.RegionInfo.RegionName);
+ AnnounceToAgentsRegion(client, String.Format("{0} logs out of {1}", client.Name, client.Scene.RegionInfo.RegionName));
}
static private Vector3 posOfGod = new Vector3(128, 128, 9999);
+ protected void AnnounceToAgentsRegion(IClientAPI client, string msg)
+ {
+ ScenePresence agent = null;
+ if ((client.Scene is Scene) && (client.Scene as Scene).TryGetAvatar(client.AgentId, out agent))
+ AnnounceToAgentsRegion(agent, msg);
+ else
+ _log.DebugFormat("[Concierge] could not find an agent for client {0}", client.Name);
+ }
+
protected void AnnounceToAgentsRegion(ScenePresence scenePresence, string msg)
{
OSChatMessage c = new OSChatMessage();
diff --git a/OpenSim/Region/Environment/Modules/ContentManagementSystem/CMController.cs b/OpenSim/Region/Environment/Modules/ContentManagementSystem/CMController.cs
index cdd4f4e40c..6eaaacde15 100644
--- a/OpenSim/Region/Environment/Modules/ContentManagementSystem/CMController.cs
+++ b/OpenSim/Region/Environment/Modules/ContentManagementSystem/CMController.cs
@@ -381,7 +381,7 @@ namespace OpenSim.Region.Environment.Modules.ContentManagement
protected void StartManaging(IClientAPI client)
{
m_log.Debug("[CONTENT MANAGEMENT] Registering channel with chat services.");
- client.OnChatFromViewer += SimChatSent;
+ // client.OnChatFromClient += SimChatSent;
//init = true;
OnNewClient(client);
@@ -412,7 +412,7 @@ namespace OpenSim.Region.Environment.Modules.ContentManagement
{
IClientAPI client = presence.ControllingClient;
m_log.Debug("[CONTENT MANAGEMENT] Unregistering channel with chat services.");
- client.OnChatFromViewer -= SimChatSent;
+ // client.OnChatFromViewer -= SimChatSent;
m_log.Debug("[CONTENT MANAGEMENT] Removing handlers to client");
client.OnUpdatePrimScale -= UpdateSingleScale;
@@ -641,6 +641,7 @@ namespace OpenSim.Region.Environment.Modules.ContentManagement
m_log.Debug("[CONTENT MANAGEMENT] Initializing Content Management System.");
scene.EventManager.OnNewClient += StartManaging;
+ scene.EventManager.OnChatFromClient += SimChatSent;
scene.EventManager.OnRemovePresence += StopManaging;
// scene.EventManager.OnAvatarEnteringNewParcel += AvatarEnteringParcel;
scene.EventManager.OnObjectBeingRemovedFromScene += GroupBeingDeleted;
diff --git a/OpenSim/Region/Environment/Modules/Scripting/WorldComm/WorldCommModule.cs b/OpenSim/Region/Environment/Modules/Scripting/WorldComm/WorldCommModule.cs
index ae5eefcda3..f5ec389f50 100644
--- a/OpenSim/Region/Environment/Modules/Scripting/WorldComm/WorldCommModule.cs
+++ b/OpenSim/Region/Environment/Modules/Scripting/WorldComm/WorldCommModule.cs
@@ -116,7 +116,7 @@ namespace OpenSim.Region.Environment.Modules.Scripting.WorldComm
m_scene = scene;
m_scene.RegisterModuleInterface(this);
m_listenerManager = new ListenerManager(maxlisteners, maxhandles);
- m_scene.EventManager.OnNewClient += NewClient;
+ m_scene.EventManager.OnChatFromClient += DeliverClientMessage;
m_pendingQ = new Queue();
m_pending = Queue.Synchronized(m_pendingQ);
}
@@ -203,7 +203,7 @@ namespace OpenSim.Region.Environment.Modules.Scripting.WorldComm
/// enqueue the message for delivery to the objects listen event handler.
/// The enqueued ListenerInfo no longer has filter values, but the actually trigged values.
/// Objects that do an llSay have their messages delivered here and for nearby avatars,
- /// the OnChatFromViewer event is used.
+ /// the OnChatFromClient event is used.
///
/// type of delvery (whisper,say,shout or regionwide)
/// channel to sent on
@@ -311,10 +311,10 @@ namespace OpenSim.Region.Environment.Modules.Scripting.WorldComm
#endregion
- private void NewClient(IClientAPI client)
- {
- client.OnChatFromViewer += DeliverClientMessage;
- }
+ // private void NewClient(IClientAPI client)
+ // {
+ // client.OnChatFromViewer += DeliverClientMessage;
+ // }
/********************************************************************
*
diff --git a/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs b/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs
index 78aee92b6e..33eade2e8f 100644
--- a/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs
+++ b/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs
@@ -59,22 +59,22 @@ namespace OpenSim.Region.Environment.Modules.World.NPC
public void Say(string message)
{
- SendOnChatFromViewer(message, ChatTypeEnum.Say);
+ SendOnChatFromClient(message, ChatTypeEnum.Say);
}
public void Shout(string message)
{
- SendOnChatFromViewer(message, ChatTypeEnum.Shout);
+ SendOnChatFromClient(message, ChatTypeEnum.Shout);
}
public void Whisper(string message)
{
- SendOnChatFromViewer(message, ChatTypeEnum.Whisper);
+ SendOnChatFromClient(message, ChatTypeEnum.Whisper);
}
public void Broadcast(string message)
{
- SendOnChatFromViewer(message, ChatTypeEnum.Broadcast);
+ SendOnChatFromClient(message, ChatTypeEnum.Broadcast);
}
public void GiveMoney(UUID target, int amount)
@@ -132,19 +132,19 @@ namespace OpenSim.Region.Environment.Modules.World.NPC
#region Internal Functions
- private void SendOnChatFromViewer(string message, ChatTypeEnum chatType)
+ private void SendOnChatFromClient(string message, ChatTypeEnum chatType)
{
- OSChatMessage chatFromViewer = new OSChatMessage();
- chatFromViewer.Channel = 0;
- chatFromViewer.From = Name;
- chatFromViewer.Message = message;
- chatFromViewer.Position = StartPos;
- chatFromViewer.Scene = m_scene;
- chatFromViewer.Sender = this;
- chatFromViewer.SenderUUID = AgentId;
- chatFromViewer.Type = chatType;
+ OSChatMessage chatFromClient = new OSChatMessage();
+ chatFromClient.Channel = 0;
+ chatFromClient.From = Name;
+ chatFromClient.Message = message;
+ chatFromClient.Position = StartPos;
+ chatFromClient.Scene = m_scene;
+ chatFromClient.Sender = this;
+ chatFromClient.SenderUUID = AgentId;
+ chatFromClient.Type = chatType;
- OnChatFromViewer(this, chatFromViewer);
+ OnChatFromClient(this, chatFromClient);
}
#endregion
@@ -161,7 +161,7 @@ namespace OpenSim.Region.Environment.Modules.World.NPC
public event Action OnConnectionClosed;
public event GenericMessage OnGenericMessage;
public event ImprovedInstantMessage OnInstantMessage;
- public event ChatMessage OnChatFromViewer;
+ public event ChatMessage OnChatFromClient;
public event TextureRequest OnRequestTexture;
public event RezObject OnRezObject;
public event ModifyTerrain OnModifyTerrain;
diff --git a/OpenSim/Region/Environment/Scenes/EventManager.cs b/OpenSim/Region/Environment/Scenes/EventManager.cs
index 87f3de1afa..c629fafb11 100644
--- a/OpenSim/Region/Environment/Scenes/EventManager.cs
+++ b/OpenSim/Region/Environment/Scenes/EventManager.cs
@@ -230,14 +230,20 @@ namespace OpenSim.Region.Environment.Scenes
public event DeregisterCapsEvent OnDeregisterCaps;
///
/// ChatFromWorldEvent is called via Scene when a chat message
- /// from world comes in (chat from viewer is available via
- /// client.OnChatFromViewer).
+ /// from world comes in.
///
public delegate void ChatFromWorldEvent(Object sender, OSChatMessage chat);
public event ChatFromWorldEvent OnChatFromWorld;
///
+ /// ChatFromClientEvent is triggered via ChatModule (or
+ /// substitutes thereof) when a chat message
+ /// from the client comes in.
+ ///
+ public delegate void ChatFromClientEvent(Object sender, OSChatMessage chat);
+ public event ChatFromClientEvent OnChatFromClient;
+ ///
/// ChatBroadcastEvent is called via Scene when a broadcast chat message
- /// from world comes in (chat from viewer is available via client.OnChatFromViewer).
+ /// from world comes in
///
public delegate void ChatBroadcastEvent(Object sender, OSChatMessage chat);
public event ChatBroadcastEvent OnChatBroadcast;
@@ -349,6 +355,7 @@ namespace OpenSim.Region.Environment.Scenes
private RegisterCapsEvent handlerRegisterCaps = null; // OnRegisterCaps;
private DeregisterCapsEvent handlerDeregisterCaps = null; // OnDeregisterCaps;
private ChatFromWorldEvent handlerChatFromWorld = null; // OnChatFromWorld;
+ private ChatFromClientEvent handlerChatFromClient = null; // OnChatFromClient;
private ChatBroadcastEvent handlerChatBroadcast = null; // OnChatBroadcast;
private NewInventoryItemUploadComplete handlerNewInventoryItemUpdateComplete = null;
private RequestChangeWaterHeight handlerRequestChangeWaterHeight = null; //OnRequestChangeWaterHeight
@@ -772,6 +779,15 @@ namespace OpenSim.Region.Environment.Scenes
}
}
+ public void TriggerOnChatFromClient(Object sender, OSChatMessage chat)
+ {
+ handlerChatFromClient = OnChatFromClient;
+ if (handlerChatFromClient != null)
+ {
+ handlerChatFromClient(sender, chat);
+ }
+ }
+
public void TriggerOnChatBroadcast(Object sender, OSChatMessage chat)
{
handlerChatBroadcast = OnChatBroadcast;
diff --git a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
index 6d692479a2..fa6ff220e8 100644
--- a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
+++ b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
@@ -55,7 +55,7 @@ namespace OpenSim.Region.Examples.SimpleModule
public event Action OnConnectionClosed;
public event ImprovedInstantMessage OnInstantMessage;
- public event ChatMessage OnChatFromViewer;
+ public event ChatMessage OnChatFromClient;
public event TextureRequest OnRequestTexture;
public event RezObject OnRezObject;
public event ModifyTerrain OnModifyTerrain;
@@ -696,7 +696,7 @@ namespace OpenSim.Region.Examples.SimpleModule
if (count >= 10)
{
- if (OnChatFromViewer != null)
+ if (OnChatFromClient != null)
{
OSChatMessage args = new OSChatMessage();
args.Message = "Hey You! Get out of my Home. This is my Region";
@@ -706,7 +706,7 @@ namespace OpenSim.Region.Examples.SimpleModule
args.Sender = this;
args.Type = ChatTypeEnum.Shout;
- OnChatFromViewer(this, args);
+ OnChatFromClient(this, args);
}
count = -1;
}