aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs1
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs55
2 files changed, 56 insertions, 0 deletions
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs
index d09d3ad..62020ee 100644
--- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs
@@ -497,6 +497,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
497 OnNewGroupNotice(GroupID, NoticeID); 497 OnNewGroupNotice(GroupID, NoticeID);
498 } 498 }
499 499
500 /*** We would insert call code here ***/
500 // Send notice out to everyone that wants notices 501 // Send notice out to everyone that wants notices
501 foreach (GroupMembersData member in m_groupData.GetGroupMembers(GetRequestingAgentID(remoteClient), GroupID)) 502 foreach (GroupMembersData member in m_groupData.GetGroupMembers(GetRequestingAgentID(remoteClient), GroupID))
502 { 503 {
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs
index 26d2597..08a93b8 100644
--- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs
@@ -27,6 +27,7 @@
27 27
28using System; 28using System;
29using System.Collections; 29using System.Collections;
30using System.Collections.Generic;
30using System.Net; 31using System.Net;
31using System.Reflection; 32using System.Reflection;
32using Nini.Config; 33using Nini.Config;
@@ -118,5 +119,59 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups.Tests
118 119
119 // TODO: More checking of more actual event data. 120 // TODO: More checking of more actual event data.
120 } 121 }
122
123 [Test]
124 public void TestSendGroupNotice()
125 {
126 TestHelpers.InMethod();
127// TestHelpers.EnableLogging();
128
129 TestScene scene = new SceneHelpers().SetupScene();
130 IConfigSource configSource = new IniConfigSource();
131 IConfig config = configSource.AddConfig("Groups");
132 config.Set("Enabled", true);
133 config.Set("Module", "GroupsModule");
134 config.Set("DebugEnabled", true);
135
136 GroupsModule gm = new GroupsModule();
137
138 SceneHelpers.SetupSceneModules(scene, configSource, gm, new MockGroupsServicesConnector());
139
140 UUID userId = TestHelpers.ParseTail(0x1);
141 string subjectText = "newman";
142 string messageText = "Hello";
143 string combinedSubjectMessage = string.Format("{0}|{1}", subjectText, messageText);
144
145 ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1));
146 TestClient tc = (TestClient)sp.ControllingClient;
147
148 UUID groupID = gm.CreateGroup(tc, "group1", null, true, UUID.Zero, 0, true, true, true);
149 gm.JoinGroupRequest(tc, groupID);
150
151 // Create a second user who doesn't want to receive notices
152 ScenePresence sp2 = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x2));
153 TestClient tc2 = (TestClient)sp2.ControllingClient;
154 gm.JoinGroupRequest(tc2, groupID);
155 gm.SetGroupAcceptNotices(tc2, groupID, false, true);
156
157 List<GridInstantMessage> spReceivedMessages = new List<GridInstantMessage>();
158 tc.OnReceivedInstantMessage += im => spReceivedMessages.Add(im);
159
160 List<GridInstantMessage> sp2ReceivedMessages = new List<GridInstantMessage>();
161 tc2.OnReceivedInstantMessage += im => sp2ReceivedMessages.Add(im);
162
163 GridInstantMessage noticeIm = new GridInstantMessage();
164 noticeIm.fromAgentID = userId.Guid;
165 noticeIm.toAgentID = groupID.Guid;
166 noticeIm.message = combinedSubjectMessage;
167 noticeIm.dialog = (byte)InstantMessageDialog.GroupNotice;
168
169 tc.HandleImprovedInstantMessage(noticeIm);
170
171 Assert.That(spReceivedMessages.Count, Is.EqualTo(1));
172 Assert.That(spReceivedMessages[0].message, Is.EqualTo(combinedSubjectMessage));
173
174 Assert.That(sp2ReceivedMessages.Count, Is.EqualTo(0));
175 }
121 } 176 }
122} \ No newline at end of file 177} \ No newline at end of file