When sending group notices through group messaging, allow the agent ID to use for fetching group data to be different from im.fromAgentID

This is because xmlrpcgroups currently always checks visibility for the requesting agent ID (unlike Groups v2, which can accept UUID.Zero)
But group notice IMs have a from agent which is the group rather than the sending agent.
Further addresses http://opensimulator.org/mantis/view.php?id=7037
0.8.0.3
Justin Clark-Casey (justincc) 2014-03-12 19:31:04 +00:00
parent 7112ee0015
commit beba20846f
4 changed files with 19 additions and 10 deletions

View File

@ -83,7 +83,6 @@ namespace OpenSim.Groups
private Dictionary<UUID, List<string>> m_groupsAgentsDroppedFromChatSession = new Dictionary<UUID, List<string>>();
private Dictionary<UUID, List<string>> m_groupsAgentsInvitedToChatSession = new Dictionary<UUID, List<string>>();
#region Region Module interfaceBase Members
public void Initialise(IConfigSource config)
@ -242,13 +241,18 @@ namespace OpenSim.Groups
public void SendMessageToGroup(GridInstantMessage im, UUID groupID)
{
SendMessageToGroup(im, groupID, null);
SendMessageToGroup(im, groupID, UUID.Zero, null);
}
public void SendMessageToGroup(GridInstantMessage im, UUID groupID, Func<GroupMembersData, bool> sendCondition)
public void SendMessageToGroup(
GridInstantMessage im, UUID groupID, UUID sendingAgentForGroupCalls, Func<GroupMembersData, bool> sendCondition)
{
UUID fromAgentID = new UUID(im.fromAgentID);
// Unlike current XmlRpcGroups, Groups V2 can accept UUID.Zero when a perms check for the requesting agent
// is not necessary.
List<GroupMembersData> groupMembers = m_groupData.GetGroupMembers(UUID.Zero.ToString(), groupID);
int groupMembersCount = groupMembers.Count;
PresenceInfo[] onlineAgents = null;

View File

@ -83,10 +83,15 @@ namespace OpenSim.Region.Framework.Interfaces
/// dialog - This must be (byte)InstantMessageDialog.SessionSend
/// </param>
/// <param name="groupID"></param>
/// <param name="sendingAgentForGroupCalls">
/// The requesting agent to use when querying the groups service. Sometimes this is different from
/// im.fromAgentID, with group notices, for example.
/// </param>
/// <param name="sendCondition">
/// The condition that must be met by a member for the message to be sent. If null then the message is sent
/// if the chat session is active.
/// </param>
void SendMessageToGroup(GridInstantMessage im, UUID groupID, Func<GroupMembersData, bool> sendCondition);
void SendMessageToGroup(
GridInstantMessage im, UUID groupID, UUID sendingAgentForGroupCalls, Func<GroupMembersData, bool> sendCondition);
}
}

View File

@ -238,15 +238,15 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
}
}
public void SendMessageToGroup(GridInstantMessage im, UUID groupID)
{
SendMessageToGroup(im, groupID, null);
SendMessageToGroup(im, groupID, new UUID(im.fromAgentID), null);
}
public void SendMessageToGroup(GridInstantMessage im, UUID groupID, Func<GroupMembersData, bool> sendCondition)
public void SendMessageToGroup(
GridInstantMessage im, UUID groupID, UUID sendingAgentForGroupCalls, Func<GroupMembersData, bool> sendCondition)
{
List<GroupMembersData> groupMembers = m_groupData.GetGroupMembers(new UUID(im.fromAgentID), groupID);
List<GroupMembersData> groupMembers = m_groupData.GetGroupMembers(sendingAgentForGroupCalls, groupID);
int groupMembersCount = groupMembers.Count;
if (m_messageOnlineAgentsOnly)
@ -489,7 +489,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
#endregion
#region ClientEvents
private void OnInstantMessage(IClientAPI remoteClient, GridInstantMessage im)
{

View File

@ -538,7 +538,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
= CreateGroupNoticeIM(UUID.Zero, NoticeID, (byte)OpenMetaverse.InstantMessageDialog.GroupNotice);
if (m_groupsMessagingModule != null)
m_groupsMessagingModule.SendMessageToGroup(msg, GroupID, gmd => gmd.AcceptNotices);
m_groupsMessagingModule.SendMessageToGroup(
msg, GroupID, remoteClient.AgentId, gmd => gmd.AcceptNotices);
}
}