Fix recent regression from 77e7bbc
where an attachment on a received group notice with XmlRpcGroups messaging did not appear in the user's inventory.
This was because the "session ID" when the message template was copied was always replaced with the group ID, whereas a notice requires this to be the notice ID. Instead just copy the "session ID" as is - other callers already have this set properly so replacing with group ID was redundant anyway. Relates to http://opensimulator.org/mantis/view.php?id=7037bullet-2.82
parent
47b84875fd
commit
3a6f312484
|
@ -315,7 +315,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
|||
|
||||
// Copy Message
|
||||
GridInstantMessage msg = new GridInstantMessage();
|
||||
msg.imSessionID = groupID.Guid;
|
||||
msg.imSessionID = im.imSessionID;
|
||||
msg.fromAgentName = im.fromAgentName;
|
||||
msg.message = im.message;
|
||||
msg.dialog = im.dialog;
|
||||
|
@ -420,7 +420,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
|||
|
||||
private void ProcessMessageFromGroupSession(GridInstantMessage msg, IClientAPI client)
|
||||
{
|
||||
if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: Session message from {0} going to agent {1}", msg.fromAgentName, msg.toAgentID);
|
||||
if (m_debugEnabled)
|
||||
m_log.DebugFormat(
|
||||
"[GROUPS-MESSAGING]: Session message from {0} going to agent {1}, sessionID {2}, type {3}",
|
||||
msg.fromAgentName, msg.toAgentID, msg.imSessionID, (InstantMessageDialog)msg.dialog);
|
||||
|
||||
UUID AgentID = new UUID(msg.fromAgentID);
|
||||
UUID GroupID = new UUID(msg.imSessionID);
|
||||
|
|
|
@ -357,7 +357,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
|||
|
||||
private void OnInstantMessage(IClientAPI remoteClient, GridInstantMessage im)
|
||||
{
|
||||
if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
|
||||
if (m_debugEnabled)
|
||||
m_log.DebugFormat(
|
||||
"[GROUPS]: {0} called for {1}, message type {2}",
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name, remoteClient.Name, (InstantMessageDialog)im.dialog);
|
||||
|
||||
// Group invitations
|
||||
if ((im.dialog == (byte)InstantMessageDialog.GroupInvitationAccept) || (im.dialog == (byte)InstantMessageDialog.GroupInvitationDecline))
|
||||
|
@ -551,6 +554,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
|||
|
||||
UUID noticeID = new UUID(im.imSessionID);
|
||||
|
||||
if (m_debugEnabled)
|
||||
m_log.DebugFormat("[GROUPS]: Requesting notice {0} for {1}", noticeID, remoteClient.AgentId);
|
||||
|
||||
GroupNoticeInfo notice = m_groupData.GetGroupNotice(GetRequestingAgentID(remoteClient), noticeID);
|
||||
if (notice != null)
|
||||
{
|
||||
|
@ -572,6 +578,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
|||
|
||||
remoteClient.SendInventoryItemCreateUpdate(itemCopy, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_debugEnabled)
|
||||
m_log.DebugFormat(
|
||||
"[GROUPS]: Could not find notice {0} for {1} on GroupNoticeInventoryAccepted.",
|
||||
noticeID, remoteClient.AgentId);
|
||||
}
|
||||
}
|
||||
|
||||
// Interop, received special 210 code for ejecting a group member
|
||||
|
|
|
@ -132,6 +132,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups.Tests
|
|||
MessageTransferModule mtm = new MessageTransferModule();
|
||||
GroupsModule gm = new GroupsModule();
|
||||
GroupsMessagingModule gmm = new GroupsMessagingModule();
|
||||
MockGroupsServicesConnector mgsc = new MockGroupsServicesConnector();
|
||||
|
||||
IConfigSource configSource = new IniConfigSource();
|
||||
|
||||
|
@ -149,7 +150,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups.Tests
|
|||
config.Set("MessagingEnabled", true);
|
||||
}
|
||||
|
||||
SceneHelpers.SetupSceneModules(scene, configSource, new MockGroupsServicesConnector(), mtm, gm, gmm);
|
||||
SceneHelpers.SetupSceneModules(scene, configSource, mgsc, mtm, gm, gmm);
|
||||
|
||||
UUID userId = TestHelpers.ParseTail(0x1);
|
||||
string subjectText = "newman";
|
||||
|
@ -185,6 +186,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups.Tests
|
|||
Assert.That(spReceivedMessages.Count, Is.EqualTo(1));
|
||||
Assert.That(spReceivedMessages[0].message, Is.EqualTo(combinedSubjectMessage));
|
||||
|
||||
List<GroupNoticeData> notices = mgsc.GetGroupNotices(UUID.Zero, groupID);
|
||||
Assert.AreEqual(1, notices.Count);
|
||||
|
||||
// OpenSimulator (possibly also SL) transport the notice ID as the session ID!
|
||||
Assert.AreEqual(notices[0].NoticeID.Guid, spReceivedMessages[0].imSessionID);
|
||||
|
||||
Assert.That(sp2ReceivedMessages.Count, Is.EqualTo(0));
|
||||
}
|
||||
|
||||
|
|
|
@ -324,7 +324,29 @@ namespace OpenSim.Tests.Common.Mock
|
|||
|
||||
public List<GroupNoticeData> GetGroupNotices(UUID requestingAgentID, UUID groupID)
|
||||
{
|
||||
return null;
|
||||
XGroup group = GetXGroup(groupID, null);
|
||||
|
||||
if (group == null)
|
||||
return null;
|
||||
|
||||
List<GroupNoticeData> notices = new List<GroupNoticeData>();
|
||||
|
||||
foreach (XGroupNotice notice in group.notices.Values)
|
||||
{
|
||||
GroupNoticeData gnd = new GroupNoticeData()
|
||||
{
|
||||
NoticeID = notice.noticeID,
|
||||
Timestamp = notice.timestamp,
|
||||
FromName = notice.fromName,
|
||||
Subject = notice.subject,
|
||||
HasAttachment = notice.hasAttachment,
|
||||
AssetType = (byte)notice.assetType
|
||||
};
|
||||
|
||||
notices.Add(gnd);
|
||||
}
|
||||
|
||||
return notices;
|
||||
}
|
||||
|
||||
public GroupNoticeInfo GetGroupNotice(UUID requestingAgentID, UUID noticeID)
|
||||
|
|
Loading…
Reference in New Issue