From 8dff05a89798543994cb6e5ac5e5f715daf5898b Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sat, 27 Jul 2013 20:30:00 -0700 Subject: More on group chat: only root agents should subscribe to OnInstantMessage, or else they'll see an echo of their own messages after teleporting. --- OpenSim/Addons/Groups/GroupsMessagingModule.cs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/OpenSim/Addons/Groups/GroupsMessagingModule.cs b/OpenSim/Addons/Groups/GroupsMessagingModule.cs index 04e2b80..ce4f597 100644 --- a/OpenSim/Addons/Groups/GroupsMessagingModule.cs +++ b/OpenSim/Addons/Groups/GroupsMessagingModule.cs @@ -129,9 +129,12 @@ namespace OpenSim.Groups m_sceneList.Add(scene); scene.EventManager.OnNewClient += OnNewClient; + scene.EventManager.OnMakeRootAgent += OnMakeRootAgent; + scene.EventManager.OnMakeChildAgent += OnMakeChildAgent; scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage; scene.EventManager.OnClientLogin += OnClientLogin; } + public void RegionLoaded(Scene scene) { if (!m_groupMessagingEnabled) @@ -347,10 +350,20 @@ namespace OpenSim.Groups { if (m_debugEnabled) m_log.DebugFormat("[Groups.Messaging]: OnInstantMessage registered for {0}", client.Name); - client.OnInstantMessage += OnInstantMessage; ResetAgentGroupChatSessions(client.AgentId.ToString()); } + void OnMakeRootAgent(ScenePresence sp) + { + sp.ControllingClient.OnInstantMessage += OnInstantMessage; + } + + void OnMakeChildAgent(ScenePresence sp) + { + sp.ControllingClient.OnInstantMessage -= OnInstantMessage; + } + + private void OnGridInstantMessage(GridInstantMessage msg) { // The instant message module will only deliver messages of dialog types: -- cgit v1.1