several changes to xmlrpcGroups. Packets AgentData and AgentGroupData are private to the requesting agent, etc
parent
238b32d95f
commit
b269185031
|
@ -265,10 +265,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
|||
sp.ControllingClient.OnUUIDGroupNameRequest += HandleUUIDGroupNameRequest;
|
||||
// Used for Notices and Group Invites/Accept/Reject
|
||||
sp.ControllingClient.OnInstantMessage += OnInstantMessage;
|
||||
// Send client their groups information.
|
||||
SendAgentGroupDataUpdate(sp.ControllingClient, sp.UUID);
|
||||
// only send data viwer will ask rest later
|
||||
// OnAgentDataUpdateRequest(sp.ControllingClient, sp.UUID, sp.UUID);
|
||||
|
||||
// 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
|
||||
}
|
||||
|
||||
private void OnMakeChild(ScenePresence sp)
|
||||
|
@ -291,7 +291,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
|||
{
|
||||
if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
|
||||
|
||||
//GroupMembershipData[] avatarGroups = m_groupData.GetAgentGroupMemberships(GetRequestingAgentID(remoteClient), avatarID).ToArray();
|
||||
GroupMembershipData[] avatarGroups = GetProfileListedGroupMemberships(remoteClient, avatarID);
|
||||
remoteClient.SendAvatarGroupsReply(avatarID, avatarGroups);
|
||||
}
|
||||
|
@ -332,24 +331,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
|||
|
||||
private void OnAgentDataUpdateRequest(IClientAPI remoteClient, UUID dataForAgentID, UUID sessionID)
|
||||
{
|
||||
if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
|
||||
// this a private message for own agent only
|
||||
if (dataForAgentID != GetRequestingAgentID(remoteClient))
|
||||
return;
|
||||
|
||||
UUID activeGroupID = UUID.Zero;
|
||||
string activeGroupTitle = string.Empty;
|
||||
string activeGroupName = string.Empty;
|
||||
ulong activeGroupPowers = (ulong)GroupPowers.None;
|
||||
|
||||
GroupMembershipData membership = m_groupData.GetAgentActiveMembership(GetRequestingAgentID(remoteClient), dataForAgentID);
|
||||
if (membership != null)
|
||||
{
|
||||
activeGroupID = membership.GroupID;
|
||||
activeGroupTitle = membership.GroupTitle;
|
||||
activeGroupPowers = membership.GroupPowers;
|
||||
}
|
||||
|
||||
SendAgentDataUpdate(remoteClient, dataForAgentID, activeGroupID, activeGroupName, activeGroupPowers, activeGroupTitle);
|
||||
|
||||
SendScenePresenceUpdate(dataForAgentID, activeGroupTitle);
|
||||
SendAgentGroupDataUpdate(remoteClient, false);
|
||||
// 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
|
||||
}
|
||||
|
||||
private void HandleUUIDGroupNameRequest(UUID GroupID, IClientAPI remoteClient)
|
||||
|
@ -420,7 +408,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
|||
|
||||
OutgoingInstantMessage(msg, inviteInfo.AgentID);
|
||||
|
||||
UpdateAllClientsWithGroupInfo(inviteInfo.AgentID);
|
||||
IClientAPI client = GetActiveClient(inviteInfo.AgentID);
|
||||
if (client != null)
|
||||
SendDataUpdate(remoteClient, true);
|
||||
|
||||
// TODO: If the inviter is still online, they need an agent dataupdate
|
||||
// and maybe group membership updates for the invitee
|
||||
|
@ -673,13 +663,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
|||
{
|
||||
if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
|
||||
|
||||
m_groupData.SetAgentActiveGroup(GetRequestingAgentID(remoteClient), GetRequestingAgentID(remoteClient), groupID);
|
||||
UUID agentID = GetRequestingAgentID(remoteClient);
|
||||
m_groupData.SetAgentActiveGroup(agentID, agentID, 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.
|
||||
UpdateAllClientsWithGroupInfo(GetRequestingAgentID(remoteClient));
|
||||
// llClientView does this
|
||||
SendAgentGroupDataUpdate(remoteClient, true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -689,7 +677,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
|||
{
|
||||
if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
|
||||
|
||||
|
||||
List<GroupRolesData> agentRoles = m_groupData.GetAgentGroupRoles(GetRequestingAgentID(remoteClient), GetRequestingAgentID(remoteClient), groupID);
|
||||
GroupMembershipData agentMembership = m_groupData.GetAgentGroupMembership(GetRequestingAgentID(remoteClient), GetRequestingAgentID(remoteClient), groupID);
|
||||
|
||||
|
@ -727,7 +714,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
|||
}
|
||||
|
||||
return data;
|
||||
|
||||
}
|
||||
|
||||
public List<GroupRolesData> GroupRoleDataRequest(IClientAPI remoteClient, UUID groupID)
|
||||
|
@ -865,7 +851,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
|||
remoteClient.SendCreateGroupReply(groupID, true, "Group created successfullly");
|
||||
|
||||
// Update the founder with new group information.
|
||||
SendAgentGroupDataUpdate(remoteClient, GetRequestingAgentID(remoteClient));
|
||||
SendAgentGroupDataUpdate(remoteClient, false);
|
||||
|
||||
return groupID;
|
||||
}
|
||||
|
@ -907,10 +893,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
|||
// the client currently has set active, then we need to do a scene presence update too
|
||||
// if (m_groupData.GetAgentActiveMembership(GetRequestingAgentID(remoteClient)).GroupID == GroupID)
|
||||
|
||||
UpdateAllClientsWithGroupInfo(GetRequestingAgentID(remoteClient));
|
||||
SendDataUpdate(remoteClient, true);
|
||||
}
|
||||
|
||||
|
||||
public void GroupRoleUpdate(IClientAPI remoteClient, UUID groupID, UUID roleID, string name, string description, string title, ulong powers, byte updateType)
|
||||
{
|
||||
if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
|
||||
|
@ -946,7 +931,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
|||
}
|
||||
|
||||
// TODO: This update really should send out updates for everyone in the role that just got changed.
|
||||
SendAgentGroupDataUpdate(remoteClient, GetRequestingAgentID(remoteClient));
|
||||
SendAgentGroupDataUpdate(remoteClient, false);
|
||||
}
|
||||
|
||||
public void GroupRoleChanges(IClientAPI remoteClient, UUID groupID, UUID roleID, UUID memberID, uint changes)
|
||||
|
@ -972,7 +957,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
|||
}
|
||||
|
||||
// TODO: This update really should send out updates for everyone in the role that just got changed.
|
||||
SendAgentGroupDataUpdate(remoteClient, GetRequestingAgentID(remoteClient));
|
||||
SendAgentGroupDataUpdate(remoteClient, false);
|
||||
}
|
||||
|
||||
public void GroupNoticeRequest(IClientAPI remoteClient, UUID groupNoticeID)
|
||||
|
@ -1052,14 +1037,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
|||
return msg;
|
||||
}
|
||||
|
||||
public void SendAgentGroupDataUpdate(IClientAPI remoteClient)
|
||||
{
|
||||
if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
|
||||
|
||||
// Send agent information about his groups
|
||||
SendAgentGroupDataUpdate(remoteClient, GetRequestingAgentID(remoteClient));
|
||||
}
|
||||
|
||||
public void JoinGroupRequest(IClientAPI remoteClient, UUID groupID)
|
||||
{
|
||||
if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
|
||||
|
@ -1069,8 +1046,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
|||
|
||||
remoteClient.SendJoinGroupReply(groupID, true);
|
||||
|
||||
// Should this send updates to everyone in the group?
|
||||
SendAgentGroupDataUpdate(remoteClient, GetRequestingAgentID(remoteClient));
|
||||
SendAgentGroupDataUpdate(remoteClient, true);
|
||||
}
|
||||
|
||||
public void LeaveGroupRequest(IClientAPI remoteClient, UUID groupID)
|
||||
|
@ -1085,7 +1061,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
|||
|
||||
// SL sends out notifcations to the group messaging session that the person has left
|
||||
// Should this also update everyone who is in the group?
|
||||
SendAgentGroupDataUpdate(remoteClient, GetRequestingAgentID(remoteClient));
|
||||
SendAgentGroupDataUpdate(remoteClient, true);
|
||||
}
|
||||
|
||||
public void EjectGroupMemberRequest(IClientAPI remoteClient, UUID groupID, UUID ejecteeID)
|
||||
|
@ -1194,10 +1170,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
|||
msg.binaryBucket = new byte[0];
|
||||
OutgoingInstantMessage(msg, agentID);
|
||||
|
||||
|
||||
// SL sends out messages to everyone in the group
|
||||
// Who all should receive updates and what should they be updated with?
|
||||
UpdateAllClientsWithGroupInfo(ejecteeID);
|
||||
// just tell this the group change
|
||||
SendAgentGroupDataUpdate(remoteClient, false);
|
||||
// TODO fix the rest of sends
|
||||
}
|
||||
|
||||
public void InviteGroupRequest(IClientAPI remoteClient, UUID groupID, UUID invitedAgentID, UUID roleID)
|
||||
|
@ -1378,7 +1355,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
|||
{
|
||||
queue.Enqueue(queue.BuildEvent("AgentGroupDataUpdate", llDataStruct), GetRequestingAgentID(remoteClient));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void SendScenePresenceUpdate(UUID AgentID, string Title)
|
||||
|
@ -1403,34 +1379,23 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Send updates to all clients who might be interested in groups data for dataForClientID
|
||||
/// </summary>
|
||||
private void UpdateAllClientsWithGroupInfo(UUID dataForClientID)
|
||||
public void SendAgentGroupDataUpdate(IClientAPI remoteClient)
|
||||
{
|
||||
if (m_debugEnabled) m_log.InfoFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
|
||||
|
||||
// TODO: Probably isn't nessesary to update every client in every scene.
|
||||
// Need to examine client updates and do only what's nessesary.
|
||||
lock (m_sceneList)
|
||||
{
|
||||
foreach (Scene scene in m_sceneList)
|
||||
{
|
||||
scene.ForEachClient(delegate(IClientAPI client) { SendAgentGroupDataUpdate(client, dataForClientID); });
|
||||
}
|
||||
}
|
||||
SendAgentGroupDataUpdate(remoteClient, true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update remoteClient with group information about dataForAgentID
|
||||
/// Tell remoteClient about its agent groups, and optionally send title to others
|
||||
/// </summary>
|
||||
private void SendAgentGroupDataUpdate(IClientAPI remoteClient, UUID dataForAgentID)
|
||||
private void SendAgentGroupDataUpdate(IClientAPI remoteClient, bool tellOthers)
|
||||
{
|
||||
if (m_debugEnabled) m_log.InfoFormat("[GROUPS]: {0} called for {1}", System.Reflection.MethodBase.GetCurrentMethod().Name, remoteClient.Name);
|
||||
|
||||
// TODO: All the client update functions need to be reexamined because most do too much and send too much stuff
|
||||
|
||||
OnAgentDataUpdateRequest(remoteClient, dataForAgentID, UUID.Zero);
|
||||
UUID agentID = GetRequestingAgentID(remoteClient);
|
||||
|
||||
SendDataUpdate(remoteClient, tellOthers);
|
||||
|
||||
// Need to send a group membership update to the client
|
||||
// UDP version doesn't seem to behave nicely. But we're going to send it out here
|
||||
|
@ -1438,11 +1403,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
|||
// to the core Groups Stub
|
||||
remoteClient.SendGroupMembership(new GroupMembershipData[0]);
|
||||
|
||||
GroupMembershipData[] membershipArray = GetProfileListedGroupMemberships(remoteClient, dataForAgentID);
|
||||
SendGroupMembershipInfoViaCaps(remoteClient, dataForAgentID, membershipArray);
|
||||
remoteClient.SendAvatarGroupsReply(dataForAgentID, membershipArray);
|
||||
GroupMembershipData[] membershipArray = GetProfileListedGroupMemberships(remoteClient, agentID);
|
||||
SendGroupMembershipInfoViaCaps(remoteClient, agentID, membershipArray);
|
||||
|
||||
if (remoteClient.AgentId == dataForAgentID)
|
||||
remoteClient.RefreshGroupMembership();
|
||||
}
|
||||
|
||||
|
@ -1495,13 +1458,27 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
|||
return membershipArray;
|
||||
}
|
||||
|
||||
|
||||
private void SendAgentDataUpdate(IClientAPI remoteClient, UUID dataForAgentID, UUID activeGroupID, string activeGroupName, ulong activeGroupPowers, string activeGroupTitle)
|
||||
//tell remoteClient about its agent group info, and optionally send title to others
|
||||
private void SendDataUpdate(IClientAPI remoteClient, bool tellOthers)
|
||||
{
|
||||
if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
|
||||
|
||||
// TODO: All the client update functions need to be reexamined because most do too much and send too much stuff
|
||||
UserAccount account = m_sceneList[0].UserAccountService.GetUserAccount(remoteClient.Scene.RegionInfo.ScopeID, dataForAgentID);
|
||||
UUID activeGroupID = UUID.Zero;
|
||||
string activeGroupTitle = string.Empty;
|
||||
string activeGroupName = string.Empty;
|
||||
ulong activeGroupPowers = (ulong)GroupPowers.None;
|
||||
|
||||
UUID agentID = GetRequestingAgentID(remoteClient);
|
||||
GroupMembershipData membership = m_groupData.GetAgentActiveMembership(agentID, agentID);
|
||||
if (membership != null)
|
||||
{
|
||||
activeGroupID = membership.GroupID;
|
||||
activeGroupTitle = membership.GroupTitle;
|
||||
activeGroupPowers = membership.GroupPowers;
|
||||
activeGroupName = membership.GroupName;
|
||||
}
|
||||
|
||||
UserAccount account = m_sceneList[0].UserAccountService.GetUserAccount(remoteClient.Scene.RegionInfo.ScopeID, agentID);
|
||||
string firstname, lastname;
|
||||
if (account != null)
|
||||
{
|
||||
|
@ -1514,9 +1491,16 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
|||
lastname = "Unknown";
|
||||
}
|
||||
|
||||
remoteClient.SendAgentDataUpdate(dataForAgentID, activeGroupID, firstname,
|
||||
remoteClient.SendAgentDataUpdate(agentID, activeGroupID, firstname,
|
||||
lastname, activeGroupPowers, activeGroupName,
|
||||
activeGroupTitle);
|
||||
|
||||
if (tellOthers)
|
||||
SendScenePresenceUpdate(agentID, activeGroupTitle);
|
||||
|
||||
ScenePresence sp = (ScenePresence)remoteClient.SceneAgent;
|
||||
if (sp != null)
|
||||
sp.Grouptitle = activeGroupTitle;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
Loading…
Reference in New Issue