aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2014-05-19 22:06:41 +0100
committerJustin Clark-Casey (justincc)2014-05-19 22:06:41 +0100
commit3a6f3124841ee91778df1d7fa2fbda9893079c6d (patch)
treeec3f2e69b5199c448475f0e62893751ea523aa68 /OpenSim
parentTell QueryAccess explicitly whether the user is coming in via Teleport or Cro... (diff)
downloadopensim-SC-3a6f3124841ee91778df1d7fa2fbda9893079c6d.zip
opensim-SC-3a6f3124841ee91778df1d7fa2fbda9893079c6d.tar.gz
opensim-SC-3a6f3124841ee91778df1d7fa2fbda9893079c6d.tar.bz2
opensim-SC-3a6f3124841ee91778df1d7fa2fbda9893079c6d.tar.xz
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=7037
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs7
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs15
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs9
-rw-r--r--OpenSim/Tests/Common/Mock/MockGroupsServicesConnector.cs24
4 files changed, 50 insertions, 5 deletions
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs
index 26b70a1..3724a2c 100644
--- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs
@@ -315,7 +315,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
315 315
316 // Copy Message 316 // Copy Message
317 GridInstantMessage msg = new GridInstantMessage(); 317 GridInstantMessage msg = new GridInstantMessage();
318 msg.imSessionID = groupID.Guid; 318 msg.imSessionID = im.imSessionID;
319 msg.fromAgentName = im.fromAgentName; 319 msg.fromAgentName = im.fromAgentName;
320 msg.message = im.message; 320 msg.message = im.message;
321 msg.dialog = im.dialog; 321 msg.dialog = im.dialog;
@@ -420,7 +420,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
420 420
421 private void ProcessMessageFromGroupSession(GridInstantMessage msg, IClientAPI client) 421 private void ProcessMessageFromGroupSession(GridInstantMessage msg, IClientAPI client)
422 { 422 {
423 if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: Session message from {0} going to agent {1}", msg.fromAgentName, msg.toAgentID); 423 if (m_debugEnabled)
424 m_log.DebugFormat(
425 "[GROUPS-MESSAGING]: Session message from {0} going to agent {1}, sessionID {2}, type {3}",
426 msg.fromAgentName, msg.toAgentID, msg.imSessionID, (InstantMessageDialog)msg.dialog);
424 427
425 UUID AgentID = new UUID(msg.fromAgentID); 428 UUID AgentID = new UUID(msg.fromAgentID);
426 UUID GroupID = new UUID(msg.imSessionID); 429 UUID GroupID = new UUID(msg.imSessionID);
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs
index f34152c..8a9e4d2 100644
--- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs
@@ -357,7 +357,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
357 357
358 private void OnInstantMessage(IClientAPI remoteClient, GridInstantMessage im) 358 private void OnInstantMessage(IClientAPI remoteClient, GridInstantMessage im)
359 { 359 {
360 if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); 360 if (m_debugEnabled)
361 m_log.DebugFormat(
362 "[GROUPS]: {0} called for {1}, message type {2}",
363 System.Reflection.MethodBase.GetCurrentMethod().Name, remoteClient.Name, (InstantMessageDialog)im.dialog);
361 364
362 // Group invitations 365 // Group invitations
363 if ((im.dialog == (byte)InstantMessageDialog.GroupInvitationAccept) || (im.dialog == (byte)InstantMessageDialog.GroupInvitationDecline)) 366 if ((im.dialog == (byte)InstantMessageDialog.GroupInvitationAccept) || (im.dialog == (byte)InstantMessageDialog.GroupInvitationDecline))
@@ -551,6 +554,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
551 554
552 UUID noticeID = new UUID(im.imSessionID); 555 UUID noticeID = new UUID(im.imSessionID);
553 556
557 if (m_debugEnabled)
558 m_log.DebugFormat("[GROUPS]: Requesting notice {0} for {1}", noticeID, remoteClient.AgentId);
559
554 GroupNoticeInfo notice = m_groupData.GetGroupNotice(GetRequestingAgentID(remoteClient), noticeID); 560 GroupNoticeInfo notice = m_groupData.GetGroupNotice(GetRequestingAgentID(remoteClient), noticeID);
555 if (notice != null) 561 if (notice != null)
556 { 562 {
@@ -572,6 +578,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
572 578
573 remoteClient.SendInventoryItemCreateUpdate(itemCopy, 0); 579 remoteClient.SendInventoryItemCreateUpdate(itemCopy, 0);
574 } 580 }
581 else
582 {
583 if (m_debugEnabled)
584 m_log.DebugFormat(
585 "[GROUPS]: Could not find notice {0} for {1} on GroupNoticeInventoryAccepted.",
586 noticeID, remoteClient.AgentId);
587 }
575 } 588 }
576 589
577 // Interop, received special 210 code for ejecting a group member 590 // Interop, received special 210 code for ejecting a group member
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs
index b5a10af..d944087 100644
--- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs
@@ -132,6 +132,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups.Tests
132 MessageTransferModule mtm = new MessageTransferModule(); 132 MessageTransferModule mtm = new MessageTransferModule();
133 GroupsModule gm = new GroupsModule(); 133 GroupsModule gm = new GroupsModule();
134 GroupsMessagingModule gmm = new GroupsMessagingModule(); 134 GroupsMessagingModule gmm = new GroupsMessagingModule();
135 MockGroupsServicesConnector mgsc = new MockGroupsServicesConnector();
135 136
136 IConfigSource configSource = new IniConfigSource(); 137 IConfigSource configSource = new IniConfigSource();
137 138
@@ -149,7 +150,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups.Tests
149 config.Set("MessagingEnabled", true); 150 config.Set("MessagingEnabled", true);
150 } 151 }
151 152
152 SceneHelpers.SetupSceneModules(scene, configSource, new MockGroupsServicesConnector(), mtm, gm, gmm); 153 SceneHelpers.SetupSceneModules(scene, configSource, mgsc, mtm, gm, gmm);
153 154
154 UUID userId = TestHelpers.ParseTail(0x1); 155 UUID userId = TestHelpers.ParseTail(0x1);
155 string subjectText = "newman"; 156 string subjectText = "newman";
@@ -185,6 +186,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups.Tests
185 Assert.That(spReceivedMessages.Count, Is.EqualTo(1)); 186 Assert.That(spReceivedMessages.Count, Is.EqualTo(1));
186 Assert.That(spReceivedMessages[0].message, Is.EqualTo(combinedSubjectMessage)); 187 Assert.That(spReceivedMessages[0].message, Is.EqualTo(combinedSubjectMessage));
187 188
189 List<GroupNoticeData> notices = mgsc.GetGroupNotices(UUID.Zero, groupID);
190 Assert.AreEqual(1, notices.Count);
191
192 // OpenSimulator (possibly also SL) transport the notice ID as the session ID!
193 Assert.AreEqual(notices[0].NoticeID.Guid, spReceivedMessages[0].imSessionID);
194
188 Assert.That(sp2ReceivedMessages.Count, Is.EqualTo(0)); 195 Assert.That(sp2ReceivedMessages.Count, Is.EqualTo(0));
189 } 196 }
190 197
diff --git a/OpenSim/Tests/Common/Mock/MockGroupsServicesConnector.cs b/OpenSim/Tests/Common/Mock/MockGroupsServicesConnector.cs
index b3f8c36..5a257e9 100644
--- a/OpenSim/Tests/Common/Mock/MockGroupsServicesConnector.cs
+++ b/OpenSim/Tests/Common/Mock/MockGroupsServicesConnector.cs
@@ -324,7 +324,29 @@ namespace OpenSim.Tests.Common.Mock
324 324
325 public List<GroupNoticeData> GetGroupNotices(UUID requestingAgentID, UUID groupID) 325 public List<GroupNoticeData> GetGroupNotices(UUID requestingAgentID, UUID groupID)
326 { 326 {
327 return null; 327 XGroup group = GetXGroup(groupID, null);
328
329 if (group == null)
330 return null;
331
332 List<GroupNoticeData> notices = new List<GroupNoticeData>();
333
334 foreach (XGroupNotice notice in group.notices.Values)
335 {
336 GroupNoticeData gnd = new GroupNoticeData()
337 {
338 NoticeID = notice.noticeID,
339 Timestamp = notice.timestamp,
340 FromName = notice.fromName,
341 Subject = notice.subject,
342 HasAttachment = notice.hasAttachment,
343 AssetType = (byte)notice.assetType
344 };
345
346 notices.Add(gnd);
347 }
348
349 return notices;
328 } 350 }
329 351
330 public GroupNoticeInfo GetGroupNotice(UUID requestingAgentID, UUID noticeID) 352 public GroupNoticeInfo GetGroupNotice(UUID requestingAgentID, UUID noticeID)