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

avinationmerge
UbitUmarov 2015-09-29 01:43:49 +01:00
parent a580d945d1
commit f2c8f83215
1 changed files with 35 additions and 8 deletions

View File

@ -79,14 +79,14 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
private IMessageTransferModule m_msgTransferModule; private IMessageTransferModule m_msgTransferModule;
private IGroupsMessagingModule m_groupsMessagingModule; private IGroupsMessagingModule m_groupsMessagingModule;
private IGroupsServicesConnector m_groupData; private IGroupsServicesConnector m_groupData;
// Configuration settings // Configuration settings
private bool m_groupsEnabled = false; private bool m_groupsEnabled = false;
private bool m_groupNoticesEnabled = true; private bool m_groupNoticesEnabled = true;
private bool m_debugEnabled = false; private bool m_debugEnabled = false;
private int m_levelGroupCreate = 0; private int m_levelGroupCreate = 0;
#region Region Module interfaceBase Members #region Region Module interfaceBase Members
@ -116,9 +116,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
m_log.InfoFormat("[GROUPS]: Initializing {0}", this.Name); m_log.InfoFormat("[GROUPS]: Initializing {0}", this.Name);
m_groupNoticesEnabled = groupsConfig.GetBoolean("NoticesEnabled", true); m_groupNoticesEnabled = groupsConfig.GetBoolean("NoticesEnabled", true);
m_debugEnabled = groupsConfig.GetBoolean("DebugEnabled", false); m_debugEnabled = groupsConfig.GetBoolean("DebugEnabled", false);
m_levelGroupCreate = groupsConfig.GetInt("LevelGroupCreate", 0); 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."); if (m_debugEnabled) m_log.Debug("[GROUPS]: Shutting down Groups module.");
} }
public Type ReplaceableInterface public Type ReplaceableInterface
{ {
get { return null; } get { return null; }
} }
@ -263,6 +263,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
sp.ControllingClient.OnUUIDGroupNameRequest += HandleUUIDGroupNameRequest; sp.ControllingClient.OnUUIDGroupNameRequest += HandleUUIDGroupNameRequest;
// Used for Notices and Group Invites/Accept/Reject // Used for Notices and Group Invites/Accept/Reject
sp.ControllingClient.OnInstantMessage += OnInstantMessage; 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, // we should send a DataUpdate here for compatibility,
// but this is a bad place and a bad thread to do it // 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.OnUUIDGroupNameRequest -= HandleUUIDGroupNameRequest;
sp.ControllingClient.OnInstantMessage -= OnInstantMessage; sp.ControllingClient.OnInstantMessage -= OnInstantMessage;
} }
private void OnNewClient(IClientAPI client) private void OnNewClient(IClientAPI client)
{ {
if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
client.OnAgentDataUpdateRequest += OnAgentDataUpdateRequest; client.OnAgentDataUpdateRequest += OnAgentDataUpdateRequest;
client.OnRequestAvatarProperties += OnRequestAvatarProperties; client.OnRequestAvatarProperties += OnRequestAvatarProperties;
}
}
/* this should be the right message to ask for other avatars groups
private void AvatarGroupsRequest(Object sender, string method, List<String> 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) private void OnRequestAvatarProperties(IClientAPI remoteClient, UUID avatarID)
{ {
if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);