From 9ebdae8676f1e48bc1e12af9c28714dff295f8b9 Mon Sep 17 00:00:00 2001
From: Robert Adams
Date: Sat, 11 Jun 2016 12:42:42 -0700
Subject: Restore SendAgentGroupDataUpdate() call in GroupsModule.cs. Restore
 linkage to OnAgentClosed since the merge solved the reference    problem by
 looking up the agent. This should address Mantis 7915 and 7920.

---
 OpenSim/Addons/Groups/GroupsModule.cs | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

(limited to 'OpenSim/Addons/Groups')

diff --git a/OpenSim/Addons/Groups/GroupsModule.cs b/OpenSim/Addons/Groups/GroupsModule.cs
index da8c9ea..cdc98f5 100644
--- a/OpenSim/Addons/Groups/GroupsModule.cs
+++ b/OpenSim/Addons/Groups/GroupsModule.cs
@@ -179,9 +179,7 @@ namespace OpenSim.Groups
             scene.EventManager.OnMakeRootAgent += OnMakeRoot;
             scene.EventManager.OnMakeChildAgent += OnMakeChild;
             scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage;
-            // The InstantMessageModule itself doesn't do this, 
-            // so lets see if things explode if we don't do it
-            // scene.EventManager.OnClientClosed += OnClientClosed;
+            scene.EventManager.OnClientClosed += OnClientClosed;
 
         }
 
@@ -246,9 +244,11 @@ namespace OpenSim.Groups
             // Used for Notices and Group Invites/Accept/Reject
             sp.ControllingClient.OnInstantMessage += OnInstantMessage;
 
-            // we should send a DataUpdate here for compatibility,
-            // but this is a bad place and a bad thread to do it
-            // also current viewers do ignore it and ask later on a much nicer thread 
+            // Send out group data update for compatibility.
+            // There might be some problem with the thread we're generating this on but not
+            //   doing the update at this time causes problems (Mantis #7920 and #7915)
+            // TODO: move sending this update to a later time in the rootification of the client.
+            SendAgentGroupDataUpdate(sp.ControllingClient, false);
         }
 
         private void OnMakeChild(ScenePresence sp)
@@ -315,6 +315,8 @@ namespace OpenSim.Groups
                 return;
 
             SendAgentGroupDataUpdate(remoteClient, false);
+
+            // also current viewers do ignore it and ask later on a much nicer thread 
             // its a info request not a change, so nothing is sent to others
             // they do get the group title with the avatar object update on arrivel to a region
         }
@@ -578,6 +580,10 @@ namespace OpenSim.Groups
 
             m_groupData.SetAgentActiveGroup(GetRequestingAgentIDStr(remoteClient), GetRequestingAgentIDStr(remoteClient), groupID);
 
+            // Changing active group changes title, active powers, all kinds of things
+            // anyone who is in any region that can see this client, should probably be 
+            // updated with new group info.  At a minimum, they should get ScenePresence
+            // updated with new title.
             SendAgentGroupDataUpdate(remoteClient, true);
         }
 
@@ -1240,7 +1246,7 @@ namespace OpenSim.Groups
             GroupMembershipData[] membershipArray = GetProfileListedGroupMemberships(remoteClient, agentID);
             remoteClient.SendAgentGroupDataUpdate(agentID, membershipArray);
 
-           remoteClient.RefreshGroupMembership();
+            remoteClient.RefreshGroupMembership();
         }
 
         /// <summary>
-- 
cgit v1.1