From f2c8f832159e9b75ea94a2ac5f738d9804ec95fb Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 29 Sep 2015 01:43:49 +0100 Subject: add processing of AvatarGroupsRequest message that should be used to get other avatars group memberships, but keep it disabled since some viewers no longer suport it correctly and expect memberships in reply to avatar properties, so we need to keep wasting bandwith sending useless information when some viewers really only want avatarproperties --- .../Avatar/XmlRpcGroups/GroupsModule.cs | 41 ++++++++++++++++++---- 1 file changed, 34 insertions(+), 7 deletions(-) diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs index e0402fd..b1fd9ad 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs @@ -79,14 +79,14 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups private IMessageTransferModule m_msgTransferModule; private IGroupsMessagingModule m_groupsMessagingModule; - + private IGroupsServicesConnector m_groupData; // Configuration settings private bool m_groupsEnabled = false; private bool m_groupNoticesEnabled = true; private bool m_debugEnabled = false; - private int m_levelGroupCreate = 0; + private int m_levelGroupCreate = 0; #region Region Module interfaceBase Members @@ -116,9 +116,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups m_log.InfoFormat("[GROUPS]: Initializing {0}", this.Name); - m_groupNoticesEnabled = groupsConfig.GetBoolean("NoticesEnabled", true); - m_debugEnabled = groupsConfig.GetBoolean("DebugEnabled", false); - m_levelGroupCreate = groupsConfig.GetInt("LevelGroupCreate", 0); + m_groupNoticesEnabled = groupsConfig.GetBoolean("NoticesEnabled", true); + m_debugEnabled = groupsConfig.GetBoolean("DebugEnabled", false); + m_levelGroupCreate = groupsConfig.GetInt("LevelGroupCreate", 0); } } @@ -233,7 +233,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups if (m_debugEnabled) m_log.Debug("[GROUPS]: Shutting down Groups module."); } - public Type ReplaceableInterface + public Type ReplaceableInterface { get { return null; } } @@ -263,6 +263,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups sp.ControllingClient.OnUUIDGroupNameRequest += HandleUUIDGroupNameRequest; // Used for Notices and Group Invites/Accept/Reject sp.ControllingClient.OnInstantMessage += OnInstantMessage; +// comented out bc some viewers wrongly stoped suporting it +// sp.ControllingClient.AddGenericPacketHandler("avatargroupsrequest", AvatarGroupsRequest); // we should send a DataUpdate here for compatibility, // but this is a bad place and a bad thread to do it @@ -276,15 +278,40 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups sp.ControllingClient.OnUUIDGroupNameRequest -= HandleUUIDGroupNameRequest; sp.ControllingClient.OnInstantMessage -= OnInstantMessage; } - + private void OnNewClient(IClientAPI client) { if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); client.OnAgentDataUpdateRequest += OnAgentDataUpdateRequest; client.OnRequestAvatarProperties += OnRequestAvatarProperties; + + + } +/* this should be the right message to ask for other avatars groups + + private void AvatarGroupsRequest(Object sender, string method, List args) + { + if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); + + if (!(sender is IClientAPI)) + return; + + IClientAPI remoteClient = (IClientAPI)sender; + + UUID avatarID; + UUID.TryParse(args[0], out avatarID); + + if (avatarID != UUID.Zero) + { + GroupMembershipData[] avatarGroups = GetProfileListedGroupMemberships(remoteClient, avatarID); + remoteClient.SendAvatarGroupsReply(avatarID, avatarGroups); + } } +*/ +// this should not be used to send groups memberships, but some viewers do expect it +// it does send unnecessary memberships, when viewers just want other properties information private void OnRequestAvatarProperties(IClientAPI remoteClient, UUID avatarID) { if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); -- cgit v1.1