diff options
author | Melanie | 2010-05-21 02:44:20 +0100 |
---|---|---|
committer | Melanie | 2010-05-21 02:44:20 +0100 |
commit | ddd072b3fb9d97888bdd5e2d5142d05d8b13e763 (patch) | |
tree | c456346894f55ee91b11b6c349604c370f8c83f5 /OpenSim | |
parent | Change the way the object perms are propagated to attempt to salvage (diff) | |
parent | back port groups changes (diff) | |
download | opensim-SC_OLD-ddd072b3fb9d97888bdd5e2d5142d05d8b13e763.zip opensim-SC_OLD-ddd072b3fb9d97888bdd5e2d5142d05d8b13e763.tar.gz opensim-SC_OLD-ddd072b3fb9d97888bdd5e2d5142d05d8b13e763.tar.bz2 opensim-SC_OLD-ddd072b3fb9d97888bdd5e2d5142d05d8b13e763.tar.xz |
Merge branch '0.6.9-post-fixes' into careminster
Diffstat (limited to 'OpenSim')
5 files changed, 542 insertions, 443 deletions
diff --git a/OpenSim/Region/Framework/Interfaces/IGroupsMessagingModule.cs b/OpenSim/Region/Framework/Interfaces/IGroupsMessagingModule.cs new file mode 100644 index 0000000..f158236 --- /dev/null +++ b/OpenSim/Region/Framework/Interfaces/IGroupsMessagingModule.cs | |||
@@ -0,0 +1,73 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using OpenMetaverse; | ||
29 | using OpenSim.Framework; | ||
30 | |||
31 | namespace OpenSim.Region.Framework.Interfaces | ||
32 | { | ||
33 | /// <summary> | ||
34 | /// Provide mechanisms for messaging groups. | ||
35 | /// </summary> | ||
36 | /// | ||
37 | /// TODO: Provide a mechanism for receiving group messages as well as sending them | ||
38 | /// | ||
39 | public interface IGroupsMessagingModule | ||
40 | { | ||
41 | /// <summary> | ||
42 | /// Start a group chat session. | ||
43 | /// </summary> | ||
44 | /// You must call this before calling SendMessageToGroup(). If a chat session for this group is already taking | ||
45 | /// place then the agent will added to that session. | ||
46 | /// <param name="agentID"> | ||
47 | /// A UUID that represents the agent being added. If you are agentless (e.g. you are | ||
48 | /// a region module), then you can use any random ID. | ||
49 | /// </param> | ||
50 | /// <param name="groupID"> | ||
51 | /// The ID for the group to join. Currently, the session ID used is identical to the | ||
52 | /// group ID. | ||
53 | /// </param> | ||
54 | /// <returns> | ||
55 | /// True if the chat session was started successfully, false otherwise. | ||
56 | /// </returns> | ||
57 | bool StartGroupChatSession(UUID agentID, UUID groupID); | ||
58 | |||
59 | /// <summary> | ||
60 | /// Send a message to an entire group. | ||
61 | /// </summary> | ||
62 | /// <param name="im"> | ||
63 | /// The message itself. The fields that must be populated are | ||
64 | /// | ||
65 | /// imSessionID - Populate this with the group ID (session ID and group ID are currently identical) | ||
66 | /// fromAgentName - Populate this with whatever arbitrary name you want to show up in the chat dialog | ||
67 | /// message - The message itself | ||
68 | /// dialog - This must be (byte)InstantMessageDialog.SessionSend | ||
69 | /// </param> | ||
70 | /// <param name="groupID"></param> | ||
71 | void SendMessageToGroup(GridInstantMessage im, UUID groupID); | ||
72 | } | ||
73 | } \ No newline at end of file | ||
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs index 00fe5df..06aad91 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs | |||
@@ -28,41 +28,30 @@ | |||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Reflection; | 30 | using System.Reflection; |
31 | |||
32 | |||
33 | using log4net; | 31 | using log4net; |
34 | using Mono.Addins; | 32 | using Mono.Addins; |
35 | using Nini.Config; | 33 | using Nini.Config; |
36 | |||
37 | using OpenMetaverse; | 34 | using OpenMetaverse; |
38 | using OpenMetaverse.StructuredData; | 35 | using OpenMetaverse.StructuredData; |
39 | |||
40 | using OpenSim.Framework; | 36 | using OpenSim.Framework; |
41 | using OpenSim.Region.CoreModules.Framework.EventQueue; | 37 | using OpenSim.Region.CoreModules.Framework.EventQueue; |
42 | using OpenSim.Region.Framework.Interfaces; | 38 | using OpenSim.Region.Framework.Interfaces; |
43 | using OpenSim.Region.Framework.Scenes; | 39 | using OpenSim.Region.Framework.Scenes; |
44 | 40 | ||
45 | |||
46 | using Caps = OpenSim.Framework.Capabilities.Caps; | 41 | using Caps = OpenSim.Framework.Capabilities.Caps; |
47 | 42 | ||
48 | namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | 43 | namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups |
49 | { | 44 | { |
50 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] | 45 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] |
51 | public class GroupsMessagingModule : ISharedRegionModule | 46 | public class GroupsMessagingModule : ISharedRegionModule, IGroupsMessagingModule |
52 | { | 47 | { |
53 | |||
54 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 48 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
55 | 49 | ||
56 | private List<Scene> m_sceneList = new List<Scene>(); | 50 | private List<Scene> m_sceneList = new List<Scene>(); |
57 | 51 | ||
58 | private IMessageTransferModule m_msgTransferModule = null; | 52 | private IMessageTransferModule m_msgTransferModule = null; |
59 | 53 | ||
60 | private IGroupsModule m_groupsModule = null; | 54 | private IGroupsServicesConnector m_groupData = null; |
61 | |||
62 | // TODO: Move this off to the Groups Server | ||
63 | public Dictionary<Guid, List<Guid>> m_agentsInGroupSession = new Dictionary<Guid, List<Guid>>(); | ||
64 | public Dictionary<Guid, List<Guid>> m_agentsDroppedSession = new Dictionary<Guid, List<Guid>>(); | ||
65 | |||
66 | 55 | ||
67 | // Config Options | 56 | // Config Options |
68 | private bool m_groupMessagingEnabled = false; | 57 | private bool m_groupMessagingEnabled = false; |
@@ -108,8 +97,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
108 | 97 | ||
109 | public void AddRegion(Scene scene) | 98 | public void AddRegion(Scene scene) |
110 | { | 99 | { |
111 | // NoOp | 100 | if (!m_groupMessagingEnabled) |
101 | return; | ||
102 | |||
103 | scene.RegisterModuleInterface<IGroupsMessagingModule>(this); | ||
112 | } | 104 | } |
105 | |||
113 | public void RegionLoaded(Scene scene) | 106 | public void RegionLoaded(Scene scene) |
114 | { | 107 | { |
115 | if (!m_groupMessagingEnabled) | 108 | if (!m_groupMessagingEnabled) |
@@ -117,12 +110,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
117 | 110 | ||
118 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 111 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); |
119 | 112 | ||
120 | m_groupsModule = scene.RequestModuleInterface<IGroupsModule>(); | 113 | m_groupData = scene.RequestModuleInterface<IGroupsServicesConnector>(); |
121 | 114 | ||
122 | // No groups module, no groups messaging | 115 | // No groups module, no groups messaging |
123 | if (m_groupsModule == null) | 116 | if (m_groupData == null) |
124 | { | 117 | { |
125 | m_log.Error("[GROUPS-MESSAGING]: Could not get IGroupsModule, GroupsMessagingModule is now disabled."); | 118 | m_log.Error("[GROUPS-MESSAGING]: Could not get IGroupsServicesConnector, GroupsMessagingModule is now disabled."); |
126 | Close(); | 119 | Close(); |
127 | m_groupMessagingEnabled = false; | 120 | m_groupMessagingEnabled = false; |
128 | return; | 121 | return; |
@@ -144,7 +137,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
144 | 137 | ||
145 | scene.EventManager.OnNewClient += OnNewClient; | 138 | scene.EventManager.OnNewClient += OnNewClient; |
146 | scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage; | 139 | scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage; |
147 | |||
148 | } | 140 | } |
149 | 141 | ||
150 | public void RemoveRegion(Scene scene) | 142 | public void RemoveRegion(Scene scene) |
@@ -172,7 +164,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
172 | 164 | ||
173 | m_sceneList.Clear(); | 165 | m_sceneList.Clear(); |
174 | 166 | ||
175 | m_groupsModule = null; | 167 | m_groupData = null; |
176 | m_msgTransferModule = null; | 168 | m_msgTransferModule = null; |
177 | } | 169 | } |
178 | 170 | ||
@@ -197,6 +189,75 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
197 | 189 | ||
198 | #endregion | 190 | #endregion |
199 | 191 | ||
192 | /// <summary> | ||
193 | /// Not really needed, but does confirm that the group exists. | ||
194 | /// </summary> | ||
195 | public bool StartGroupChatSession(UUID agentID, UUID groupID) | ||
196 | { | ||
197 | if (m_debugEnabled) | ||
198 | m_log.DebugFormat("[GROUPS-MESSAGING]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | ||
199 | |||
200 | GroupRecord groupInfo = m_groupData.GetGroupRecord(agentID, groupID, null); | ||
201 | |||
202 | if (groupInfo != null) | ||
203 | { | ||
204 | return true; | ||
205 | } | ||
206 | else | ||
207 | { | ||
208 | return false; | ||
209 | } | ||
210 | } | ||
211 | |||
212 | public void SendMessageToGroup(GridInstantMessage im, UUID groupID) | ||
213 | { | ||
214 | if (m_debugEnabled) | ||
215 | m_log.DebugFormat("[GROUPS-MESSAGING]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | ||
216 | |||
217 | |||
218 | foreach (GroupMembersData member in m_groupData.GetGroupMembers(UUID.Zero, groupID)) | ||
219 | { | ||
220 | if (m_groupData.hasAgentDroppedGroupChatSession(member.AgentID, groupID)) | ||
221 | { | ||
222 | // Don't deliver messages to people who have dropped this session | ||
223 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: {0} has dropped session, not delivering to them", member.AgentID); | ||
224 | continue; | ||
225 | } | ||
226 | |||
227 | // Copy Message | ||
228 | GridInstantMessage msg = new GridInstantMessage(); | ||
229 | msg.imSessionID = groupID.Guid; | ||
230 | msg.fromAgentName = im.fromAgentName; | ||
231 | msg.message = im.message; | ||
232 | msg.dialog = im.dialog; | ||
233 | msg.offline = im.offline; | ||
234 | msg.ParentEstateID = im.ParentEstateID; | ||
235 | msg.Position = im.Position; | ||
236 | msg.RegionID = im.RegionID; | ||
237 | msg.binaryBucket = im.binaryBucket; | ||
238 | msg.timestamp = (uint)Util.UnixTimeSinceEpoch(); | ||
239 | |||
240 | msg.fromAgentID = im.fromAgentID; | ||
241 | msg.fromGroup = true; | ||
242 | |||
243 | msg.toAgentID = member.AgentID.Guid; | ||
244 | |||
245 | IClientAPI client = GetActiveClient(member.AgentID); | ||
246 | if (client == null) | ||
247 | { | ||
248 | // If they're not local, forward across the grid | ||
249 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: Delivering to {0} via Grid", member.AgentID); | ||
250 | m_msgTransferModule.SendInstantMessage(msg, delegate(bool success) { }); | ||
251 | } | ||
252 | else | ||
253 | { | ||
254 | // Deliver locally, directly | ||
255 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: Passing to ProcessMessageFromGroupSession to deliver to {0} locally", client.Name); | ||
256 | ProcessMessageFromGroupSession(msg); | ||
257 | } | ||
258 | } | ||
259 | } | ||
260 | |||
200 | #region SimGridEventHandlers | 261 | #region SimGridEventHandlers |
201 | 262 | ||
202 | private void OnNewClient(IClientAPI client) | 263 | private void OnNewClient(IClientAPI client) |
@@ -236,42 +297,46 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
236 | { | 297 | { |
237 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: Session message from {0} going to agent {1}", msg.fromAgentName, msg.toAgentID); | 298 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: Session message from {0} going to agent {1}", msg.fromAgentName, msg.toAgentID); |
238 | 299 | ||
300 | UUID AgentID = new UUID(msg.fromAgentID); | ||
301 | UUID GroupID = new UUID(msg.imSessionID); | ||
302 | |||
239 | switch (msg.dialog) | 303 | switch (msg.dialog) |
240 | { | 304 | { |
241 | case (byte)InstantMessageDialog.SessionAdd: | 305 | case (byte)InstantMessageDialog.SessionAdd: |
242 | AddAgentToGroupSession(msg.fromAgentID, msg.imSessionID); | 306 | m_groupData.AgentInvitedToGroupChatSession(AgentID, GroupID); |
243 | break; | 307 | break; |
244 | 308 | ||
245 | case (byte)InstantMessageDialog.SessionDrop: | 309 | case (byte)InstantMessageDialog.SessionDrop: |
246 | RemoveAgentFromGroupSession(msg.fromAgentID, msg.imSessionID); | 310 | m_groupData.AgentDroppedFromGroupChatSession(AgentID, GroupID); |
247 | break; | 311 | break; |
248 | 312 | ||
249 | case (byte)InstantMessageDialog.SessionSend: | 313 | case (byte)InstantMessageDialog.SessionSend: |
250 | if (!m_agentsInGroupSession.ContainsKey(msg.toAgentID) | 314 | if (!m_groupData.hasAgentDroppedGroupChatSession(AgentID, GroupID) |
251 | && !m_agentsDroppedSession.ContainsKey(msg.toAgentID)) | 315 | && !m_groupData.hasAgentBeenInvitedToGroupChatSession(AgentID, GroupID) |
316 | ) | ||
252 | { | 317 | { |
253 | // Agent not in session and hasn't dropped from session | 318 | // Agent not in session and hasn't dropped from session |
254 | // Add them to the session for now, and Invite them | 319 | // Add them to the session for now, and Invite them |
255 | AddAgentToGroupSession(msg.toAgentID, msg.imSessionID); | 320 | m_groupData.AgentInvitedToGroupChatSession(AgentID, GroupID); |
256 | 321 | ||
257 | UUID toAgentID = new UUID(msg.toAgentID); | 322 | UUID toAgentID = new UUID(msg.toAgentID); |
258 | IClientAPI activeClient = GetActiveClient(toAgentID); | 323 | IClientAPI activeClient = GetActiveClient(toAgentID); |
259 | if (activeClient != null) | 324 | if (activeClient != null) |
260 | { | 325 | { |
261 | UUID groupID = new UUID(msg.fromAgentID); | 326 | GroupRecord groupInfo = m_groupData.GetGroupRecord(UUID.Zero, GroupID, null); |
262 | |||
263 | GroupRecord groupInfo = m_groupsModule.GetGroupRecord(groupID); | ||
264 | if (groupInfo != null) | 327 | if (groupInfo != null) |
265 | { | 328 | { |
266 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: Sending chatterbox invite instant message"); | 329 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: Sending chatterbox invite instant message"); |
267 | 330 | ||
268 | // Force? open the group session dialog??? | 331 | // Force? open the group session dialog??? |
332 | // and simultanously deliver the message, so we don't need to do a seperate client.SendInstantMessage(msg); | ||
269 | IEventQueue eq = activeClient.Scene.RequestModuleInterface<IEventQueue>(); | 333 | IEventQueue eq = activeClient.Scene.RequestModuleInterface<IEventQueue>(); |
270 | eq.ChatterboxInvitation( | 334 | eq.ChatterboxInvitation( |
271 | groupID | 335 | GroupID |
272 | , groupInfo.GroupName | 336 | , groupInfo.GroupName |
273 | , new UUID(msg.fromAgentID) | 337 | , new UUID(msg.fromAgentID) |
274 | , msg.message, new UUID(msg.toAgentID) | 338 | , msg.message |
339 | , new UUID(msg.toAgentID) | ||
275 | , msg.fromAgentName | 340 | , msg.fromAgentName |
276 | , msg.dialog | 341 | , msg.dialog |
277 | , msg.timestamp | 342 | , msg.timestamp |
@@ -285,7 +350,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
285 | ); | 350 | ); |
286 | 351 | ||
287 | eq.ChatterBoxSessionAgentListUpdates( | 352 | eq.ChatterBoxSessionAgentListUpdates( |
288 | new UUID(groupID) | 353 | new UUID(GroupID) |
289 | , new UUID(msg.fromAgentID) | 354 | , new UUID(msg.fromAgentID) |
290 | , new UUID(msg.toAgentID) | 355 | , new UUID(msg.toAgentID) |
291 | , false //canVoiceChat | 356 | , false //canVoiceChat |
@@ -295,7 +360,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
295 | } | 360 | } |
296 | } | 361 | } |
297 | } | 362 | } |
298 | else if (!m_agentsDroppedSession.ContainsKey(msg.toAgentID)) | 363 | else if (!m_groupData.hasAgentDroppedGroupChatSession(AgentID, GroupID)) |
299 | { | 364 | { |
300 | // User hasn't dropped, so they're in the session, | 365 | // User hasn't dropped, so they're in the session, |
301 | // maybe we should deliver it. | 366 | // maybe we should deliver it. |
@@ -321,56 +386,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
321 | 386 | ||
322 | #endregion | 387 | #endregion |
323 | 388 | ||
324 | #region ClientEvents | ||
325 | |||
326 | private void RemoveAgentFromGroupSession(Guid agentID, Guid sessionID) | ||
327 | { | ||
328 | if (m_agentsInGroupSession.ContainsKey(sessionID)) | ||
329 | { | ||
330 | // If in session remove | ||
331 | if (m_agentsInGroupSession[sessionID].Contains(agentID)) | ||
332 | { | ||
333 | m_agentsInGroupSession[sessionID].Remove(agentID); | ||
334 | } | ||
335 | |||
336 | // If not in dropped list, add | ||
337 | if (!m_agentsDroppedSession[sessionID].Contains(agentID)) | ||
338 | { | ||
339 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: Dropped {1} from session {0}", sessionID, agentID); | ||
340 | m_agentsDroppedSession[sessionID].Add(agentID); | ||
341 | } | ||
342 | } | ||
343 | } | ||
344 | |||
345 | private void AddAgentToGroupSession(Guid agentID, Guid sessionID) | ||
346 | { | ||
347 | // Add Session Status if it doesn't exist for this session | ||
348 | CreateGroupSessionTracking(sessionID); | ||
349 | |||
350 | // If nessesary, remove from dropped list | ||
351 | if (m_agentsDroppedSession[sessionID].Contains(agentID)) | ||
352 | { | ||
353 | m_agentsDroppedSession[sessionID].Remove(agentID); | ||
354 | } | ||
355 | |||
356 | // If nessesary, add to in session list | ||
357 | if (!m_agentsInGroupSession[sessionID].Contains(agentID)) | ||
358 | { | ||
359 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: Added {1} to session {0}", sessionID, agentID); | ||
360 | m_agentsInGroupSession[sessionID].Add(agentID); | ||
361 | } | ||
362 | } | ||
363 | |||
364 | private void CreateGroupSessionTracking(Guid sessionID) | ||
365 | { | ||
366 | if (!m_agentsInGroupSession.ContainsKey(sessionID)) | ||
367 | { | ||
368 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: Creating session tracking for : {0}", sessionID); | ||
369 | m_agentsInGroupSession.Add(sessionID, new List<Guid>()); | ||
370 | m_agentsDroppedSession.Add(sessionID, new List<Guid>()); | ||
371 | } | ||
372 | } | ||
373 | 389 | ||
390 | #region ClientEvents | ||
374 | private void OnInstantMessage(IClientAPI remoteClient, GridInstantMessage im) | 391 | private void OnInstantMessage(IClientAPI remoteClient, GridInstantMessage im) |
375 | { | 392 | { |
376 | if (m_debugEnabled) | 393 | if (m_debugEnabled) |
@@ -383,21 +400,23 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
383 | // Start group IM session | 400 | // Start group IM session |
384 | if ((im.dialog == (byte)InstantMessageDialog.SessionGroupStart)) | 401 | if ((im.dialog == (byte)InstantMessageDialog.SessionGroupStart)) |
385 | { | 402 | { |
386 | UUID groupID = new UUID(im.toAgentID); | 403 | if (m_debugEnabled) m_log.InfoFormat("[GROUPS-MESSAGING]: imSessionID({0}) toAgentID({1})", im.imSessionID, im.toAgentID); |
387 | 404 | ||
388 | GroupRecord groupInfo = m_groupsModule.GetGroupRecord(groupID); | 405 | UUID GroupID = new UUID(im.imSessionID); |
406 | UUID AgentID = new UUID(im.fromAgentID); | ||
407 | |||
408 | GroupRecord groupInfo = m_groupData.GetGroupRecord(UUID.Zero, GroupID, null); | ||
409 | |||
389 | if (groupInfo != null) | 410 | if (groupInfo != null) |
390 | { | 411 | { |
391 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: Start Group Session for {0}", groupInfo.GroupName); | 412 | m_groupData.AgentInvitedToGroupChatSession(AgentID, GroupID); |
392 | |||
393 | AddAgentToGroupSession(im.fromAgentID, im.imSessionID); | ||
394 | 413 | ||
395 | ChatterBoxSessionStartReplyViaCaps(remoteClient, groupInfo.GroupName, groupID); | 414 | ChatterBoxSessionStartReplyViaCaps(remoteClient, groupInfo.GroupName, GroupID); |
396 | 415 | ||
397 | IEventQueue queue = remoteClient.Scene.RequestModuleInterface<IEventQueue>(); | 416 | IEventQueue queue = remoteClient.Scene.RequestModuleInterface<IEventQueue>(); |
398 | queue.ChatterBoxSessionAgentListUpdates( | 417 | queue.ChatterBoxSessionAgentListUpdates( |
399 | new UUID(groupID) | 418 | GroupID |
400 | , new UUID(im.fromAgentID) | 419 | , AgentID |
401 | , new UUID(im.toAgentID) | 420 | , new UUID(im.toAgentID) |
402 | , false //canVoiceChat | 421 | , false //canVoiceChat |
403 | , false //isModerator | 422 | , false //isModerator |
@@ -409,64 +428,21 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
409 | // Send a message from locally connected client to a group | 428 | // Send a message from locally connected client to a group |
410 | if ((im.dialog == (byte)InstantMessageDialog.SessionSend)) | 429 | if ((im.dialog == (byte)InstantMessageDialog.SessionSend)) |
411 | { | 430 | { |
412 | UUID groupID = new UUID(im.toAgentID); | 431 | UUID GroupID = new UUID(im.imSessionID); |
432 | UUID AgentID = new UUID(im.fromAgentID); | ||
413 | 433 | ||
414 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: Send message to session for group {0} with session ID {1}", groupID, im.imSessionID.ToString()); | 434 | if (m_debugEnabled) |
435 | m_log.DebugFormat("[GROUPS-MESSAGING]: Send message to session for group {0} with session ID {1}", GroupID, im.imSessionID.ToString()); | ||
415 | 436 | ||
416 | SendMessageToGroup(im, groupID); | 437 | //If this agent is sending a message, then they want to be in the session |
438 | m_groupData.AgentInvitedToGroupChatSession(AgentID, GroupID); | ||
439 | |||
440 | SendMessageToGroup(im, GroupID); | ||
417 | } | 441 | } |
418 | } | 442 | } |
419 | 443 | ||
420 | #endregion | 444 | #endregion |
421 | 445 | ||
422 | private void SendMessageToGroup(GridInstantMessage im, UUID groupID) | ||
423 | { | ||
424 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | ||
425 | |||
426 | foreach (GroupMembersData member in m_groupsModule.GroupMembersRequest(null, groupID)) | ||
427 | { | ||
428 | if (!m_agentsDroppedSession.ContainsKey(im.imSessionID) || m_agentsDroppedSession[im.imSessionID].Contains(member.AgentID.Guid)) | ||
429 | { | ||
430 | // Don't deliver messages to people who have dropped this session | ||
431 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: {0} has dropped session, not delivering to them", member.AgentID); | ||
432 | continue; | ||
433 | } | ||
434 | |||
435 | // Copy Message | ||
436 | GridInstantMessage msg = new GridInstantMessage(); | ||
437 | msg.imSessionID = im.imSessionID; | ||
438 | msg.fromAgentName = im.fromAgentName; | ||
439 | msg.message = im.message; | ||
440 | msg.dialog = im.dialog; | ||
441 | msg.offline = im.offline; | ||
442 | msg.ParentEstateID = im.ParentEstateID; | ||
443 | msg.Position = im.Position; | ||
444 | msg.RegionID = im.RegionID; | ||
445 | msg.binaryBucket = im.binaryBucket; | ||
446 | msg.timestamp = (uint)Util.UnixTimeSinceEpoch(); | ||
447 | |||
448 | // Updat Pertinate fields to make it a "group message" | ||
449 | msg.fromAgentID = groupID.Guid; | ||
450 | msg.fromGroup = true; | ||
451 | |||
452 | msg.toAgentID = member.AgentID.Guid; | ||
453 | |||
454 | IClientAPI client = GetActiveClient(member.AgentID); | ||
455 | if (client == null) | ||
456 | { | ||
457 | // If they're not local, forward across the grid | ||
458 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: Delivering to {0} via Grid", member.AgentID); | ||
459 | m_msgTransferModule.SendInstantMessage(msg, delegate(bool success) { }); | ||
460 | } | ||
461 | else | ||
462 | { | ||
463 | // Deliver locally, directly | ||
464 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: Passing to ProcessMessageFromGroupSession to deliver to {0} locally", client.Name); | ||
465 | ProcessMessageFromGroupSession(msg); | ||
466 | } | ||
467 | } | ||
468 | } | ||
469 | |||
470 | void ChatterBoxSessionStartReplyViaCaps(IClientAPI remoteClient, string groupName, UUID groupID) | 446 | void ChatterBoxSessionStartReplyViaCaps(IClientAPI remoteClient, string groupName, UUID groupID) |
471 | { | 447 | { |
472 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 448 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); |
@@ -518,6 +494,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
518 | /// </summary> | 494 | /// </summary> |
519 | private IClientAPI GetActiveClient(UUID agentID) | 495 | private IClientAPI GetActiveClient(UUID agentID) |
520 | { | 496 | { |
497 | if (m_debugEnabled) m_log.WarnFormat("[GROUPS-MESSAGING]: Looking for local client {0}", agentID); | ||
498 | |||
521 | IClientAPI child = null; | 499 | IClientAPI child = null; |
522 | 500 | ||
523 | // Try root avatar first | 501 | // Try root avatar first |
@@ -529,16 +507,26 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
529 | ScenePresence user = (ScenePresence)scene.Entities[agentID]; | 507 | ScenePresence user = (ScenePresence)scene.Entities[agentID]; |
530 | if (!user.IsChildAgent) | 508 | if (!user.IsChildAgent) |
531 | { | 509 | { |
510 | if (m_debugEnabled) m_log.WarnFormat("[GROUPS-MESSAGING]: Found root agent for client : {0}", user.ControllingClient.Name); | ||
532 | return user.ControllingClient; | 511 | return user.ControllingClient; |
533 | } | 512 | } |
534 | else | 513 | else |
535 | { | 514 | { |
515 | if (m_debugEnabled) m_log.WarnFormat("[GROUPS-MESSAGING]: Found child agent for client : {0}", user.ControllingClient.Name); | ||
536 | child = user.ControllingClient; | 516 | child = user.ControllingClient; |
537 | } | 517 | } |
538 | } | 518 | } |
539 | } | 519 | } |
540 | 520 | ||
541 | // If we didn't find a root, then just return whichever child we found, or null if none | 521 | // If we didn't find a root, then just return whichever child we found, or null if none |
522 | if (child == null) | ||
523 | { | ||
524 | if (m_debugEnabled) m_log.WarnFormat("[GROUPS-MESSAGING]: Could not find local client for agent : {0}", agentID); | ||
525 | } | ||
526 | else | ||
527 | { | ||
528 | if (m_debugEnabled) m_log.WarnFormat("[GROUPS-MESSAGING]: Returning child agent for client : {0}", child.Name); | ||
529 | } | ||
542 | return child; | 530 | return child; |
543 | } | 531 | } |
544 | 532 | ||
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs index 8d32e66..edd5af7 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs | |||
@@ -87,16 +87,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
87 | 87 | ||
88 | private IGroupsServicesConnector m_groupData = null; | 88 | private IGroupsServicesConnector m_groupData = null; |
89 | 89 | ||
90 | class GroupRequestIDInfo | ||
91 | { | ||
92 | public GroupRequestID RequestID = new GroupRequestID(); | ||
93 | public DateTime LastUsedTMStamp = DateTime.MinValue; | ||
94 | } | ||
95 | private Dictionary<UUID, GroupRequestIDInfo> m_clientRequestIDInfo = new Dictionary<UUID, GroupRequestIDInfo>(); | ||
96 | private const int m_clientRequestIDFlushTimeOut = 300000; // Every 5 minutes | ||
97 | private Timer m_clientRequestIDFlushTimer; | ||
98 | |||
99 | |||
100 | // Configuration settings | 90 | // Configuration settings |
101 | private bool m_groupsEnabled = false; | 91 | private bool m_groupsEnabled = false; |
102 | private bool m_groupNoticesEnabled = true; | 92 | private bool m_groupNoticesEnabled = true; |
@@ -133,30 +123,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
133 | m_groupNoticesEnabled = groupsConfig.GetBoolean("NoticesEnabled", true); | 123 | m_groupNoticesEnabled = groupsConfig.GetBoolean("NoticesEnabled", true); |
134 | m_debugEnabled = groupsConfig.GetBoolean("DebugEnabled", true); | 124 | m_debugEnabled = groupsConfig.GetBoolean("DebugEnabled", true); |
135 | 125 | ||
136 | m_clientRequestIDFlushTimer = new Timer(); | ||
137 | m_clientRequestIDFlushTimer.Interval = m_clientRequestIDFlushTimeOut; | ||
138 | m_clientRequestIDFlushTimer.Elapsed += FlushClientRequestIDInfoCache; | ||
139 | m_clientRequestIDFlushTimer.AutoReset = true; | ||
140 | m_clientRequestIDFlushTimer.Start(); | ||
141 | } | ||
142 | } | ||
143 | |||
144 | void FlushClientRequestIDInfoCache(object sender, ElapsedEventArgs e) | ||
145 | { | ||
146 | lock (m_clientRequestIDInfo) | ||
147 | { | ||
148 | TimeSpan cacheTimeout = new TimeSpan(0,0, m_clientRequestIDFlushTimeOut / 1000); | ||
149 | UUID[] CurrentKeys = new UUID[m_clientRequestIDInfo.Count]; | ||
150 | foreach (UUID key in CurrentKeys) | ||
151 | { | ||
152 | if (m_clientRequestIDInfo.ContainsKey(key)) | ||
153 | { | ||
154 | if (DateTime.Now - m_clientRequestIDInfo[key].LastUsedTMStamp > cacheTimeout) | ||
155 | { | ||
156 | m_clientRequestIDInfo.Remove(key); | ||
157 | } | ||
158 | } | ||
159 | } | ||
160 | } | 126 | } |
161 | } | 127 | } |
162 | 128 | ||
@@ -234,8 +200,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
234 | return; | 200 | return; |
235 | 201 | ||
236 | if (m_debugEnabled) m_log.Debug("[GROUPS]: Shutting down Groups module."); | 202 | if (m_debugEnabled) m_log.Debug("[GROUPS]: Shutting down Groups module."); |
237 | |||
238 | m_clientRequestIDFlushTimer.Stop(); | ||
239 | } | 203 | } |
240 | 204 | ||
241 | public Type ReplaceableInterface | 205 | public Type ReplaceableInterface |
@@ -272,14 +236,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
272 | // Used for Notices and Group Invites/Accept/Reject | 236 | // Used for Notices and Group Invites/Accept/Reject |
273 | client.OnInstantMessage += OnInstantMessage; | 237 | client.OnInstantMessage += OnInstantMessage; |
274 | 238 | ||
275 | lock (m_clientRequestIDInfo) | 239 | // Send client thier groups information. |
276 | { | ||
277 | if (m_clientRequestIDInfo.ContainsKey(client.AgentId)) | ||
278 | { | ||
279 | // flush any old RequestID information | ||
280 | m_clientRequestIDInfo.Remove(client.AgentId); | ||
281 | } | ||
282 | } | ||
283 | SendAgentGroupDataUpdate(client, client.AgentId); | 240 | SendAgentGroupDataUpdate(client, client.AgentId); |
284 | } | 241 | } |
285 | 242 | ||
@@ -287,7 +244,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
287 | { | 244 | { |
288 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 245 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); |
289 | 246 | ||
290 | //GroupMembershipData[] avatarGroups = m_groupData.GetAgentGroupMemberships(GetClientGroupRequestID(remoteClient), avatarID).ToArray(); | 247 | //GroupMembershipData[] avatarGroups = m_groupData.GetAgentGroupMemberships(GetRequestingAgentID(remoteClient), avatarID).ToArray(); |
291 | GroupMembershipData[] avatarGroups = GetProfileListedGroupMemberships(remoteClient, avatarID); | 248 | GroupMembershipData[] avatarGroups = GetProfileListedGroupMemberships(remoteClient, avatarID); |
292 | remoteClient.SendAvatarGroupsReply(avatarID, avatarGroups); | 249 | remoteClient.SendAvatarGroupsReply(avatarID, avatarGroups); |
293 | } | 250 | } |
@@ -331,10 +288,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
331 | { | 288 | { |
332 | if (((DirFindFlags)queryFlags & DirFindFlags.Groups) == DirFindFlags.Groups) | 289 | if (((DirFindFlags)queryFlags & DirFindFlags.Groups) == DirFindFlags.Groups) |
333 | { | 290 | { |
334 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called with queryText({1}) queryFlags({2}) queryStart({3})", System.Reflection.MethodBase.GetCurrentMethod().Name, queryText, (DirFindFlags)queryFlags, queryStart); | 291 | if (m_debugEnabled) |
292 | m_log.DebugFormat( | ||
293 | "[GROUPS]: {0} called with queryText({1}) queryFlags({2}) queryStart({3})", | ||
294 | System.Reflection.MethodBase.GetCurrentMethod().Name, queryText, (DirFindFlags)queryFlags, queryStart); | ||
335 | 295 | ||
336 | // TODO: This currently ignores pretty much all the query flags including Mature and sort order | 296 | // TODO: This currently ignores pretty much all the query flags including Mature and sort order |
337 | remoteClient.SendDirGroupsReply(queryID, m_groupData.FindGroups(GetClientGroupRequestID(remoteClient), queryText).ToArray()); | 297 | remoteClient.SendDirGroupsReply(queryID, m_groupData.FindGroups(GetRequestingAgentID(remoteClient), queryText).ToArray()); |
338 | } | 298 | } |
339 | 299 | ||
340 | } | 300 | } |
@@ -348,7 +308,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
348 | string activeGroupName = string.Empty; | 308 | string activeGroupName = string.Empty; |
349 | ulong activeGroupPowers = (ulong)GroupPowers.None; | 309 | ulong activeGroupPowers = (ulong)GroupPowers.None; |
350 | 310 | ||
351 | GroupMembershipData membership = m_groupData.GetAgentActiveMembership(GetClientGroupRequestID(remoteClient), dataForAgentID); | 311 | GroupMembershipData membership = m_groupData.GetAgentActiveMembership(GetRequestingAgentID(remoteClient), dataForAgentID); |
352 | if (membership != null) | 312 | if (membership != null) |
353 | { | 313 | { |
354 | activeGroupID = membership.GroupID; | 314 | activeGroupID = membership.GroupID; |
@@ -361,13 +321,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
361 | SendScenePresenceUpdate(dataForAgentID, activeGroupTitle); | 321 | SendScenePresenceUpdate(dataForAgentID, activeGroupTitle); |
362 | } | 322 | } |
363 | 323 | ||
364 | private void HandleUUIDGroupNameRequest(UUID GroupID,IClientAPI remoteClient) | 324 | private void HandleUUIDGroupNameRequest(UUID GroupID, IClientAPI remoteClient) |
365 | { | 325 | { |
366 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 326 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); |
367 | 327 | ||
368 | string GroupName; | 328 | string GroupName; |
369 | 329 | ||
370 | GroupRecord group = m_groupData.GetGroupRecord(GetClientGroupRequestID(remoteClient), GroupID, null); | 330 | GroupRecord group = m_groupData.GetGroupRecord(GetRequestingAgentID(remoteClient), GroupID, null); |
371 | if (group != null) | 331 | if (group != null) |
372 | { | 332 | { |
373 | GroupName = group.GroupName; | 333 | GroupName = group.GroupName; |
@@ -388,7 +348,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
388 | if ((im.dialog == (byte)InstantMessageDialog.GroupInvitationAccept) || (im.dialog == (byte)InstantMessageDialog.GroupInvitationDecline)) | 348 | if ((im.dialog == (byte)InstantMessageDialog.GroupInvitationAccept) || (im.dialog == (byte)InstantMessageDialog.GroupInvitationDecline)) |
389 | { | 349 | { |
390 | UUID inviteID = new UUID(im.imSessionID); | 350 | UUID inviteID = new UUID(im.imSessionID); |
391 | GroupInviteInfo inviteInfo = m_groupData.GetAgentToGroupInvite(GetClientGroupRequestID(remoteClient), inviteID); | 351 | GroupInviteInfo inviteInfo = m_groupData.GetAgentToGroupInvite(GetRequestingAgentID(remoteClient), inviteID); |
392 | 352 | ||
393 | if (inviteInfo == null) | 353 | if (inviteInfo == null) |
394 | { | 354 | { |
@@ -407,7 +367,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
407 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: Received an accept invite notice."); | 367 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: Received an accept invite notice."); |
408 | 368 | ||
409 | // and the sessionid is the role | 369 | // and the sessionid is the role |
410 | m_groupData.AddAgentToGroup(GetClientGroupRequestID(remoteClient), inviteInfo.AgentID, inviteInfo.GroupID, inviteInfo.RoleID); | 370 | m_groupData.AddAgentToGroup(GetRequestingAgentID(remoteClient), inviteInfo.AgentID, inviteInfo.GroupID, inviteInfo.RoleID); |
411 | 371 | ||
412 | GridInstantMessage msg = new GridInstantMessage(); | 372 | GridInstantMessage msg = new GridInstantMessage(); |
413 | msg.imSessionID = UUID.Zero.Guid; | 373 | msg.imSessionID = UUID.Zero.Guid; |
@@ -431,14 +391,14 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
431 | // TODO: If the inviter is still online, they need an agent dataupdate | 391 | // TODO: If the inviter is still online, they need an agent dataupdate |
432 | // and maybe group membership updates for the invitee | 392 | // and maybe group membership updates for the invitee |
433 | 393 | ||
434 | m_groupData.RemoveAgentToGroupInvite(GetClientGroupRequestID(remoteClient), inviteID); | 394 | m_groupData.RemoveAgentToGroupInvite(GetRequestingAgentID(remoteClient), inviteID); |
435 | } | 395 | } |
436 | 396 | ||
437 | // Reject | 397 | // Reject |
438 | if (im.dialog == (byte)InstantMessageDialog.GroupInvitationDecline) | 398 | if (im.dialog == (byte)InstantMessageDialog.GroupInvitationDecline) |
439 | { | 399 | { |
440 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: Received a reject invite notice."); | 400 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: Received a reject invite notice."); |
441 | m_groupData.RemoveAgentToGroupInvite(GetClientGroupRequestID(remoteClient), inviteID); | 401 | m_groupData.RemoveAgentToGroupInvite(GetRequestingAgentID(remoteClient), inviteID); |
442 | } | 402 | } |
443 | } | 403 | } |
444 | } | 404 | } |
@@ -452,7 +412,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
452 | } | 412 | } |
453 | 413 | ||
454 | UUID GroupID = new UUID(im.toAgentID); | 414 | UUID GroupID = new UUID(im.toAgentID); |
455 | if (m_groupData.GetGroupRecord(GetClientGroupRequestID(remoteClient), GroupID, null) != null) | 415 | if (m_groupData.GetGroupRecord(GetRequestingAgentID(remoteClient), GroupID, null) != null) |
456 | { | 416 | { |
457 | UUID NoticeID = UUID.Random(); | 417 | UUID NoticeID = UUID.Random(); |
458 | string Subject = im.message.Substring(0, im.message.IndexOf('|')); | 418 | string Subject = im.message.Substring(0, im.message.IndexOf('|')); |
@@ -496,14 +456,14 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
496 | } | 456 | } |
497 | 457 | ||
498 | 458 | ||
499 | m_groupData.AddGroupNotice(GetClientGroupRequestID(remoteClient), GroupID, NoticeID, im.fromAgentName, Subject, Message, bucket); | 459 | m_groupData.AddGroupNotice(GetRequestingAgentID(remoteClient), GroupID, NoticeID, im.fromAgentName, Subject, Message, bucket); |
500 | if (OnNewGroupNotice != null) | 460 | if (OnNewGroupNotice != null) |
501 | { | 461 | { |
502 | OnNewGroupNotice(GroupID, NoticeID); | 462 | OnNewGroupNotice(GroupID, NoticeID); |
503 | } | 463 | } |
504 | 464 | ||
505 | // Send notice out to everyone that wants notices | 465 | // Send notice out to everyone that wants notices |
506 | foreach (GroupMembersData member in m_groupData.GetGroupMembers(GetClientGroupRequestID(remoteClient), GroupID)) | 466 | foreach (GroupMembersData member in m_groupData.GetGroupMembers(GetRequestingAgentID(remoteClient), GroupID)) |
507 | { | 467 | { |
508 | if (m_debugEnabled) | 468 | if (m_debugEnabled) |
509 | { | 469 | { |
@@ -549,7 +509,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
549 | IClientAPI ejectee = GetActiveClient(ejecteeID); | 509 | IClientAPI ejectee = GetActiveClient(ejecteeID); |
550 | if (ejectee != null) | 510 | if (ejectee != null) |
551 | { | 511 | { |
552 | UUID groupID = new UUID(im.fromAgentID); | 512 | UUID groupID = new UUID(im.imSessionID); |
553 | ejectee.SendAgentDropGroup(groupID); | 513 | ejectee.SendAgentDropGroup(groupID); |
554 | } | 514 | } |
555 | } | 515 | } |
@@ -588,20 +548,25 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
588 | 548 | ||
589 | public GroupRecord GetGroupRecord(UUID GroupID) | 549 | public GroupRecord GetGroupRecord(UUID GroupID) |
590 | { | 550 | { |
591 | return m_groupData.GetGroupRecord(null, GroupID, null); | 551 | return m_groupData.GetGroupRecord(UUID.Zero, GroupID, null); |
592 | } | 552 | } |
593 | 553 | ||
554 | public GroupRecord GetGroupRecord(string name) | ||
555 | { | ||
556 | return m_groupData.GetGroupRecord(UUID.Zero, UUID.Zero, name); | ||
557 | } | ||
558 | |||
594 | public void ActivateGroup(IClientAPI remoteClient, UUID groupID) | 559 | public void ActivateGroup(IClientAPI remoteClient, UUID groupID) |
595 | { | 560 | { |
596 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 561 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); |
597 | 562 | ||
598 | m_groupData.SetAgentActiveGroup(GetClientGroupRequestID(remoteClient), remoteClient.AgentId, groupID); | 563 | m_groupData.SetAgentActiveGroup(GetRequestingAgentID(remoteClient), GetRequestingAgentID(remoteClient), groupID); |
599 | 564 | ||
600 | // Changing active group changes title, active powers, all kinds of things | 565 | // Changing active group changes title, active powers, all kinds of things |
601 | // anyone who is in any region that can see this client, should probably be | 566 | // anyone who is in any region that can see this client, should probably be |
602 | // updated with new group info. At a minimum, they should get ScenePresence | 567 | // updated with new group info. At a minimum, they should get ScenePresence |
603 | // updated with new title. | 568 | // updated with new title. |
604 | UpdateAllClientsWithGroupInfo(remoteClient.AgentId); | 569 | UpdateAllClientsWithGroupInfo(GetRequestingAgentID(remoteClient)); |
605 | } | 570 | } |
606 | 571 | ||
607 | /// <summary> | 572 | /// <summary> |
@@ -611,10 +576,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
611 | { | 576 | { |
612 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 577 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); |
613 | 578 | ||
614 | GroupRequestID grID = GetClientGroupRequestID(remoteClient); | ||
615 | 579 | ||
616 | List<GroupRolesData> agentRoles = m_groupData.GetAgentGroupRoles(grID, remoteClient.AgentId, groupID); | 580 | List<GroupRolesData> agentRoles = m_groupData.GetAgentGroupRoles(GetRequestingAgentID(remoteClient), GetRequestingAgentID(remoteClient), groupID); |
617 | GroupMembershipData agentMembership = m_groupData.GetAgentGroupMembership(grID, remoteClient.AgentId, groupID); | 581 | GroupMembershipData agentMembership = m_groupData.GetAgentGroupMembership(GetRequestingAgentID(remoteClient), GetRequestingAgentID(remoteClient), groupID); |
618 | 582 | ||
619 | List<GroupTitlesData> titles = new List<GroupTitlesData>(); | 583 | List<GroupTitlesData> titles = new List<GroupTitlesData>(); |
620 | foreach (GroupRolesData role in agentRoles) | 584 | foreach (GroupRolesData role in agentRoles) |
@@ -636,8 +600,15 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
636 | public List<GroupMembersData> GroupMembersRequest(IClientAPI remoteClient, UUID groupID) | 600 | public List<GroupMembersData> GroupMembersRequest(IClientAPI remoteClient, UUID groupID) |
637 | { | 601 | { |
638 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 602 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); |
603 | List<GroupMembersData> data = m_groupData.GetGroupMembers(GetRequestingAgentID(remoteClient), groupID); | ||
639 | 604 | ||
640 | List<GroupMembersData> data = m_groupData.GetGroupMembers(GetClientGroupRequestID(remoteClient), groupID); | 605 | if (m_debugEnabled) |
606 | { | ||
607 | foreach (GroupMembersData member in data) | ||
608 | { | ||
609 | m_log.DebugFormat("[GROUPS]: Member({0}) - IsOwner({1})", member.AgentID, member.IsOwner); | ||
610 | } | ||
611 | } | ||
641 | 612 | ||
642 | return data; | 613 | return data; |
643 | 614 | ||
@@ -647,21 +618,25 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
647 | { | 618 | { |
648 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 619 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); |
649 | 620 | ||
650 | List<GroupRolesData> data = m_groupData.GetGroupRoles(GetClientGroupRequestID(remoteClient), groupID); | 621 | List<GroupRolesData> data = m_groupData.GetGroupRoles(GetRequestingAgentID(remoteClient), groupID); |
651 | 622 | ||
652 | return data; | 623 | return data; |
653 | |||
654 | } | 624 | } |
655 | 625 | ||
656 | public List<GroupRoleMembersData> GroupRoleMembersRequest(IClientAPI remoteClient, UUID groupID) | 626 | public List<GroupRoleMembersData> GroupRoleMembersRequest(IClientAPI remoteClient, UUID groupID) |
657 | { | 627 | { |
658 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 628 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); |
659 | 629 | ||
660 | List<GroupRoleMembersData> data = m_groupData.GetGroupRoleMembers(GetClientGroupRequestID(remoteClient), groupID); | 630 | List<GroupRoleMembersData> data = m_groupData.GetGroupRoleMembers(GetRequestingAgentID(remoteClient), groupID); |
661 | 631 | ||
632 | if (m_debugEnabled) | ||
633 | { | ||
634 | foreach (GroupRoleMembersData member in data) | ||
635 | { | ||
636 | m_log.DebugFormat("[GROUPS]: Member({0}) - Role({1})", member.MemberID, member.RoleID); | ||
637 | } | ||
638 | } | ||
662 | return data; | 639 | return data; |
663 | |||
664 | |||
665 | } | 640 | } |
666 | 641 | ||
667 | public GroupProfileData GroupProfileRequest(IClientAPI remoteClient, UUID groupID) | 642 | public GroupProfileData GroupProfileRequest(IClientAPI remoteClient, UUID groupID) |
@@ -670,17 +645,16 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
670 | 645 | ||
671 | GroupProfileData profile = new GroupProfileData(); | 646 | GroupProfileData profile = new GroupProfileData(); |
672 | 647 | ||
673 | GroupRequestID grID = GetClientGroupRequestID(remoteClient); | ||
674 | 648 | ||
675 | GroupRecord groupInfo = m_groupData.GetGroupRecord(GetClientGroupRequestID(remoteClient), groupID, null); | 649 | GroupRecord groupInfo = m_groupData.GetGroupRecord(GetRequestingAgentID(remoteClient), groupID, null); |
676 | if (groupInfo != null) | 650 | if (groupInfo != null) |
677 | { | 651 | { |
678 | profile.AllowPublish = groupInfo.AllowPublish; | 652 | profile.AllowPublish = groupInfo.AllowPublish; |
679 | profile.Charter = groupInfo.Charter; | 653 | profile.Charter = groupInfo.Charter; |
680 | profile.FounderID = groupInfo.FounderID; | 654 | profile.FounderID = groupInfo.FounderID; |
681 | profile.GroupID = groupID; | 655 | profile.GroupID = groupID; |
682 | profile.GroupMembershipCount = m_groupData.GetGroupMembers(grID, groupID).Count; | 656 | profile.GroupMembershipCount = m_groupData.GetGroupMembers(GetRequestingAgentID(remoteClient), groupID).Count; |
683 | profile.GroupRolesCount = m_groupData.GetGroupRoles(grID, groupID).Count; | 657 | profile.GroupRolesCount = m_groupData.GetGroupRoles(GetRequestingAgentID(remoteClient), groupID).Count; |
684 | profile.InsigniaID = groupInfo.GroupPicture; | 658 | profile.InsigniaID = groupInfo.GroupPicture; |
685 | profile.MaturePublish = groupInfo.MaturePublish; | 659 | profile.MaturePublish = groupInfo.MaturePublish; |
686 | profile.MembershipFee = groupInfo.MembershipFee; | 660 | profile.MembershipFee = groupInfo.MembershipFee; |
@@ -691,7 +665,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
691 | profile.ShowInList = groupInfo.ShowInList; | 665 | profile.ShowInList = groupInfo.ShowInList; |
692 | } | 666 | } |
693 | 667 | ||
694 | GroupMembershipData memberInfo = m_groupData.GetAgentGroupMembership(grID, remoteClient.AgentId, groupID); | 668 | GroupMembershipData memberInfo = m_groupData.GetAgentGroupMembership(GetRequestingAgentID(remoteClient), GetRequestingAgentID(remoteClient), groupID); |
695 | if (memberInfo != null) | 669 | if (memberInfo != null) |
696 | { | 670 | { |
697 | profile.MemberTitle = memberInfo.GroupTitle; | 671 | profile.MemberTitle = memberInfo.GroupTitle; |
@@ -705,40 +679,40 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
705 | { | 679 | { |
706 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 680 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); |
707 | 681 | ||
708 | return m_groupData.GetAgentGroupMemberships(null, agentID).ToArray(); | 682 | return m_groupData.GetAgentGroupMemberships(UUID.Zero, agentID).ToArray(); |
709 | } | 683 | } |
710 | 684 | ||
711 | public GroupMembershipData GetMembershipData(UUID groupID, UUID agentID) | 685 | public GroupMembershipData GetMembershipData(UUID groupID, UUID agentID) |
712 | { | 686 | { |
713 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 687 | if (m_debugEnabled) |
688 | m_log.DebugFormat( | ||
689 | "[GROUPS]: {0} called with groupID={1}, agentID={2}", | ||
690 | System.Reflection.MethodBase.GetCurrentMethod().Name, groupID, agentID); | ||
714 | 691 | ||
715 | return m_groupData.GetAgentGroupMembership(null, agentID, groupID); | 692 | return m_groupData.GetAgentGroupMembership(UUID.Zero, agentID, groupID); |
716 | } | 693 | } |
717 | 694 | ||
718 | public void UpdateGroupInfo(IClientAPI remoteClient, UUID groupID, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, bool allowPublish, bool maturePublish) | 695 | public void UpdateGroupInfo(IClientAPI remoteClient, UUID groupID, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, bool allowPublish, bool maturePublish) |
719 | { | 696 | { |
720 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 697 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); |
721 | 698 | ||
722 | // TODO: Security Check? | 699 | // Note: Permissions checking for modification rights is handled by the Groups Server/Service |
723 | 700 | m_groupData.UpdateGroup(GetRequestingAgentID(remoteClient), groupID, charter, showInList, insigniaID, membershipFee, openEnrollment, allowPublish, maturePublish); | |
724 | m_groupData.UpdateGroup(GetClientGroupRequestID(remoteClient), groupID, charter, showInList, insigniaID, membershipFee, openEnrollment, allowPublish, maturePublish); | ||
725 | } | 701 | } |
726 | 702 | ||
727 | public void SetGroupAcceptNotices(IClientAPI remoteClient, UUID groupID, bool acceptNotices, bool listInProfile) | 703 | public void SetGroupAcceptNotices(IClientAPI remoteClient, UUID groupID, bool acceptNotices, bool listInProfile) |
728 | { | 704 | { |
729 | // TODO: Security Check? | 705 | // Note: Permissions checking for modification rights is handled by the Groups Server/Service |
730 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 706 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); |
731 | 707 | ||
732 | m_groupData.SetAgentGroupInfo(GetClientGroupRequestID(remoteClient), remoteClient.AgentId, groupID, acceptNotices, listInProfile); | 708 | m_groupData.SetAgentGroupInfo(GetRequestingAgentID(remoteClient), GetRequestingAgentID(remoteClient), groupID, acceptNotices, listInProfile); |
733 | } | 709 | } |
734 | 710 | ||
735 | public UUID CreateGroup(IClientAPI remoteClient, string name, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, bool allowPublish, bool maturePublish) | 711 | public UUID CreateGroup(IClientAPI remoteClient, string name, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, bool allowPublish, bool maturePublish) |
736 | { | 712 | { |
737 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 713 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); |
738 | 714 | ||
739 | GroupRequestID grID = GetClientGroupRequestID(remoteClient); | 715 | if (m_groupData.GetGroupRecord(GetRequestingAgentID(remoteClient), UUID.Zero, name) != null) |
740 | |||
741 | if (m_groupData.GetGroupRecord(grID, UUID.Zero, name) != null) | ||
742 | { | 716 | { |
743 | remoteClient.SendCreateGroupReply(UUID.Zero, false, "A group with the same name already exists."); | 717 | remoteClient.SendCreateGroupReply(UUID.Zero, false, "A group with the same name already exists."); |
744 | return UUID.Zero; | 718 | return UUID.Zero; |
@@ -754,12 +728,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
754 | } | 728 | } |
755 | money.ApplyGroupCreationCharge(remoteClient.AgentId); | 729 | money.ApplyGroupCreationCharge(remoteClient.AgentId); |
756 | } | 730 | } |
757 | UUID groupID = m_groupData.CreateGroup(grID, name, charter, showInList, insigniaID, membershipFee, openEnrollment, allowPublish, maturePublish, remoteClient.AgentId); | 731 | UUID groupID = m_groupData.CreateGroup(GetRequestingAgentID(remoteClient), name, charter, showInList, insigniaID, membershipFee, openEnrollment, allowPublish, maturePublish, GetRequestingAgentID(remoteClient)); |
758 | 732 | ||
759 | remoteClient.SendCreateGroupReply(groupID, true, "Group created successfullly"); | 733 | remoteClient.SendCreateGroupReply(groupID, true, "Group created successfullly"); |
760 | 734 | ||
761 | // Update the founder with new group information. | 735 | // Update the founder with new group information. |
762 | SendAgentGroupDataUpdate(remoteClient, remoteClient.AgentId); | 736 | SendAgentGroupDataUpdate(remoteClient, GetRequestingAgentID(remoteClient)); |
763 | 737 | ||
764 | return groupID; | 738 | return groupID; |
765 | } | 739 | } |
@@ -770,7 +744,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
770 | 744 | ||
771 | // ToDo: check if agent is a member of group and is allowed to see notices? | 745 | // ToDo: check if agent is a member of group and is allowed to see notices? |
772 | 746 | ||
773 | return m_groupData.GetGroupNotices(GetClientGroupRequestID(remoteClient), groupID).ToArray(); | 747 | return m_groupData.GetGroupNotices(GetRequestingAgentID(remoteClient), groupID).ToArray(); |
774 | } | 748 | } |
775 | 749 | ||
776 | /// <summary> | 750 | /// <summary> |
@@ -780,7 +754,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
780 | { | 754 | { |
781 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 755 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); |
782 | 756 | ||
783 | GroupMembershipData membership = m_groupData.GetAgentActiveMembership(null, avatarID); | 757 | GroupMembershipData membership = m_groupData.GetAgentActiveMembership(UUID.Zero, avatarID); |
784 | if (membership != null) | 758 | if (membership != null) |
785 | { | 759 | { |
786 | return membership.GroupTitle; | 760 | return membership.GroupTitle; |
@@ -795,13 +769,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
795 | { | 769 | { |
796 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 770 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); |
797 | 771 | ||
798 | m_groupData.SetAgentActiveGroupRole(GetClientGroupRequestID(remoteClient), remoteClient.AgentId, groupID, titleRoleID); | 772 | m_groupData.SetAgentActiveGroupRole(GetRequestingAgentID(remoteClient), GetRequestingAgentID(remoteClient), groupID, titleRoleID); |
799 | 773 | ||
800 | // TODO: Not sure what all is needed here, but if the active group role change is for the group | 774 | // TODO: Not sure what all is needed here, but if the active group role change is for the group |
801 | // the client currently has set active, then we need to do a scene presence update too | 775 | // the client currently has set active, then we need to do a scene presence update too |
802 | // if (m_groupData.GetAgentActiveMembership(remoteClient.AgentId).GroupID == GroupID) | 776 | // if (m_groupData.GetAgentActiveMembership(GetRequestingAgentID(remoteClient)).GroupID == GroupID) |
803 | 777 | ||
804 | UpdateAllClientsWithGroupInfo(remoteClient.AgentId); | 778 | UpdateAllClientsWithGroupInfo(GetRequestingAgentID(remoteClient)); |
805 | } | 779 | } |
806 | 780 | ||
807 | 781 | ||
@@ -811,16 +785,14 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
811 | 785 | ||
812 | // Security Checks are handled in the Groups Service. | 786 | // Security Checks are handled in the Groups Service. |
813 | 787 | ||
814 | GroupRequestID grID = GetClientGroupRequestID(remoteClient); | ||
815 | |||
816 | switch ((OpenMetaverse.GroupRoleUpdate)updateType) | 788 | switch ((OpenMetaverse.GroupRoleUpdate)updateType) |
817 | { | 789 | { |
818 | case OpenMetaverse.GroupRoleUpdate.Create: | 790 | case OpenMetaverse.GroupRoleUpdate.Create: |
819 | m_groupData.AddGroupRole(grID, groupID, UUID.Random(), name, description, title, powers); | 791 | m_groupData.AddGroupRole(GetRequestingAgentID(remoteClient), groupID, UUID.Random(), name, description, title, powers); |
820 | break; | 792 | break; |
821 | 793 | ||
822 | case OpenMetaverse.GroupRoleUpdate.Delete: | 794 | case OpenMetaverse.GroupRoleUpdate.Delete: |
823 | m_groupData.RemoveGroupRole(grID, groupID, roleID); | 795 | m_groupData.RemoveGroupRole(GetRequestingAgentID(remoteClient), groupID, roleID); |
824 | break; | 796 | break; |
825 | 797 | ||
826 | case OpenMetaverse.GroupRoleUpdate.UpdateAll: | 798 | case OpenMetaverse.GroupRoleUpdate.UpdateAll: |
@@ -831,7 +803,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
831 | GroupPowers gp = (GroupPowers)powers; | 803 | GroupPowers gp = (GroupPowers)powers; |
832 | m_log.DebugFormat("[GROUPS]: Role ({0}) updated with Powers ({1}) ({2})", name, powers.ToString(), gp.ToString()); | 804 | m_log.DebugFormat("[GROUPS]: Role ({0}) updated with Powers ({1}) ({2})", name, powers.ToString(), gp.ToString()); |
833 | } | 805 | } |
834 | m_groupData.UpdateGroupRole(grID, groupID, roleID, name, description, title, powers); | 806 | m_groupData.UpdateGroupRole(GetRequestingAgentID(remoteClient), groupID, roleID, name, description, title, powers); |
835 | break; | 807 | break; |
836 | 808 | ||
837 | case OpenMetaverse.GroupRoleUpdate.NoUpdate: | 809 | case OpenMetaverse.GroupRoleUpdate.NoUpdate: |
@@ -842,7 +814,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
842 | } | 814 | } |
843 | 815 | ||
844 | // TODO: This update really should send out updates for everyone in the role that just got changed. | 816 | // TODO: This update really should send out updates for everyone in the role that just got changed. |
845 | SendAgentGroupDataUpdate(remoteClient, remoteClient.AgentId); | 817 | SendAgentGroupDataUpdate(remoteClient, GetRequestingAgentID(remoteClient)); |
846 | } | 818 | } |
847 | 819 | ||
848 | public void GroupRoleChanges(IClientAPI remoteClient, UUID groupID, UUID roleID, UUID memberID, uint changes) | 820 | public void GroupRoleChanges(IClientAPI remoteClient, UUID groupID, UUID roleID, UUID memberID, uint changes) |
@@ -850,18 +822,16 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
850 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 822 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); |
851 | // Todo: Security check | 823 | // Todo: Security check |
852 | 824 | ||
853 | GroupRequestID grID = GetClientGroupRequestID(remoteClient); | ||
854 | |||
855 | switch (changes) | 825 | switch (changes) |
856 | { | 826 | { |
857 | case 0: | 827 | case 0: |
858 | // Add | 828 | // Add |
859 | m_groupData.AddAgentToGroupRole(grID, memberID, groupID, roleID); | 829 | m_groupData.AddAgentToGroupRole(GetRequestingAgentID(remoteClient), memberID, groupID, roleID); |
860 | 830 | ||
861 | break; | 831 | break; |
862 | case 1: | 832 | case 1: |
863 | // Remove | 833 | // Remove |
864 | m_groupData.RemoveAgentFromGroupRole(grID, memberID, groupID, roleID); | 834 | m_groupData.RemoveAgentFromGroupRole(GetRequestingAgentID(remoteClient), memberID, groupID, roleID); |
865 | 835 | ||
866 | break; | 836 | break; |
867 | default: | 837 | default: |
@@ -870,25 +840,23 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
870 | } | 840 | } |
871 | 841 | ||
872 | // TODO: This update really should send out updates for everyone in the role that just got changed. | 842 | // TODO: This update really should send out updates for everyone in the role that just got changed. |
873 | SendAgentGroupDataUpdate(remoteClient, remoteClient.AgentId); | 843 | SendAgentGroupDataUpdate(remoteClient, GetRequestingAgentID(remoteClient)); |
874 | } | 844 | } |
875 | 845 | ||
876 | public void GroupNoticeRequest(IClientAPI remoteClient, UUID groupNoticeID) | 846 | public void GroupNoticeRequest(IClientAPI remoteClient, UUID groupNoticeID) |
877 | { | 847 | { |
878 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 848 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); |
879 | 849 | ||
880 | GroupRequestID grID = GetClientGroupRequestID(remoteClient); | 850 | GroupNoticeInfo data = m_groupData.GetGroupNotice(GetRequestingAgentID(remoteClient), groupNoticeID); |
881 | |||
882 | GroupNoticeInfo data = m_groupData.GetGroupNotice(grID, groupNoticeID); | ||
883 | 851 | ||
884 | if (data != null) | 852 | if (data != null) |
885 | { | 853 | { |
886 | GroupRecord groupInfo = m_groupData.GetGroupRecord(grID, data.GroupID, null); | 854 | GroupRecord groupInfo = m_groupData.GetGroupRecord(GetRequestingAgentID(remoteClient), data.GroupID, null); |
887 | 855 | ||
888 | GridInstantMessage msg = new GridInstantMessage(); | 856 | GridInstantMessage msg = new GridInstantMessage(); |
889 | msg.imSessionID = UUID.Zero.Guid; | 857 | msg.imSessionID = UUID.Zero.Guid; |
890 | msg.fromAgentID = data.GroupID.Guid; | 858 | msg.fromAgentID = data.GroupID.Guid; |
891 | msg.toAgentID = remoteClient.AgentId.Guid; | 859 | msg.toAgentID = GetRequestingAgentID(remoteClient).Guid; |
892 | msg.timestamp = (uint)Util.UnixTimeSinceEpoch(); | 860 | msg.timestamp = (uint)Util.UnixTimeSinceEpoch(); |
893 | msg.fromAgentName = "Group Notice : " + groupInfo == null ? "Unknown" : groupInfo.GroupName; | 861 | msg.fromAgentName = "Group Notice : " + groupInfo == null ? "Unknown" : groupInfo.GroupName; |
894 | msg.message = data.noticeData.Subject + "|" + data.Message; | 862 | msg.message = data.noticeData.Subject + "|" + data.Message; |
@@ -900,7 +868,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
900 | msg.RegionID = UUID.Zero.Guid; | 868 | msg.RegionID = UUID.Zero.Guid; |
901 | msg.binaryBucket = data.BinaryBucket; | 869 | msg.binaryBucket = data.BinaryBucket; |
902 | 870 | ||
903 | OutgoingInstantMessage(msg, remoteClient.AgentId); | 871 | OutgoingInstantMessage(msg, GetRequestingAgentID(remoteClient)); |
904 | } | 872 | } |
905 | 873 | ||
906 | } | 874 | } |
@@ -920,7 +888,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
920 | msg.Position = Vector3.Zero; | 888 | msg.Position = Vector3.Zero; |
921 | msg.RegionID = UUID.Zero.Guid; | 889 | msg.RegionID = UUID.Zero.Guid; |
922 | 890 | ||
923 | GroupNoticeInfo info = m_groupData.GetGroupNotice(null, groupNoticeID); | 891 | GroupNoticeInfo info = m_groupData.GetGroupNotice(agentID, groupNoticeID); |
924 | if (info != null) | 892 | if (info != null) |
925 | { | 893 | { |
926 | msg.fromAgentID = info.GroupID.Guid; | 894 | msg.fromAgentID = info.GroupID.Guid; |
@@ -947,7 +915,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
947 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 915 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); |
948 | 916 | ||
949 | // Send agent information about his groups | 917 | // Send agent information about his groups |
950 | SendAgentGroupDataUpdate(remoteClient, remoteClient.AgentId); | 918 | SendAgentGroupDataUpdate(remoteClient, GetRequestingAgentID(remoteClient)); |
951 | } | 919 | } |
952 | 920 | ||
953 | public void JoinGroupRequest(IClientAPI remoteClient, UUID groupID) | 921 | public void JoinGroupRequest(IClientAPI remoteClient, UUID groupID) |
@@ -955,19 +923,19 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
955 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 923 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); |
956 | 924 | ||
957 | // Should check to see if OpenEnrollment, or if there's an outstanding invitation | 925 | // Should check to see if OpenEnrollment, or if there's an outstanding invitation |
958 | m_groupData.AddAgentToGroup(GetClientGroupRequestID(remoteClient), remoteClient.AgentId, groupID, UUID.Zero); | 926 | m_groupData.AddAgentToGroup(GetRequestingAgentID(remoteClient), GetRequestingAgentID(remoteClient), groupID, UUID.Zero); |
959 | 927 | ||
960 | remoteClient.SendJoinGroupReply(groupID, true); | 928 | remoteClient.SendJoinGroupReply(groupID, true); |
961 | 929 | ||
962 | // Should this send updates to everyone in the group? | 930 | // Should this send updates to everyone in the group? |
963 | SendAgentGroupDataUpdate(remoteClient, remoteClient.AgentId); | 931 | SendAgentGroupDataUpdate(remoteClient, GetRequestingAgentID(remoteClient)); |
964 | } | 932 | } |
965 | 933 | ||
966 | public void LeaveGroupRequest(IClientAPI remoteClient, UUID groupID) | 934 | public void LeaveGroupRequest(IClientAPI remoteClient, UUID groupID) |
967 | { | 935 | { |
968 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 936 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); |
969 | 937 | ||
970 | m_groupData.RemoveAgentFromGroup(GetClientGroupRequestID(remoteClient), remoteClient.AgentId, groupID); | 938 | m_groupData.RemoveAgentFromGroup(GetRequestingAgentID(remoteClient), GetRequestingAgentID(remoteClient), groupID); |
971 | 939 | ||
972 | remoteClient.SendLeaveGroupReply(groupID, true); | 940 | remoteClient.SendLeaveGroupReply(groupID, true); |
973 | 941 | ||
@@ -975,21 +943,20 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
975 | 943 | ||
976 | // SL sends out notifcations to the group messaging session that the person has left | 944 | // SL sends out notifcations to the group messaging session that the person has left |
977 | // Should this also update everyone who is in the group? | 945 | // Should this also update everyone who is in the group? |
978 | SendAgentGroupDataUpdate(remoteClient, remoteClient.AgentId); | 946 | SendAgentGroupDataUpdate(remoteClient, GetRequestingAgentID(remoteClient)); |
979 | } | 947 | } |
980 | 948 | ||
981 | public void EjectGroupMemberRequest(IClientAPI remoteClient, UUID groupID, UUID ejecteeID) | 949 | public void EjectGroupMemberRequest(IClientAPI remoteClient, UUID groupID, UUID ejecteeID) |
982 | { | 950 | { |
983 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 951 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); |
984 | 952 | ||
985 | GroupRequestID grID = GetClientGroupRequestID(remoteClient); | ||
986 | 953 | ||
987 | // Todo: Security check? | 954 | // Todo: Security check? |
988 | m_groupData.RemoveAgentFromGroup(grID, ejecteeID, groupID); | 955 | m_groupData.RemoveAgentFromGroup(GetRequestingAgentID(remoteClient), ejecteeID, groupID); |
989 | 956 | ||
990 | remoteClient.SendEjectGroupMemberReply(remoteClient.AgentId, groupID, true); | 957 | remoteClient.SendEjectGroupMemberReply(GetRequestingAgentID(remoteClient), groupID, true); |
991 | 958 | ||
992 | GroupRecord groupInfo = m_groupData.GetGroupRecord(grID, groupID, null); | 959 | GroupRecord groupInfo = m_groupData.GetGroupRecord(GetRequestingAgentID(remoteClient), groupID, null); |
993 | UserProfileData userProfile = m_sceneList[0].CommsManager.UserService.GetUserProfile(ejecteeID); | 960 | UserProfileData userProfile = m_sceneList[0].CommsManager.UserService.GetUserProfile(ejecteeID); |
994 | 961 | ||
995 | if ((groupInfo == null) || (userProfile == null)) | 962 | if ((groupInfo == null) || (userProfile == null)) |
@@ -1002,7 +969,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
1002 | GridInstantMessage msg = new GridInstantMessage(); | 969 | GridInstantMessage msg = new GridInstantMessage(); |
1003 | 970 | ||
1004 | msg.imSessionID = UUID.Zero.Guid; | 971 | msg.imSessionID = UUID.Zero.Guid; |
1005 | msg.fromAgentID = remoteClient.AgentId.Guid; | 972 | msg.fromAgentID = GetRequestingAgentID(remoteClient).Guid; |
1006 | // msg.fromAgentID = info.GroupID; | 973 | // msg.fromAgentID = info.GroupID; |
1007 | msg.toAgentID = ejecteeID.Guid; | 974 | msg.toAgentID = ejecteeID.Guid; |
1008 | //msg.timestamp = (uint)Util.UnixTimeSinceEpoch(); | 975 | //msg.timestamp = (uint)Util.UnixTimeSinceEpoch(); |
@@ -1028,8 +995,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
1028 | 995 | ||
1029 | msg = new GridInstantMessage(); | 996 | msg = new GridInstantMessage(); |
1030 | msg.imSessionID = UUID.Zero.Guid; | 997 | msg.imSessionID = UUID.Zero.Guid; |
1031 | msg.fromAgentID = remoteClient.AgentId.Guid; | 998 | msg.fromAgentID = GetRequestingAgentID(remoteClient).Guid; |
1032 | msg.toAgentID = remoteClient.AgentId.Guid; | 999 | msg.toAgentID = GetRequestingAgentID(remoteClient).Guid; |
1033 | msg.timestamp = 0; | 1000 | msg.timestamp = 0; |
1034 | msg.fromAgentName = remoteClient.Name; | 1001 | msg.fromAgentName = remoteClient.Name; |
1035 | if (userProfile != null) | 1002 | if (userProfile != null) |
@@ -1047,7 +1014,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
1047 | msg.Position = Vector3.Zero; | 1014 | msg.Position = Vector3.Zero; |
1048 | msg.RegionID = remoteClient.Scene.RegionInfo.RegionID.Guid; | 1015 | msg.RegionID = remoteClient.Scene.RegionInfo.RegionID.Guid; |
1049 | msg.binaryBucket = new byte[0]; | 1016 | msg.binaryBucket = new byte[0]; |
1050 | OutgoingInstantMessage(msg, remoteClient.AgentId); | 1017 | OutgoingInstantMessage(msg, GetRequestingAgentID(remoteClient)); |
1051 | 1018 | ||
1052 | 1019 | ||
1053 | // SL sends out messages to everyone in the group | 1020 | // SL sends out messages to everyone in the group |
@@ -1061,13 +1028,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
1061 | 1028 | ||
1062 | // Todo: Security check, probably also want to send some kind of notification | 1029 | // Todo: Security check, probably also want to send some kind of notification |
1063 | UUID InviteID = UUID.Random(); | 1030 | UUID InviteID = UUID.Random(); |
1064 | GroupRequestID grid = GetClientGroupRequestID(remoteClient); | ||
1065 | 1031 | ||
1066 | m_groupData.AddAgentToGroupInvite(grid, InviteID, groupID, roleID, invitedAgentID); | 1032 | m_groupData.AddAgentToGroupInvite(GetRequestingAgentID(remoteClient), InviteID, groupID, roleID, invitedAgentID); |
1067 | 1033 | ||
1068 | // Check to see if the invite went through, if it did not then it's possible | 1034 | // Check to see if the invite went through, if it did not then it's possible |
1069 | // the remoteClient did not validate or did not have permission to invite. | 1035 | // the remoteClient did not validate or did not have permission to invite. |
1070 | GroupInviteInfo inviteInfo = m_groupData.GetAgentToGroupInvite(grid, InviteID); | 1036 | GroupInviteInfo inviteInfo = m_groupData.GetAgentToGroupInvite(GetRequestingAgentID(remoteClient), InviteID); |
1071 | 1037 | ||
1072 | if (inviteInfo != null) | 1038 | if (inviteInfo != null) |
1073 | { | 1039 | { |
@@ -1079,7 +1045,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
1079 | 1045 | ||
1080 | msg.imSessionID = inviteUUID; | 1046 | msg.imSessionID = inviteUUID; |
1081 | 1047 | ||
1082 | // msg.fromAgentID = remoteClient.AgentId.Guid; | 1048 | // msg.fromAgentID = GetRequestingAgentID(remoteClient).Guid; |
1083 | msg.fromAgentID = groupID.Guid; | 1049 | msg.fromAgentID = groupID.Guid; |
1084 | msg.toAgentID = invitedAgentID.Guid; | 1050 | msg.toAgentID = invitedAgentID.Guid; |
1085 | //msg.timestamp = (uint)Util.UnixTimeSinceEpoch(); | 1051 | //msg.timestamp = (uint)Util.UnixTimeSinceEpoch(); |
@@ -1132,57 +1098,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
1132 | return child; | 1098 | return child; |
1133 | } | 1099 | } |
1134 | 1100 | ||
1135 | private GroupRequestID GetClientGroupRequestID(IClientAPI client) | ||
1136 | { | ||
1137 | if (client == null) | ||
1138 | { | ||
1139 | return new GroupRequestID(); | ||
1140 | } | ||
1141 | |||
1142 | lock (m_clientRequestIDInfo) | ||
1143 | { | ||
1144 | if (!m_clientRequestIDInfo.ContainsKey(client.AgentId)) | ||
1145 | { | ||
1146 | GroupRequestIDInfo info = new GroupRequestIDInfo(); | ||
1147 | info.RequestID.AgentID = client.AgentId; | ||
1148 | info.RequestID.SessionID = client.SessionId; | ||
1149 | |||
1150 | UserProfileData userProfile = m_sceneList[0].CommsManager.UserService.GetUserProfile(client.AgentId); | ||
1151 | if (userProfile == null) | ||
1152 | { | ||
1153 | // This should be impossible. If I've been passed a reference to a client | ||
1154 | // that client should be registered with the UserService. So something | ||
1155 | // is horribly wrong somewhere. | ||
1156 | |||
1157 | m_log.WarnFormat("[GROUPS]: Could not find a user profile for {0} / {1}", client.Name, client.AgentId); | ||
1158 | |||
1159 | // Default to local user service and hope for the best? | ||
1160 | info.RequestID.UserServiceURL = m_sceneList[0].CommsManager.NetworkServersInfo.UserURL; | ||
1161 | |||
1162 | } | ||
1163 | else if (userProfile is ForeignUserProfileData) | ||
1164 | { | ||
1165 | // They aren't from around here | ||
1166 | ForeignUserProfileData fupd = (ForeignUserProfileData)userProfile; | ||
1167 | info.RequestID.UserServiceURL = fupd.UserServerURI; | ||
1168 | } | ||
1169 | else | ||
1170 | { | ||
1171 | // They're a local user, use this: | ||
1172 | info.RequestID.UserServiceURL = m_sceneList[0].CommsManager.NetworkServersInfo.UserURL; | ||
1173 | } | ||
1174 | |||
1175 | m_clientRequestIDInfo.Add(client.AgentId, info); | ||
1176 | } | ||
1177 | |||
1178 | m_clientRequestIDInfo[client.AgentId].LastUsedTMStamp = DateTime.Now; | ||
1179 | |||
1180 | return m_clientRequestIDInfo[client.AgentId].RequestID; | ||
1181 | } | ||
1182 | // Unreachable code! | ||
1183 | // return new GroupRequestID(); | ||
1184 | } | ||
1185 | |||
1186 | /// <summary> | 1101 | /// <summary> |
1187 | /// Send 'remoteClient' the group membership 'data' for agent 'dataForAgentID'. | 1102 | /// Send 'remoteClient' the group membership 'data' for agent 'dataForAgentID'. |
1188 | /// </summary> | 1103 | /// </summary> |
@@ -1231,6 +1146,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
1231 | llDataStruct.Add("GroupData", GroupData); | 1146 | llDataStruct.Add("GroupData", GroupData); |
1232 | llDataStruct.Add("NewGroupData", NewGroupData); | 1147 | llDataStruct.Add("NewGroupData", NewGroupData); |
1233 | 1148 | ||
1149 | if (m_debugEnabled) | ||
1150 | { | ||
1151 | m_log.InfoFormat("[GROUPS]: {0}", OSDParser.SerializeJsonString(llDataStruct)); | ||
1152 | } | ||
1153 | |||
1234 | IEventQueue queue = remoteClient.Scene.RequestModuleInterface<IEventQueue>(); | 1154 | IEventQueue queue = remoteClient.Scene.RequestModuleInterface<IEventQueue>(); |
1235 | 1155 | ||
1236 | if (queue != null) | 1156 | if (queue != null) |
@@ -1308,7 +1228,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
1308 | /// <returns></returns> | 1228 | /// <returns></returns> |
1309 | private GroupMembershipData[] GetProfileListedGroupMemberships(IClientAPI requestingClient, UUID dataForAgentID) | 1229 | private GroupMembershipData[] GetProfileListedGroupMemberships(IClientAPI requestingClient, UUID dataForAgentID) |
1310 | { | 1230 | { |
1311 | List<GroupMembershipData> membershipData = m_groupData.GetAgentGroupMemberships(GetClientGroupRequestID(requestingClient), dataForAgentID); | 1231 | List<GroupMembershipData> membershipData = m_groupData.GetAgentGroupMemberships(requestingClient.AgentId, dataForAgentID); |
1312 | GroupMembershipData[] membershipArray; | 1232 | GroupMembershipData[] membershipArray; |
1313 | 1233 | ||
1314 | if (requestingClient.AgentId != dataForAgentID) | 1234 | if (requestingClient.AgentId != dataForAgentID) |
@@ -1330,7 +1250,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
1330 | m_log.InfoFormat("[GROUPS]: Get group membership information for {0} requested by {1}", dataForAgentID, requestingClient.AgentId); | 1250 | m_log.InfoFormat("[GROUPS]: Get group membership information for {0} requested by {1}", dataForAgentID, requestingClient.AgentId); |
1331 | foreach (GroupMembershipData membership in membershipArray) | 1251 | foreach (GroupMembershipData membership in membershipArray) |
1332 | { | 1252 | { |
1333 | m_log.InfoFormat("[GROUPS]: {0} :: {1} - {2}", dataForAgentID, membership.GroupName, membership.GroupTitle); | 1253 | m_log.InfoFormat("[GROUPS]: {0} :: {1} - {2} - {3}", dataForAgentID, membership.GroupName, membership.GroupTitle, membership.GroupPowers); |
1334 | } | 1254 | } |
1335 | } | 1255 | } |
1336 | 1256 | ||
@@ -1389,6 +1309,23 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
1389 | } | 1309 | } |
1390 | 1310 | ||
1391 | #endregion | 1311 | #endregion |
1312 | |||
1313 | private UUID GetRequestingAgentID(IClientAPI client) | ||
1314 | { | ||
1315 | UUID requestingAgentID = UUID.Zero; | ||
1316 | if (client != null) | ||
1317 | { | ||
1318 | requestingAgentID = client.AgentId; | ||
1319 | } | ||
1320 | return requestingAgentID; | ||
1321 | } | ||
1392 | } | 1322 | } |
1393 | 1323 | ||
1324 | public class GroupNoticeInfo | ||
1325 | { | ||
1326 | public GroupNoticeData noticeData = new GroupNoticeData(); | ||
1327 | public UUID GroupID = UUID.Zero; | ||
1328 | public string Message = string.Empty; | ||
1329 | public byte[] BinaryBucket = new byte[0]; | ||
1330 | } | ||
1394 | } | 1331 | } |
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/IGroupsServicesConnector.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/IGroupsServicesConnector.cs index 9e0fa2d..a046e09 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/IGroupsServicesConnector.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/IGroupsServicesConnector.cs | |||
@@ -36,42 +36,47 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
36 | { | 36 | { |
37 | interface IGroupsServicesConnector | 37 | interface IGroupsServicesConnector |
38 | { | 38 | { |
39 | UUID CreateGroup(GroupRequestID requestID, string name, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, bool allowPublish, bool maturePublish, UUID founderID); | 39 | UUID CreateGroup(UUID RequestingAgentID, string name, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, bool allowPublish, bool maturePublish, UUID founderID); |
40 | void UpdateGroup(GroupRequestID requestID, UUID groupID, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, bool allowPublish, bool maturePublish); | 40 | void UpdateGroup(UUID RequestingAgentID, UUID groupID, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, bool allowPublish, bool maturePublish); |
41 | GroupRecord GetGroupRecord(GroupRequestID requestID, UUID GroupID, string GroupName); | 41 | GroupRecord GetGroupRecord(UUID RequestingAgentID, UUID GroupID, string GroupName); |
42 | List<DirGroupsReplyData> FindGroups(GroupRequestID requestID, string search); | 42 | List<DirGroupsReplyData> FindGroups(UUID RequestingAgentID, string search); |
43 | List<GroupMembersData> GetGroupMembers(GroupRequestID requestID, UUID GroupID); | 43 | List<GroupMembersData> GetGroupMembers(UUID RequestingAgentID, UUID GroupID); |
44 | 44 | ||
45 | void AddGroupRole(GroupRequestID requestID, UUID groupID, UUID roleID, string name, string description, string title, ulong powers); | 45 | void AddGroupRole(UUID RequestingAgentID, UUID groupID, UUID roleID, string name, string description, string title, ulong powers); |
46 | void UpdateGroupRole(GroupRequestID requestID, UUID groupID, UUID roleID, string name, string description, string title, ulong powers); | 46 | void UpdateGroupRole(UUID RequestingAgentID, UUID groupID, UUID roleID, string name, string description, string title, ulong powers); |
47 | void RemoveGroupRole(GroupRequestID requestID, UUID groupID, UUID roleID); | 47 | void RemoveGroupRole(UUID RequestingAgentID, UUID groupID, UUID roleID); |
48 | List<GroupRolesData> GetGroupRoles(GroupRequestID requestID, UUID GroupID); | 48 | List<GroupRolesData> GetGroupRoles(UUID RequestingAgentID, UUID GroupID); |
49 | List<GroupRoleMembersData> GetGroupRoleMembers(GroupRequestID requestID, UUID GroupID); | 49 | List<GroupRoleMembersData> GetGroupRoleMembers(UUID RequestingAgentID, UUID GroupID); |
50 | 50 | ||
51 | void AddAgentToGroup(GroupRequestID requestID, UUID AgentID, UUID GroupID, UUID RoleID); | 51 | void AddAgentToGroup(UUID RequestingAgentID, UUID AgentID, UUID GroupID, UUID RoleID); |
52 | void RemoveAgentFromGroup(GroupRequestID requestID, UUID AgentID, UUID GroupID); | 52 | void RemoveAgentFromGroup(UUID RequestingAgentID, UUID AgentID, UUID GroupID); |
53 | 53 | ||
54 | void AddAgentToGroupInvite(GroupRequestID requestID, UUID inviteID, UUID groupID, UUID roleID, UUID agentID); | 54 | void AddAgentToGroupInvite(UUID RequestingAgentID, UUID inviteID, UUID groupID, UUID roleID, UUID agentID); |
55 | GroupInviteInfo GetAgentToGroupInvite(GroupRequestID requestID, UUID inviteID); | 55 | GroupInviteInfo GetAgentToGroupInvite(UUID RequestingAgentID, UUID inviteID); |
56 | void RemoveAgentToGroupInvite(GroupRequestID requestID, UUID inviteID); | 56 | void RemoveAgentToGroupInvite(UUID RequestingAgentID, UUID inviteID); |
57 | 57 | ||
58 | void AddAgentToGroupRole(UUID RequestingAgentID, UUID AgentID, UUID GroupID, UUID RoleID); | ||
59 | void RemoveAgentFromGroupRole(UUID RequestingAgentID, UUID AgentID, UUID GroupID, UUID RoleID); | ||
60 | List<GroupRolesData> GetAgentGroupRoles(UUID RequestingAgentID, UUID AgentID, UUID GroupID); | ||
58 | 61 | ||
59 | void AddAgentToGroupRole(GroupRequestID requestID, UUID AgentID, UUID GroupID, UUID RoleID); | 62 | void SetAgentActiveGroup(UUID RequestingAgentID, UUID AgentID, UUID GroupID); |
60 | void RemoveAgentFromGroupRole(GroupRequestID requestID, UUID AgentID, UUID GroupID, UUID RoleID); | 63 | GroupMembershipData GetAgentActiveMembership(UUID RequestingAgentID, UUID AgentID); |
61 | List<GroupRolesData> GetAgentGroupRoles(GroupRequestID requestID, UUID AgentID, UUID GroupID); | ||
62 | 64 | ||
63 | void SetAgentActiveGroup(GroupRequestID requestID, UUID AgentID, UUID GroupID); | 65 | void SetAgentActiveGroupRole(UUID RequestingAgentID, UUID AgentID, UUID GroupID, UUID RoleID); |
64 | GroupMembershipData GetAgentActiveMembership(GroupRequestID requestID, UUID AgentID); | 66 | void SetAgentGroupInfo(UUID RequestingAgentID, UUID AgentID, UUID GroupID, bool AcceptNotices, bool ListInProfile); |
65 | 67 | ||
66 | void SetAgentActiveGroupRole(GroupRequestID requestID, UUID AgentID, UUID GroupID, UUID RoleID); | 68 | GroupMembershipData GetAgentGroupMembership(UUID RequestingAgentID, UUID AgentID, UUID GroupID); |
67 | void SetAgentGroupInfo(GroupRequestID requestID, UUID AgentID, UUID GroupID, bool AcceptNotices, bool ListInProfile); | 69 | List<GroupMembershipData> GetAgentGroupMemberships(UUID RequestingAgentID, UUID AgentID); |
68 | 70 | ||
69 | GroupMembershipData GetAgentGroupMembership(GroupRequestID requestID, UUID AgentID, UUID GroupID); | 71 | void AddGroupNotice(UUID RequestingAgentID, UUID groupID, UUID noticeID, string fromName, string subject, string message, byte[] binaryBucket); |
70 | List<GroupMembershipData> GetAgentGroupMemberships(GroupRequestID requestID, UUID AgentID); | 72 | GroupNoticeInfo GetGroupNotice(UUID RequestingAgentID, UUID noticeID); |
73 | List<GroupNoticeData> GetGroupNotices(UUID RequestingAgentID, UUID GroupID); | ||
71 | 74 | ||
72 | void AddGroupNotice(GroupRequestID requestID, UUID groupID, UUID noticeID, string fromName, string subject, string message, byte[] binaryBucket); | 75 | void ResetAgentGroupChatSessions(UUID agentID); |
73 | GroupNoticeInfo GetGroupNotice(GroupRequestID requestID, UUID noticeID); | 76 | bool hasAgentBeenInvitedToGroupChatSession(UUID agentID, UUID groupID); |
74 | List<GroupNoticeData> GetGroupNotices(GroupRequestID requestID, UUID GroupID); | 77 | bool hasAgentDroppedGroupChatSession(UUID agentID, UUID groupID); |
78 | void AgentDroppedFromGroupChatSession(UUID agentID, UUID groupID); | ||
79 | void AgentInvitedToGroupChatSession(UUID agentID, UUID groupID); | ||
75 | } | 80 | } |
76 | 81 | ||
77 | public class GroupInviteInfo | 82 | public class GroupInviteInfo |
@@ -81,11 +86,4 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
81 | public UUID AgentID = UUID.Zero; | 86 | public UUID AgentID = UUID.Zero; |
82 | public UUID InviteID = UUID.Zero; | 87 | public UUID InviteID = UUID.Zero; |
83 | } | 88 | } |
84 | |||
85 | public class GroupRequestID | ||
86 | { | ||
87 | public UUID AgentID = UUID.Zero; | ||
88 | public string UserServiceURL = string.Empty; | ||
89 | public UUID SessionID = UUID.Zero; | ||
90 | } | ||
91 | } | 89 | } |
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs index 964d0bb..2a60b00 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs | |||
@@ -47,9 +47,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
47 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] | 47 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] |
48 | public class XmlRpcGroupsServicesConnectorModule : ISharedRegionModule, IGroupsServicesConnector | 48 | public class XmlRpcGroupsServicesConnectorModule : ISharedRegionModule, IGroupsServicesConnector |
49 | { | 49 | { |
50 | private static readonly ILog m_log = | 50 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
51 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
52 | |||
53 | 51 | ||
54 | public const GroupPowers m_DefaultEveryonePowers = GroupPowers.AllowSetHome | | 52 | public const GroupPowers m_DefaultEveryonePowers = GroupPowers.AllowSetHome | |
55 | GroupPowers.Accountable | | 53 | GroupPowers.Accountable | |
@@ -61,7 +59,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
61 | 59 | ||
62 | private bool m_connectorEnabled = false; | 60 | private bool m_connectorEnabled = false; |
63 | 61 | ||
64 | private string m_serviceURL = string.Empty; | 62 | private string m_groupsServerURI = string.Empty; |
65 | 63 | ||
66 | private bool m_disableKeepAlive = false; | 64 | private bool m_disableKeepAlive = false; |
67 | 65 | ||
@@ -69,6 +67,14 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
69 | private string m_groupWriteKey = string.Empty; | 67 | private string m_groupWriteKey = string.Empty; |
70 | 68 | ||
71 | 69 | ||
70 | // Used to track which agents are have dropped from a group chat session | ||
71 | // Should be reset per agent, on logon | ||
72 | // TODO: move this to Flotsam XmlRpc Service | ||
73 | // SessionID, List<AgentID> | ||
74 | private Dictionary<UUID, List<UUID>> m_groupsAgentsDroppedFromChatSession = new Dictionary<UUID, List<UUID>>(); | ||
75 | private Dictionary<UUID, List<UUID>> m_groupsAgentsInvitedToChatSession = new Dictionary<UUID, List<UUID>>(); | ||
76 | |||
77 | |||
72 | #region IRegionModuleBase Members | 78 | #region IRegionModuleBase Members |
73 | 79 | ||
74 | public string Name | 80 | public string Name |
@@ -104,11 +110,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
104 | 110 | ||
105 | m_log.InfoFormat("[GROUPS-CONNECTOR]: Initializing {0}", this.Name); | 111 | m_log.InfoFormat("[GROUPS-CONNECTOR]: Initializing {0}", this.Name); |
106 | 112 | ||
107 | m_serviceURL = groupsConfig.GetString("XmlRpcServiceURL", string.Empty); | 113 | m_groupsServerURI = groupsConfig.GetString("GroupsServerURI", string.Empty); |
108 | if ((m_serviceURL == null) || | 114 | if ((m_groupsServerURI == null) || |
109 | (m_serviceURL == string.Empty)) | 115 | (m_groupsServerURI == string.Empty)) |
110 | { | 116 | { |
111 | m_log.ErrorFormat("Please specify a valid URL for XmlRpcServiceURL in OpenSim.ini, [Groups]"); | 117 | m_log.ErrorFormat("Please specify a valid URL for GroupsServerURI in OpenSim.ini, [Groups]"); |
112 | m_connectorEnabled = false; | 118 | m_connectorEnabled = false; |
113 | return; | 119 | return; |
114 | } | 120 | } |
@@ -118,6 +124,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
118 | m_groupReadKey = groupsConfig.GetString("XmlRpcServiceReadKey", string.Empty); | 124 | m_groupReadKey = groupsConfig.GetString("XmlRpcServiceReadKey", string.Empty); |
119 | m_groupWriteKey = groupsConfig.GetString("XmlRpcServiceWriteKey", string.Empty); | 125 | m_groupWriteKey = groupsConfig.GetString("XmlRpcServiceWriteKey", string.Empty); |
120 | 126 | ||
127 | |||
128 | |||
129 | |||
121 | // If we got all the config options we need, lets start'er'up | 130 | // If we got all the config options we need, lets start'er'up |
122 | m_connectorEnabled = true; | 131 | m_connectorEnabled = true; |
123 | } | 132 | } |
@@ -131,13 +140,17 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
131 | public void AddRegion(OpenSim.Region.Framework.Scenes.Scene scene) | 140 | public void AddRegion(OpenSim.Region.Framework.Scenes.Scene scene) |
132 | { | 141 | { |
133 | if (m_connectorEnabled) | 142 | if (m_connectorEnabled) |
143 | { | ||
134 | scene.RegisterModuleInterface<IGroupsServicesConnector>(this); | 144 | scene.RegisterModuleInterface<IGroupsServicesConnector>(this); |
145 | } | ||
135 | } | 146 | } |
136 | 147 | ||
137 | public void RemoveRegion(OpenSim.Region.Framework.Scenes.Scene scene) | 148 | public void RemoveRegion(OpenSim.Region.Framework.Scenes.Scene scene) |
138 | { | 149 | { |
139 | if (scene.RequestModuleInterface<IGroupsServicesConnector>() == this) | 150 | if (scene.RequestModuleInterface<IGroupsServicesConnector>() == this) |
151 | { | ||
140 | scene.UnregisterModuleInterface<IGroupsServicesConnector>(this); | 152 | scene.UnregisterModuleInterface<IGroupsServicesConnector>(this); |
153 | } | ||
141 | } | 154 | } |
142 | 155 | ||
143 | public void RegionLoaded(OpenSim.Region.Framework.Scenes.Scene scene) | 156 | public void RegionLoaded(OpenSim.Region.Framework.Scenes.Scene scene) |
@@ -157,14 +170,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
157 | 170 | ||
158 | #endregion | 171 | #endregion |
159 | 172 | ||
160 | |||
161 | |||
162 | #region IGroupsServicesConnector Members | 173 | #region IGroupsServicesConnector Members |
163 | 174 | ||
164 | /// <summary> | 175 | /// <summary> |
165 | /// Create a Group, including Everyone and Owners Role, place FounderID in both groups, select Owner as selected role, and newly created group as agent's active role. | 176 | /// Create a Group, including Everyone and Owners Role, place FounderID in both groups, select Owner as selected role, and newly created group as agent's active role. |
166 | /// </summary> | 177 | /// </summary> |
167 | public UUID CreateGroup(GroupRequestID requestID, string name, string charter, bool showInList, UUID insigniaID, | 178 | public UUID CreateGroup(UUID requestingAgentID, string name, string charter, bool showInList, UUID insigniaID, |
168 | int membershipFee, bool openEnrollment, bool allowPublish, | 179 | int membershipFee, bool openEnrollment, bool allowPublish, |
169 | bool maturePublish, UUID founderID) | 180 | bool maturePublish, UUID founderID) |
170 | { | 181 | { |
@@ -236,7 +247,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
236 | 247 | ||
237 | 248 | ||
238 | 249 | ||
239 | Hashtable respData = XmlRpcCall(requestID, "groups.createGroup", param); | 250 | Hashtable respData = XmlRpcCall(requestingAgentID, "groups.createGroup", param); |
240 | 251 | ||
241 | if (respData.Contains("error")) | 252 | if (respData.Contains("error")) |
242 | { | 253 | { |
@@ -248,7 +259,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
248 | return UUID.Parse((string)respData["GroupID"]); | 259 | return UUID.Parse((string)respData["GroupID"]); |
249 | } | 260 | } |
250 | 261 | ||
251 | public void UpdateGroup(GroupRequestID requestID, UUID groupID, string charter, bool showInList, | 262 | public void UpdateGroup(UUID requestingAgentID, UUID groupID, string charter, bool showInList, |
252 | UUID insigniaID, int membershipFee, bool openEnrollment, | 263 | UUID insigniaID, int membershipFee, bool openEnrollment, |
253 | bool allowPublish, bool maturePublish) | 264 | bool allowPublish, bool maturePublish) |
254 | { | 265 | { |
@@ -262,10 +273,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
262 | param["AllowPublish"] = allowPublish == true ? 1 : 0; | 273 | param["AllowPublish"] = allowPublish == true ? 1 : 0; |
263 | param["MaturePublish"] = maturePublish == true ? 1 : 0; | 274 | param["MaturePublish"] = maturePublish == true ? 1 : 0; |
264 | 275 | ||
265 | XmlRpcCall(requestID, "groups.updateGroup", param); | 276 | XmlRpcCall(requestingAgentID, "groups.updateGroup", param); |
266 | } | 277 | } |
267 | 278 | ||
268 | public void AddGroupRole(GroupRequestID requestID, UUID groupID, UUID roleID, string name, string description, | 279 | public void AddGroupRole(UUID requestingAgentID, UUID groupID, UUID roleID, string name, string description, |
269 | string title, ulong powers) | 280 | string title, ulong powers) |
270 | { | 281 | { |
271 | Hashtable param = new Hashtable(); | 282 | Hashtable param = new Hashtable(); |
@@ -276,19 +287,19 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
276 | param["Title"] = title; | 287 | param["Title"] = title; |
277 | param["Powers"] = powers.ToString(); | 288 | param["Powers"] = powers.ToString(); |
278 | 289 | ||
279 | XmlRpcCall(requestID, "groups.addRoleToGroup", param); | 290 | XmlRpcCall(requestingAgentID, "groups.addRoleToGroup", param); |
280 | } | 291 | } |
281 | 292 | ||
282 | public void RemoveGroupRole(GroupRequestID requestID, UUID groupID, UUID roleID) | 293 | public void RemoveGroupRole(UUID requestingAgentID, UUID groupID, UUID roleID) |
283 | { | 294 | { |
284 | Hashtable param = new Hashtable(); | 295 | Hashtable param = new Hashtable(); |
285 | param["GroupID"] = groupID.ToString(); | 296 | param["GroupID"] = groupID.ToString(); |
286 | param["RoleID"] = roleID.ToString(); | 297 | param["RoleID"] = roleID.ToString(); |
287 | 298 | ||
288 | XmlRpcCall(requestID, "groups.removeRoleFromGroup", param); | 299 | XmlRpcCall(requestingAgentID, "groups.removeRoleFromGroup", param); |
289 | } | 300 | } |
290 | 301 | ||
291 | public void UpdateGroupRole(GroupRequestID requestID, UUID groupID, UUID roleID, string name, string description, | 302 | public void UpdateGroupRole(UUID requestingAgentID, UUID groupID, UUID roleID, string name, string description, |
292 | string title, ulong powers) | 303 | string title, ulong powers) |
293 | { | 304 | { |
294 | Hashtable param = new Hashtable(); | 305 | Hashtable param = new Hashtable(); |
@@ -308,10 +319,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
308 | } | 319 | } |
309 | param["Powers"] = powers.ToString(); | 320 | param["Powers"] = powers.ToString(); |
310 | 321 | ||
311 | XmlRpcCall(requestID, "groups.updateGroupRole", param); | 322 | XmlRpcCall(requestingAgentID, "groups.updateGroupRole", param); |
312 | } | 323 | } |
313 | 324 | ||
314 | public GroupRecord GetGroupRecord(GroupRequestID requestID, UUID GroupID, string GroupName) | 325 | public GroupRecord GetGroupRecord(UUID requestingAgentID, UUID GroupID, string GroupName) |
315 | { | 326 | { |
316 | Hashtable param = new Hashtable(); | 327 | Hashtable param = new Hashtable(); |
317 | if (GroupID != UUID.Zero) | 328 | if (GroupID != UUID.Zero) |
@@ -323,7 +334,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
323 | param["Name"] = GroupName.ToString(); | 334 | param["Name"] = GroupName.ToString(); |
324 | } | 335 | } |
325 | 336 | ||
326 | Hashtable respData = XmlRpcCall(requestID, "groups.getGroup", param); | 337 | Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getGroup", param); |
327 | 338 | ||
328 | if (respData.Contains("error")) | 339 | if (respData.Contains("error")) |
329 | { | 340 | { |
@@ -334,12 +345,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
334 | 345 | ||
335 | } | 346 | } |
336 | 347 | ||
337 | public GroupProfileData GetMemberGroupProfile(GroupRequestID requestID, UUID GroupID, UUID AgentID) | 348 | public GroupProfileData GetMemberGroupProfile(UUID requestingAgentID, UUID GroupID, UUID AgentID) |
338 | { | 349 | { |
339 | Hashtable param = new Hashtable(); | 350 | Hashtable param = new Hashtable(); |
340 | param["GroupID"] = GroupID.ToString(); | 351 | param["GroupID"] = GroupID.ToString(); |
341 | 352 | ||
342 | Hashtable respData = XmlRpcCall(requestID, "groups.getGroup", param); | 353 | Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getGroup", param); |
343 | 354 | ||
344 | if (respData.Contains("error")) | 355 | if (respData.Contains("error")) |
345 | { | 356 | { |
@@ -347,38 +358,35 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
347 | return new GroupProfileData(); | 358 | return new GroupProfileData(); |
348 | } | 359 | } |
349 | 360 | ||
350 | GroupMembershipData MemberInfo = GetAgentGroupMembership(requestID, AgentID, GroupID); | 361 | GroupMembershipData MemberInfo = GetAgentGroupMembership(requestingAgentID, AgentID, GroupID); |
351 | GroupProfileData MemberGroupProfile = GroupProfileHashtableToGroupProfileData(respData); | 362 | GroupProfileData MemberGroupProfile = GroupProfileHashtableToGroupProfileData(respData); |
352 | 363 | ||
353 | MemberGroupProfile.MemberTitle = MemberInfo.GroupTitle; | 364 | MemberGroupProfile.MemberTitle = MemberInfo.GroupTitle; |
354 | MemberGroupProfile.PowersMask = MemberInfo.GroupPowers; | 365 | MemberGroupProfile.PowersMask = MemberInfo.GroupPowers; |
355 | 366 | ||
356 | return MemberGroupProfile; | 367 | return MemberGroupProfile; |
357 | |||
358 | } | 368 | } |
359 | 369 | ||
360 | 370 | public void SetAgentActiveGroup(UUID requestingAgentID, UUID AgentID, UUID GroupID) | |
361 | |||
362 | public void SetAgentActiveGroup(GroupRequestID requestID, UUID AgentID, UUID GroupID) | ||
363 | { | 371 | { |
364 | Hashtable param = new Hashtable(); | 372 | Hashtable param = new Hashtable(); |
365 | param["AgentID"] = AgentID.ToString(); | 373 | param["AgentID"] = AgentID.ToString(); |
366 | param["GroupID"] = GroupID.ToString(); | 374 | param["GroupID"] = GroupID.ToString(); |
367 | 375 | ||
368 | XmlRpcCall(requestID, "groups.setAgentActiveGroup", param); | 376 | XmlRpcCall(requestingAgentID, "groups.setAgentActiveGroup", param); |
369 | } | 377 | } |
370 | 378 | ||
371 | public void SetAgentActiveGroupRole(GroupRequestID requestID, UUID AgentID, UUID GroupID, UUID RoleID) | 379 | public void SetAgentActiveGroupRole(UUID requestingAgentID, UUID AgentID, UUID GroupID, UUID RoleID) |
372 | { | 380 | { |
373 | Hashtable param = new Hashtable(); | 381 | Hashtable param = new Hashtable(); |
374 | param["AgentID"] = AgentID.ToString(); | 382 | param["AgentID"] = AgentID.ToString(); |
375 | param["GroupID"] = GroupID.ToString(); | 383 | param["GroupID"] = GroupID.ToString(); |
376 | param["SelectedRoleID"] = RoleID.ToString(); | 384 | param["SelectedRoleID"] = RoleID.ToString(); |
377 | 385 | ||
378 | XmlRpcCall(requestID, "groups.setAgentGroupInfo", param); | 386 | XmlRpcCall(requestingAgentID, "groups.setAgentGroupInfo", param); |
379 | } | 387 | } |
380 | 388 | ||
381 | public void SetAgentGroupInfo(GroupRequestID requestID, UUID AgentID, UUID GroupID, bool AcceptNotices, bool ListInProfile) | 389 | public void SetAgentGroupInfo(UUID requestingAgentID, UUID AgentID, UUID GroupID, bool AcceptNotices, bool ListInProfile) |
382 | { | 390 | { |
383 | Hashtable param = new Hashtable(); | 391 | Hashtable param = new Hashtable(); |
384 | param["AgentID"] = AgentID.ToString(); | 392 | param["AgentID"] = AgentID.ToString(); |
@@ -386,11 +394,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
386 | param["AcceptNotices"] = AcceptNotices ? "1" : "0"; | 394 | param["AcceptNotices"] = AcceptNotices ? "1" : "0"; |
387 | param["ListInProfile"] = ListInProfile ? "1" : "0"; | 395 | param["ListInProfile"] = ListInProfile ? "1" : "0"; |
388 | 396 | ||
389 | XmlRpcCall(requestID, "groups.setAgentGroupInfo", param); | 397 | XmlRpcCall(requestingAgentID, "groups.setAgentGroupInfo", param); |
390 | 398 | ||
391 | } | 399 | } |
392 | 400 | ||
393 | public void AddAgentToGroupInvite(GroupRequestID requestID, UUID inviteID, UUID groupID, UUID roleID, UUID agentID) | 401 | public void AddAgentToGroupInvite(UUID requestingAgentID, UUID inviteID, UUID groupID, UUID roleID, UUID agentID) |
394 | { | 402 | { |
395 | Hashtable param = new Hashtable(); | 403 | Hashtable param = new Hashtable(); |
396 | param["InviteID"] = inviteID.ToString(); | 404 | param["InviteID"] = inviteID.ToString(); |
@@ -398,16 +406,16 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
398 | param["RoleID"] = roleID.ToString(); | 406 | param["RoleID"] = roleID.ToString(); |
399 | param["GroupID"] = groupID.ToString(); | 407 | param["GroupID"] = groupID.ToString(); |
400 | 408 | ||
401 | XmlRpcCall(requestID, "groups.addAgentToGroupInvite", param); | 409 | XmlRpcCall(requestingAgentID, "groups.addAgentToGroupInvite", param); |
402 | 410 | ||
403 | } | 411 | } |
404 | 412 | ||
405 | public GroupInviteInfo GetAgentToGroupInvite(GroupRequestID requestID, UUID inviteID) | 413 | public GroupInviteInfo GetAgentToGroupInvite(UUID requestingAgentID, UUID inviteID) |
406 | { | 414 | { |
407 | Hashtable param = new Hashtable(); | 415 | Hashtable param = new Hashtable(); |
408 | param["InviteID"] = inviteID.ToString(); | 416 | param["InviteID"] = inviteID.ToString(); |
409 | 417 | ||
410 | Hashtable respData = XmlRpcCall(requestID, "groups.getAgentToGroupInvite", param); | 418 | Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getAgentToGroupInvite", param); |
411 | 419 | ||
412 | if (respData.Contains("error")) | 420 | if (respData.Contains("error")) |
413 | { | 421 | { |
@@ -423,60 +431,59 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
423 | return inviteInfo; | 431 | return inviteInfo; |
424 | } | 432 | } |
425 | 433 | ||
426 | public void RemoveAgentToGroupInvite(GroupRequestID requestID, UUID inviteID) | 434 | public void RemoveAgentToGroupInvite(UUID requestingAgentID, UUID inviteID) |
427 | { | 435 | { |
428 | Hashtable param = new Hashtable(); | 436 | Hashtable param = new Hashtable(); |
429 | param["InviteID"] = inviteID.ToString(); | 437 | param["InviteID"] = inviteID.ToString(); |
430 | 438 | ||
431 | XmlRpcCall(requestID, "groups.removeAgentToGroupInvite", param); | 439 | XmlRpcCall(requestingAgentID, "groups.removeAgentToGroupInvite", param); |
432 | } | 440 | } |
433 | 441 | ||
434 | public void AddAgentToGroup(GroupRequestID requestID, UUID AgentID, UUID GroupID, UUID RoleID) | 442 | public void AddAgentToGroup(UUID requestingAgentID, UUID AgentID, UUID GroupID, UUID RoleID) |
435 | { | 443 | { |
436 | Hashtable param = new Hashtable(); | 444 | Hashtable param = new Hashtable(); |
437 | param["AgentID"] = AgentID.ToString(); | 445 | param["AgentID"] = AgentID.ToString(); |
438 | param["GroupID"] = GroupID.ToString(); | 446 | param["GroupID"] = GroupID.ToString(); |
439 | param["RoleID"] = RoleID.ToString(); | 447 | param["RoleID"] = RoleID.ToString(); |
440 | 448 | ||
441 | XmlRpcCall(requestID, "groups.addAgentToGroup", param); | 449 | XmlRpcCall(requestingAgentID, "groups.addAgentToGroup", param); |
442 | } | 450 | } |
443 | 451 | ||
444 | public void RemoveAgentFromGroup(GroupRequestID requestID, UUID AgentID, UUID GroupID) | 452 | public void RemoveAgentFromGroup(UUID requestingAgentID, UUID AgentID, UUID GroupID) |
445 | { | 453 | { |
446 | Hashtable param = new Hashtable(); | 454 | Hashtable param = new Hashtable(); |
447 | param["AgentID"] = AgentID.ToString(); | 455 | param["AgentID"] = AgentID.ToString(); |
448 | param["GroupID"] = GroupID.ToString(); | 456 | param["GroupID"] = GroupID.ToString(); |
449 | 457 | ||
450 | XmlRpcCall(requestID, "groups.removeAgentFromGroup", param); | 458 | XmlRpcCall(requestingAgentID, "groups.removeAgentFromGroup", param); |
451 | } | 459 | } |
452 | 460 | ||
453 | public void AddAgentToGroupRole(GroupRequestID requestID, UUID AgentID, UUID GroupID, UUID RoleID) | 461 | public void AddAgentToGroupRole(UUID requestingAgentID, UUID AgentID, UUID GroupID, UUID RoleID) |
454 | { | 462 | { |
455 | Hashtable param = new Hashtable(); | 463 | Hashtable param = new Hashtable(); |
456 | param["AgentID"] = AgentID.ToString(); | 464 | param["AgentID"] = AgentID.ToString(); |
457 | param["GroupID"] = GroupID.ToString(); | 465 | param["GroupID"] = GroupID.ToString(); |
458 | param["RoleID"] = RoleID.ToString(); | 466 | param["RoleID"] = RoleID.ToString(); |
459 | 467 | ||
460 | XmlRpcCall(requestID, "groups.addAgentToGroupRole", param); | 468 | XmlRpcCall(requestingAgentID, "groups.addAgentToGroupRole", param); |
461 | } | 469 | } |
462 | 470 | ||
463 | public void RemoveAgentFromGroupRole(GroupRequestID requestID, UUID AgentID, UUID GroupID, UUID RoleID) | 471 | public void RemoveAgentFromGroupRole(UUID requestingAgentID, UUID AgentID, UUID GroupID, UUID RoleID) |
464 | { | 472 | { |
465 | Hashtable param = new Hashtable(); | 473 | Hashtable param = new Hashtable(); |
466 | param["AgentID"] = AgentID.ToString(); | 474 | param["AgentID"] = AgentID.ToString(); |
467 | param["GroupID"] = GroupID.ToString(); | 475 | param["GroupID"] = GroupID.ToString(); |
468 | param["RoleID"] = RoleID.ToString(); | 476 | param["RoleID"] = RoleID.ToString(); |
469 | 477 | ||
470 | XmlRpcCall(requestID, "groups.removeAgentFromGroupRole", param); | 478 | XmlRpcCall(requestingAgentID, "groups.removeAgentFromGroupRole", param); |
471 | } | 479 | } |
472 | 480 | ||
473 | 481 | public List<DirGroupsReplyData> FindGroups(UUID requestingAgentID, string search) | |
474 | public List<DirGroupsReplyData> FindGroups(GroupRequestID requestID, string search) | ||
475 | { | 482 | { |
476 | Hashtable param = new Hashtable(); | 483 | Hashtable param = new Hashtable(); |
477 | param["Search"] = search; | 484 | param["Search"] = search; |
478 | 485 | ||
479 | Hashtable respData = XmlRpcCall(requestID, "groups.findGroups", param); | 486 | Hashtable respData = XmlRpcCall(requestingAgentID, "groups.findGroups", param); |
480 | 487 | ||
481 | List<DirGroupsReplyData> findings = new List<DirGroupsReplyData>(); | 488 | List<DirGroupsReplyData> findings = new List<DirGroupsReplyData>(); |
482 | 489 | ||
@@ -498,13 +505,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
498 | return findings; | 505 | return findings; |
499 | } | 506 | } |
500 | 507 | ||
501 | public GroupMembershipData GetAgentGroupMembership(GroupRequestID requestID, UUID AgentID, UUID GroupID) | 508 | public GroupMembershipData GetAgentGroupMembership(UUID requestingAgentID, UUID AgentID, UUID GroupID) |
502 | { | 509 | { |
503 | Hashtable param = new Hashtable(); | 510 | Hashtable param = new Hashtable(); |
504 | param["AgentID"] = AgentID.ToString(); | 511 | param["AgentID"] = AgentID.ToString(); |
505 | param["GroupID"] = GroupID.ToString(); | 512 | param["GroupID"] = GroupID.ToString(); |
506 | 513 | ||
507 | Hashtable respData = XmlRpcCall(requestID, "groups.getAgentGroupMembership", param); | 514 | Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getAgentGroupMembership", param); |
508 | 515 | ||
509 | if (respData.Contains("error")) | 516 | if (respData.Contains("error")) |
510 | { | 517 | { |
@@ -516,12 +523,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
516 | return data; | 523 | return data; |
517 | } | 524 | } |
518 | 525 | ||
519 | public GroupMembershipData GetAgentActiveMembership(GroupRequestID requestID, UUID AgentID) | 526 | public GroupMembershipData GetAgentActiveMembership(UUID requestingAgentID, UUID AgentID) |
520 | { | 527 | { |
521 | Hashtable param = new Hashtable(); | 528 | Hashtable param = new Hashtable(); |
522 | param["AgentID"] = AgentID.ToString(); | 529 | param["AgentID"] = AgentID.ToString(); |
523 | 530 | ||
524 | Hashtable respData = XmlRpcCall(requestID, "groups.getAgentActiveMembership", param); | 531 | Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getAgentActiveMembership", param); |
525 | 532 | ||
526 | if (respData.Contains("error")) | 533 | if (respData.Contains("error")) |
527 | { | 534 | { |
@@ -531,13 +538,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
531 | return HashTableToGroupMembershipData(respData); | 538 | return HashTableToGroupMembershipData(respData); |
532 | } | 539 | } |
533 | 540 | ||
534 | 541 | public List<GroupMembershipData> GetAgentGroupMemberships(UUID requestingAgentID, UUID AgentID) | |
535 | public List<GroupMembershipData> GetAgentGroupMemberships(GroupRequestID requestID, UUID AgentID) | ||
536 | { | 542 | { |
537 | Hashtable param = new Hashtable(); | 543 | Hashtable param = new Hashtable(); |
538 | param["AgentID"] = AgentID.ToString(); | 544 | param["AgentID"] = AgentID.ToString(); |
539 | 545 | ||
540 | Hashtable respData = XmlRpcCall(requestID, "groups.getAgentGroupMemberships", param); | 546 | Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getAgentGroupMemberships", param); |
541 | 547 | ||
542 | List<GroupMembershipData> memberships = new List<GroupMembershipData>(); | 548 | List<GroupMembershipData> memberships = new List<GroupMembershipData>(); |
543 | 549 | ||
@@ -552,13 +558,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
552 | return memberships; | 558 | return memberships; |
553 | } | 559 | } |
554 | 560 | ||
555 | public List<GroupRolesData> GetAgentGroupRoles(GroupRequestID requestID, UUID AgentID, UUID GroupID) | 561 | public List<GroupRolesData> GetAgentGroupRoles(UUID requestingAgentID, UUID AgentID, UUID GroupID) |
556 | { | 562 | { |
557 | Hashtable param = new Hashtable(); | 563 | Hashtable param = new Hashtable(); |
558 | param["AgentID"] = AgentID.ToString(); | 564 | param["AgentID"] = AgentID.ToString(); |
559 | param["GroupID"] = GroupID.ToString(); | 565 | param["GroupID"] = GroupID.ToString(); |
560 | 566 | ||
561 | Hashtable respData = XmlRpcCall(requestID, "groups.getAgentRoles", param); | 567 | Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getAgentRoles", param); |
562 | 568 | ||
563 | List<GroupRolesData> Roles = new List<GroupRolesData>(); | 569 | List<GroupRolesData> Roles = new List<GroupRolesData>(); |
564 | 570 | ||
@@ -584,12 +590,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
584 | 590 | ||
585 | } | 591 | } |
586 | 592 | ||
587 | public List<GroupRolesData> GetGroupRoles(GroupRequestID requestID, UUID GroupID) | 593 | public List<GroupRolesData> GetGroupRoles(UUID requestingAgentID, UUID GroupID) |
588 | { | 594 | { |
589 | Hashtable param = new Hashtable(); | 595 | Hashtable param = new Hashtable(); |
590 | param["GroupID"] = GroupID.ToString(); | 596 | param["GroupID"] = GroupID.ToString(); |
591 | 597 | ||
592 | Hashtable respData = XmlRpcCall(requestID, "groups.getGroupRoles", param); | 598 | Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getGroupRoles", param); |
593 | 599 | ||
594 | List<GroupRolesData> Roles = new List<GroupRolesData>(); | 600 | List<GroupRolesData> Roles = new List<GroupRolesData>(); |
595 | 601 | ||
@@ -617,12 +623,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
617 | 623 | ||
618 | 624 | ||
619 | 625 | ||
620 | public List<GroupMembersData> GetGroupMembers(GroupRequestID requestID, UUID GroupID) | 626 | public List<GroupMembersData> GetGroupMembers(UUID requestingAgentID, UUID GroupID) |
621 | { | 627 | { |
622 | Hashtable param = new Hashtable(); | 628 | Hashtable param = new Hashtable(); |
623 | param["GroupID"] = GroupID.ToString(); | 629 | param["GroupID"] = GroupID.ToString(); |
624 | 630 | ||
625 | Hashtable respData = XmlRpcCall(requestID, "groups.getGroupMembers", param); | 631 | Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getGroupMembers", param); |
626 | 632 | ||
627 | List<GroupMembersData> members = new List<GroupMembersData>(); | 633 | List<GroupMembersData> members = new List<GroupMembersData>(); |
628 | 634 | ||
@@ -650,12 +656,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
650 | 656 | ||
651 | } | 657 | } |
652 | 658 | ||
653 | public List<GroupRoleMembersData> GetGroupRoleMembers(GroupRequestID requestID, UUID GroupID) | 659 | public List<GroupRoleMembersData> GetGroupRoleMembers(UUID requestingAgentID, UUID GroupID) |
654 | { | 660 | { |
655 | Hashtable param = new Hashtable(); | 661 | Hashtable param = new Hashtable(); |
656 | param["GroupID"] = GroupID.ToString(); | 662 | param["GroupID"] = GroupID.ToString(); |
657 | 663 | ||
658 | Hashtable respData = XmlRpcCall(requestID, "groups.getGroupRoleMembers", param); | 664 | Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getGroupRoleMembers", param); |
659 | 665 | ||
660 | List<GroupRoleMembersData> members = new List<GroupRoleMembersData>(); | 666 | List<GroupRoleMembersData> members = new List<GroupRoleMembersData>(); |
661 | 667 | ||
@@ -674,12 +680,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
674 | return members; | 680 | return members; |
675 | } | 681 | } |
676 | 682 | ||
677 | public List<GroupNoticeData> GetGroupNotices(GroupRequestID requestID, UUID GroupID) | 683 | public List<GroupNoticeData> GetGroupNotices(UUID requestingAgentID, UUID GroupID) |
678 | { | 684 | { |
679 | Hashtable param = new Hashtable(); | 685 | Hashtable param = new Hashtable(); |
680 | param["GroupID"] = GroupID.ToString(); | 686 | param["GroupID"] = GroupID.ToString(); |
681 | 687 | ||
682 | Hashtable respData = XmlRpcCall(requestID, "groups.getGroupNotices", param); | 688 | Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getGroupNotices", param); |
683 | 689 | ||
684 | List<GroupNoticeData> values = new List<GroupNoticeData>(); | 690 | List<GroupNoticeData> values = new List<GroupNoticeData>(); |
685 | 691 | ||
@@ -701,12 +707,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
701 | return values; | 707 | return values; |
702 | 708 | ||
703 | } | 709 | } |
704 | public GroupNoticeInfo GetGroupNotice(GroupRequestID requestID, UUID noticeID) | 710 | public GroupNoticeInfo GetGroupNotice(UUID requestingAgentID, UUID noticeID) |
705 | { | 711 | { |
706 | Hashtable param = new Hashtable(); | 712 | Hashtable param = new Hashtable(); |
707 | param["NoticeID"] = noticeID.ToString(); | 713 | param["NoticeID"] = noticeID.ToString(); |
708 | 714 | ||
709 | Hashtable respData = XmlRpcCall(requestID, "groups.getGroupNotice", param); | 715 | Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getGroupNotice", param); |
710 | 716 | ||
711 | 717 | ||
712 | if (respData.Contains("error")) | 718 | if (respData.Contains("error")) |
@@ -732,7 +738,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
732 | 738 | ||
733 | return data; | 739 | return data; |
734 | } | 740 | } |
735 | public void AddGroupNotice(GroupRequestID requestID, UUID groupID, UUID noticeID, string fromName, string subject, string message, byte[] binaryBucket) | 741 | public void AddGroupNotice(UUID requestingAgentID, UUID groupID, UUID noticeID, string fromName, string subject, string message, byte[] binaryBucket) |
736 | { | 742 | { |
737 | string binBucket = OpenMetaverse.Utils.BytesToHexString(binaryBucket, ""); | 743 | string binBucket = OpenMetaverse.Utils.BytesToHexString(binaryBucket, ""); |
738 | 744 | ||
@@ -745,7 +751,70 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
745 | param["BinaryBucket"] = binBucket; | 751 | param["BinaryBucket"] = binBucket; |
746 | param["TimeStamp"] = ((uint)Util.UnixTimeSinceEpoch()).ToString(); | 752 | param["TimeStamp"] = ((uint)Util.UnixTimeSinceEpoch()).ToString(); |
747 | 753 | ||
748 | XmlRpcCall(requestID, "groups.addGroupNotice", param); | 754 | XmlRpcCall(requestingAgentID, "groups.addGroupNotice", param); |
755 | } | ||
756 | |||
757 | |||
758 | |||
759 | #endregion | ||
760 | |||
761 | #region GroupSessionTracking | ||
762 | |||
763 | public void ResetAgentGroupChatSessions(UUID agentID) | ||
764 | { | ||
765 | foreach (List<UUID> agentList in m_groupsAgentsDroppedFromChatSession.Values) | ||
766 | { | ||
767 | agentList.Remove(agentID); | ||
768 | } | ||
769 | } | ||
770 | |||
771 | public bool hasAgentBeenInvitedToGroupChatSession(UUID agentID, UUID groupID) | ||
772 | { | ||
773 | // If we're tracking this group, and we can find them in the tracking, then they've been invited | ||
774 | return m_groupsAgentsInvitedToChatSession.ContainsKey(groupID) | ||
775 | && m_groupsAgentsInvitedToChatSession[groupID].Contains(agentID); | ||
776 | } | ||
777 | |||
778 | public bool hasAgentDroppedGroupChatSession(UUID agentID, UUID groupID) | ||
779 | { | ||
780 | // If we're tracking drops for this group, | ||
781 | // and we find them, well... then they've dropped | ||
782 | return m_groupsAgentsDroppedFromChatSession.ContainsKey(groupID) | ||
783 | && m_groupsAgentsDroppedFromChatSession[groupID].Contains(agentID); | ||
784 | } | ||
785 | |||
786 | public void AgentDroppedFromGroupChatSession(UUID agentID, UUID groupID) | ||
787 | { | ||
788 | if (m_groupsAgentsDroppedFromChatSession.ContainsKey(groupID)) | ||
789 | { | ||
790 | // If not in dropped list, add | ||
791 | if (!m_groupsAgentsDroppedFromChatSession[groupID].Contains(agentID)) | ||
792 | { | ||
793 | m_groupsAgentsDroppedFromChatSession[groupID].Add(agentID); | ||
794 | } | ||
795 | } | ||
796 | } | ||
797 | |||
798 | public void AgentInvitedToGroupChatSession(UUID agentID, UUID groupID) | ||
799 | { | ||
800 | // Add Session Status if it doesn't exist for this session | ||
801 | CreateGroupChatSessionTracking(groupID); | ||
802 | |||
803 | // If nessesary, remove from dropped list | ||
804 | if (m_groupsAgentsDroppedFromChatSession[groupID].Contains(agentID)) | ||
805 | { | ||
806 | m_groupsAgentsDroppedFromChatSession[groupID].Remove(agentID); | ||
807 | } | ||
808 | } | ||
809 | |||
810 | private void CreateGroupChatSessionTracking(UUID groupID) | ||
811 | { | ||
812 | if (!m_groupsAgentsDroppedFromChatSession.ContainsKey(groupID)) | ||
813 | { | ||
814 | m_groupsAgentsDroppedFromChatSession.Add(groupID, new List<UUID>()); | ||
815 | m_groupsAgentsInvitedToChatSession.Add(groupID, new List<UUID>()); | ||
816 | } | ||
817 | |||
749 | } | 818 | } |
750 | #endregion | 819 | #endregion |
751 | 820 | ||
@@ -778,7 +847,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
778 | 847 | ||
779 | private GroupRecord GroupProfileHashtableToGroupRecord(Hashtable groupProfile) | 848 | private GroupRecord GroupProfileHashtableToGroupRecord(Hashtable groupProfile) |
780 | { | 849 | { |
781 | |||
782 | GroupRecord group = new GroupRecord(); | 850 | GroupRecord group = new GroupRecord(); |
783 | group.GroupID = UUID.Parse((string)groupProfile["GroupID"]); | 851 | group.GroupID = UUID.Parse((string)groupProfile["GroupID"]); |
784 | group.GroupName = groupProfile["Name"].ToString(); | 852 | group.GroupName = groupProfile["Name"].ToString(); |
@@ -797,6 +865,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
797 | 865 | ||
798 | return group; | 866 | return group; |
799 | } | 867 | } |
868 | |||
800 | private static GroupMembershipData HashTableToGroupMembershipData(Hashtable respData) | 869 | private static GroupMembershipData HashTableToGroupMembershipData(Hashtable respData) |
801 | { | 870 | { |
802 | GroupMembershipData data = new GroupMembershipData(); | 871 | GroupMembershipData data = new GroupMembershipData(); |
@@ -829,6 +898,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
829 | data.MembershipFee = int.Parse((string)respData["MembershipFee"]); | 898 | data.MembershipFee = int.Parse((string)respData["MembershipFee"]); |
830 | data.OpenEnrollment = ((string)respData["OpenEnrollment"] == "1"); | 899 | data.OpenEnrollment = ((string)respData["OpenEnrollment"] == "1"); |
831 | data.ShowInList = ((string)respData["ShowInList"] == "1"); | 900 | data.ShowInList = ((string)respData["ShowInList"] == "1"); |
901 | |||
832 | return data; | 902 | return data; |
833 | } | 903 | } |
834 | 904 | ||
@@ -837,15 +907,14 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
837 | /// <summary> | 907 | /// <summary> |
838 | /// Encapsulate the XmlRpc call to standardize security and error handling. | 908 | /// Encapsulate the XmlRpc call to standardize security and error handling. |
839 | /// </summary> | 909 | /// </summary> |
840 | private Hashtable XmlRpcCall(GroupRequestID requestID, string function, Hashtable param) | 910 | private Hashtable XmlRpcCall(UUID requestingAgentID, string function, Hashtable param) |
841 | { | 911 | { |
842 | if (requestID == null) | 912 | string UserService; |
843 | { | 913 | UUID SessionID; |
844 | requestID = new GroupRequestID(); | 914 | GetClientGroupRequestID(requestingAgentID, out UserService, out SessionID); |
845 | } | 915 | param.Add("requestingAgentID", requestingAgentID.ToString()); |
846 | param.Add("RequestingAgentID", requestID.AgentID.ToString()); | 916 | param.Add("RequestingAgentUserService", UserService); |
847 | param.Add("RequestingAgentUserService", requestID.UserServiceURL); | 917 | param.Add("RequestingSessionID", SessionID.ToString()); |
848 | param.Add("RequestingSessionID", requestID.SessionID.ToString()); | ||
849 | 918 | ||
850 | 919 | ||
851 | param.Add("ReadKey", m_groupReadKey); | 920 | param.Add("ReadKey", m_groupReadKey); |
@@ -862,7 +931,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
862 | 931 | ||
863 | try | 932 | try |
864 | { | 933 | { |
865 | resp = req.Send(m_serviceURL, 10000); | 934 | resp = req.Send(m_groupsServerURI, 10000); |
866 | } | 935 | } |
867 | catch (Exception e) | 936 | catch (Exception e) |
868 | { | 937 | { |
@@ -936,15 +1005,49 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
936 | } | 1005 | } |
937 | } | 1006 | } |
938 | 1007 | ||
1008 | |||
1009 | /// <summary> | ||
1010 | /// Group Request Tokens are an attempt to allow the groups service to authenticate | ||
1011 | /// requests. | ||
1012 | /// TODO: This broke after the big grid refactor, either find a better way, or discard this | ||
1013 | /// </summary> | ||
1014 | /// <param name="client"></param> | ||
1015 | /// <returns></returns> | ||
1016 | private void GetClientGroupRequestID(UUID AgentID, out string UserServiceURL, out UUID SessionID) | ||
1017 | { | ||
1018 | UserServiceURL = ""; | ||
1019 | SessionID = UUID.Zero; | ||
939 | 1020 | ||
940 | } | ||
941 | 1021 | ||
942 | public class GroupNoticeInfo | 1022 | // Need to rework this based on changes to User Services |
943 | { | 1023 | /* |
944 | public GroupNoticeData noticeData = new GroupNoticeData(); | 1024 | UserAccount userAccount = m_accountService.GetUserAccount(UUID.Zero,AgentID); |
945 | public UUID GroupID = UUID.Zero; | 1025 | if (userAccount == null) |
946 | public string Message = string.Empty; | 1026 | { |
947 | public byte[] BinaryBucket = new byte[0]; | 1027 | // This should be impossible. If I've been passed a reference to a client |
1028 | // that client should be registered with the UserService. So something | ||
1029 | // is horribly wrong somewhere. | ||
1030 | |||
1031 | m_log.WarnFormat("[GROUPS]: Could not find a UserServiceURL for {0}", AgentID); | ||
1032 | |||
1033 | } | ||
1034 | else if (userProfile is ForeignUserProfileData) | ||
1035 | { | ||
1036 | // They aren't from around here | ||
1037 | ForeignUserProfileData fupd = (ForeignUserProfileData)userProfile; | ||
1038 | UserServiceURL = fupd.UserServerURI; | ||
1039 | SessionID = fupd.CurrentAgent.SessionID; | ||
1040 | |||
1041 | } | ||
1042 | else | ||
1043 | { | ||
1044 | // They're a local user, use this: | ||
1045 | UserServiceURL = m_commManager.NetworkServersInfo.UserURL; | ||
1046 | SessionID = userProfile.CurrentAgent.SessionID; | ||
1047 | } | ||
1048 | */ | ||
1049 | } | ||
1050 | |||
948 | } | 1051 | } |
949 | } | 1052 | } |
950 | 1053 | ||