aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups
diff options
context:
space:
mode:
authorMelanie2010-05-05 16:12:52 +0100
committerMelanie2010-05-05 16:12:52 +0100
commit8187fccd258bf0936d3db8663844e07a7b81e9fc (patch)
treef5c1036408dc812d1e7af1387458294d3a6a38d1 /OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups
parent* Added an important comment to warn people not to use MockConsole for anythi... (diff)
downloadopensim-SC_OLD-8187fccd258bf0936d3db8663844e07a7b81e9fc.zip
opensim-SC_OLD-8187fccd258bf0936d3db8663844e07a7b81e9fc.tar.gz
opensim-SC_OLD-8187fccd258bf0936d3db8663844e07a7b81e9fc.tar.bz2
opensim-SC_OLD-8187fccd258bf0936d3db8663844e07a7b81e9fc.tar.xz
Patch from mcortez: Update groups, add ALPHA Siman grid connector for groups
Signed-off-by: Melanie <melanie@t-data.com>
Diffstat (limited to 'OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups')
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs274
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs65
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/IGroupsServicesConnector.cs6
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs292
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs217
5 files changed, 312 insertions, 542 deletions
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs
index 185d44d..00fe5df 100644
--- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs
@@ -28,30 +28,41 @@
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Reflection; 30using System.Reflection;
31
32
31using log4net; 33using log4net;
32using Mono.Addins; 34using Mono.Addins;
33using Nini.Config; 35using Nini.Config;
36
34using OpenMetaverse; 37using OpenMetaverse;
35using OpenMetaverse.StructuredData; 38using OpenMetaverse.StructuredData;
39
36using OpenSim.Framework; 40using OpenSim.Framework;
37using OpenSim.Region.CoreModules.Framework.EventQueue; 41using OpenSim.Region.CoreModules.Framework.EventQueue;
38using OpenSim.Region.Framework.Interfaces; 42using OpenSim.Region.Framework.Interfaces;
39using OpenSim.Region.Framework.Scenes; 43using OpenSim.Region.Framework.Scenes;
40 44
45
41using Caps = OpenSim.Framework.Capabilities.Caps; 46using Caps = OpenSim.Framework.Capabilities.Caps;
42 47
43namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups 48namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
44{ 49{
45 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] 50 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
46 public class GroupsMessagingModule : ISharedRegionModule, IGroupsMessagingModule 51 public class GroupsMessagingModule : ISharedRegionModule
47 { 52 {
53
48 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 54 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
49 55
50 private List<Scene> m_sceneList = new List<Scene>(); 56 private List<Scene> m_sceneList = new List<Scene>();
51 57
52 private IMessageTransferModule m_msgTransferModule = null; 58 private IMessageTransferModule m_msgTransferModule = null;
53 59
54 private IGroupsServicesConnector m_groupData = null; 60 private IGroupsModule m_groupsModule = 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
55 66
56 // Config Options 67 // Config Options
57 private bool m_groupMessagingEnabled = false; 68 private bool m_groupMessagingEnabled = false;
@@ -97,12 +108,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
97 108
98 public void AddRegion(Scene scene) 109 public void AddRegion(Scene scene)
99 { 110 {
100 if (!m_groupMessagingEnabled) 111 // NoOp
101 return;
102
103 scene.RegisterModuleInterface<IGroupsMessagingModule>(this);
104 } 112 }
105
106 public void RegionLoaded(Scene scene) 113 public void RegionLoaded(Scene scene)
107 { 114 {
108 if (!m_groupMessagingEnabled) 115 if (!m_groupMessagingEnabled)
@@ -110,12 +117,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
110 117
111 if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); 118 if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
112 119
113 m_groupData = scene.RequestModuleInterface<IGroupsServicesConnector>(); 120 m_groupsModule = scene.RequestModuleInterface<IGroupsModule>();
114 121
115 // No groups module, no groups messaging 122 // No groups module, no groups messaging
116 if (m_groupData == null) 123 if (m_groupsModule == null)
117 { 124 {
118 m_log.Error("[GROUPS-MESSAGING]: Could not get IGroupsServicesConnector, GroupsMessagingModule is now disabled."); 125 m_log.Error("[GROUPS-MESSAGING]: Could not get IGroupsModule, GroupsMessagingModule is now disabled.");
119 Close(); 126 Close();
120 m_groupMessagingEnabled = false; 127 m_groupMessagingEnabled = false;
121 return; 128 return;
@@ -137,7 +144,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
137 144
138 scene.EventManager.OnNewClient += OnNewClient; 145 scene.EventManager.OnNewClient += OnNewClient;
139 scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage; 146 scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage;
140 scene.EventManager.OnClientLogin += OnClientLogin; 147
141 } 148 }
142 149
143 public void RemoveRegion(Scene scene) 150 public void RemoveRegion(Scene scene)
@@ -165,7 +172,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
165 172
166 m_sceneList.Clear(); 173 m_sceneList.Clear();
167 174
168 m_groupData = null; 175 m_groupsModule = null;
169 m_msgTransferModule = null; 176 m_msgTransferModule = null;
170 } 177 }
171 178
@@ -190,84 +197,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
190 197
191 #endregion 198 #endregion
192 199
193 /// <summary>
194 /// Not really needed, but does confirm that the group exists.
195 /// </summary>
196 public bool StartGroupChatSession(UUID agentID, UUID groupID)
197 {
198 if (m_debugEnabled)
199 m_log.DebugFormat("[GROUPS-MESSAGING]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
200
201 GroupRecord groupInfo = m_groupData.GetGroupRecord(agentID, groupID, null);
202
203 if (groupInfo != null)
204 {
205 return true;
206 }
207 else
208 {
209 return false;
210 }
211 }
212
213 public void SendMessageToGroup(GridInstantMessage im, UUID groupID)
214 {
215 if (m_debugEnabled)
216 m_log.DebugFormat("[GROUPS-MESSAGING]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
217
218
219 foreach (GroupMembersData member in m_groupData.GetGroupMembers(UUID.Zero, groupID))
220 {
221 if (m_groupData.hasAgentDroppedGroupChatSession(member.AgentID, groupID))
222 {
223 // Don't deliver messages to people who have dropped this session
224 if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: {0} has dropped session, not delivering to them", member.AgentID);
225 continue;
226 }
227
228 // Copy Message
229 GridInstantMessage msg = new GridInstantMessage();
230 msg.imSessionID = groupID.Guid;
231 msg.fromAgentName = im.fromAgentName;
232 msg.message = im.message;
233 msg.dialog = im.dialog;
234 msg.offline = im.offline;
235 msg.ParentEstateID = im.ParentEstateID;
236 msg.Position = im.Position;
237 msg.RegionID = im.RegionID;
238 msg.binaryBucket = im.binaryBucket;
239 msg.timestamp = (uint)Util.UnixTimeSinceEpoch();
240
241 msg.fromAgentID = im.fromAgentID;
242 msg.fromGroup = true;
243
244 msg.toAgentID = member.AgentID.Guid;
245
246 IClientAPI client = GetActiveClient(member.AgentID);
247 if (client == null)
248 {
249 // If they're not local, forward across the grid
250 if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: Delivering to {0} via Grid", member.AgentID);
251 m_msgTransferModule.SendInstantMessage(msg, delegate(bool success) { });
252 }
253 else
254 {
255 // Deliver locally, directly
256 if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: Passing to ProcessMessageFromGroupSession to deliver to {0} locally", client.Name);
257 ProcessMessageFromGroupSession(msg);
258 }
259 }
260 }
261
262 #region SimGridEventHandlers 200 #region SimGridEventHandlers
263 201
264 void OnClientLogin(IClientAPI client)
265 {
266 if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: OnInstantMessage registered for {0}", client.Name);
267
268
269 }
270
271 private void OnNewClient(IClientAPI client) 202 private void OnNewClient(IClientAPI client)
272 { 203 {
273 if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: OnInstantMessage registered for {0}", client.Name); 204 if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: OnInstantMessage registered for {0}", client.Name);
@@ -305,46 +236,42 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
305 { 236 {
306 if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: Session message from {0} going to agent {1}", msg.fromAgentName, msg.toAgentID); 237 if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: Session message from {0} going to agent {1}", msg.fromAgentName, msg.toAgentID);
307 238
308 UUID AgentID = new UUID(msg.fromAgentID);
309 UUID GroupID = new UUID(msg.imSessionID);
310
311 switch (msg.dialog) 239 switch (msg.dialog)
312 { 240 {
313 case (byte)InstantMessageDialog.SessionAdd: 241 case (byte)InstantMessageDialog.SessionAdd:
314 m_groupData.AgentInvitedToGroupChatSession(AgentID, GroupID); 242 AddAgentToGroupSession(msg.fromAgentID, msg.imSessionID);
315 break; 243 break;
316 244
317 case (byte)InstantMessageDialog.SessionDrop: 245 case (byte)InstantMessageDialog.SessionDrop:
318 m_groupData.AgentDroppedFromGroupChatSession(AgentID, GroupID); 246 RemoveAgentFromGroupSession(msg.fromAgentID, msg.imSessionID);
319 break; 247 break;
320 248
321 case (byte)InstantMessageDialog.SessionSend: 249 case (byte)InstantMessageDialog.SessionSend:
322 if (!m_groupData.hasAgentDroppedGroupChatSession(AgentID, GroupID) 250 if (!m_agentsInGroupSession.ContainsKey(msg.toAgentID)
323 && !m_groupData.hasAgentBeenInvitedToGroupChatSession(AgentID, GroupID) 251 && !m_agentsDroppedSession.ContainsKey(msg.toAgentID))
324 )
325 { 252 {
326 // Agent not in session and hasn't dropped from session 253 // Agent not in session and hasn't dropped from session
327 // Add them to the session for now, and Invite them 254 // Add them to the session for now, and Invite them
328 m_groupData.AgentInvitedToGroupChatSession(AgentID, GroupID); 255 AddAgentToGroupSession(msg.toAgentID, msg.imSessionID);
329 256
330 UUID toAgentID = new UUID(msg.toAgentID); 257 UUID toAgentID = new UUID(msg.toAgentID);
331 IClientAPI activeClient = GetActiveClient(toAgentID); 258 IClientAPI activeClient = GetActiveClient(toAgentID);
332 if (activeClient != null) 259 if (activeClient != null)
333 { 260 {
334 GroupRecord groupInfo = m_groupData.GetGroupRecord(UUID.Zero, GroupID, null); 261 UUID groupID = new UUID(msg.fromAgentID);
262
263 GroupRecord groupInfo = m_groupsModule.GetGroupRecord(groupID);
335 if (groupInfo != null) 264 if (groupInfo != null)
336 { 265 {
337 if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: Sending chatterbox invite instant message"); 266 if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: Sending chatterbox invite instant message");
338 267
339 // Force? open the group session dialog??? 268 // Force? open the group session dialog???
340 // and simultanously deliver the message, so we don't need to do a seperate client.SendInstantMessage(msg);
341 IEventQueue eq = activeClient.Scene.RequestModuleInterface<IEventQueue>(); 269 IEventQueue eq = activeClient.Scene.RequestModuleInterface<IEventQueue>();
342 eq.ChatterboxInvitation( 270 eq.ChatterboxInvitation(
343 GroupID 271 groupID
344 , groupInfo.GroupName 272 , groupInfo.GroupName
345 , new UUID(msg.fromAgentID) 273 , new UUID(msg.fromAgentID)
346 , msg.message 274 , msg.message, new UUID(msg.toAgentID)
347 , new UUID(msg.toAgentID)
348 , msg.fromAgentName 275 , msg.fromAgentName
349 , msg.dialog 276 , msg.dialog
350 , msg.timestamp 277 , msg.timestamp
@@ -358,7 +285,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
358 ); 285 );
359 286
360 eq.ChatterBoxSessionAgentListUpdates( 287 eq.ChatterBoxSessionAgentListUpdates(
361 new UUID(GroupID) 288 new UUID(groupID)
362 , new UUID(msg.fromAgentID) 289 , new UUID(msg.fromAgentID)
363 , new UUID(msg.toAgentID) 290 , new UUID(msg.toAgentID)
364 , false //canVoiceChat 291 , false //canVoiceChat
@@ -368,7 +295,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
368 } 295 }
369 } 296 }
370 } 297 }
371 else if (!m_groupData.hasAgentDroppedGroupChatSession(AgentID, GroupID)) 298 else if (!m_agentsDroppedSession.ContainsKey(msg.toAgentID))
372 { 299 {
373 // User hasn't dropped, so they're in the session, 300 // User hasn't dropped, so they're in the session,
374 // maybe we should deliver it. 301 // maybe we should deliver it.
@@ -394,8 +321,56 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
394 321
395 #endregion 322 #endregion
396 323
397
398 #region ClientEvents 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
399 private void OnInstantMessage(IClientAPI remoteClient, GridInstantMessage im) 374 private void OnInstantMessage(IClientAPI remoteClient, GridInstantMessage im)
400 { 375 {
401 if (m_debugEnabled) 376 if (m_debugEnabled)
@@ -408,23 +383,21 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
408 // Start group IM session 383 // Start group IM session
409 if ((im.dialog == (byte)InstantMessageDialog.SessionGroupStart)) 384 if ((im.dialog == (byte)InstantMessageDialog.SessionGroupStart))
410 { 385 {
411 if (m_debugEnabled) m_log.InfoFormat("[GROUPS-MESSAGING]: imSessionID({0}) toAgentID({1})", im.imSessionID, im.toAgentID); 386 UUID groupID = new UUID(im.toAgentID);
412 387
413 UUID GroupID = new UUID(im.imSessionID); 388 GroupRecord groupInfo = m_groupsModule.GetGroupRecord(groupID);
414 UUID AgentID = new UUID(im.fromAgentID);
415
416 GroupRecord groupInfo = m_groupData.GetGroupRecord(UUID.Zero, GroupID, null);
417
418 if (groupInfo != null) 389 if (groupInfo != null)
419 { 390 {
420 m_groupData.AgentInvitedToGroupChatSession(AgentID, GroupID); 391 if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: Start Group Session for {0}", groupInfo.GroupName);
392
393 AddAgentToGroupSession(im.fromAgentID, im.imSessionID);
421 394
422 ChatterBoxSessionStartReplyViaCaps(remoteClient, groupInfo.GroupName, GroupID); 395 ChatterBoxSessionStartReplyViaCaps(remoteClient, groupInfo.GroupName, groupID);
423 396
424 IEventQueue queue = remoteClient.Scene.RequestModuleInterface<IEventQueue>(); 397 IEventQueue queue = remoteClient.Scene.RequestModuleInterface<IEventQueue>();
425 queue.ChatterBoxSessionAgentListUpdates( 398 queue.ChatterBoxSessionAgentListUpdates(
426 GroupID 399 new UUID(groupID)
427 , AgentID 400 , new UUID(im.fromAgentID)
428 , new UUID(im.toAgentID) 401 , new UUID(im.toAgentID)
429 , false //canVoiceChat 402 , false //canVoiceChat
430 , false //isModerator 403 , false //isModerator
@@ -436,21 +409,64 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
436 // Send a message from locally connected client to a group 409 // Send a message from locally connected client to a group
437 if ((im.dialog == (byte)InstantMessageDialog.SessionSend)) 410 if ((im.dialog == (byte)InstantMessageDialog.SessionSend))
438 { 411 {
439 UUID GroupID = new UUID(im.imSessionID); 412 UUID groupID = new UUID(im.toAgentID);
440 UUID AgentID = new UUID(im.fromAgentID);
441
442 if (m_debugEnabled)
443 m_log.DebugFormat("[GROUPS-MESSAGING]: Send message to session for group {0} with session ID {1}", GroupID, im.imSessionID.ToString());
444 413
445 //If this agent is sending a message, then they want to be in the session 414 if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: Send message to session for group {0} with session ID {1}", groupID, im.imSessionID.ToString());
446 m_groupData.AgentInvitedToGroupChatSession(AgentID, GroupID);
447 415
448 SendMessageToGroup(im, GroupID); 416 SendMessageToGroup(im, groupID);
449 } 417 }
450 } 418 }
451 419
452 #endregion 420 #endregion
453 421
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
454 void ChatterBoxSessionStartReplyViaCaps(IClientAPI remoteClient, string groupName, UUID groupID) 470 void ChatterBoxSessionStartReplyViaCaps(IClientAPI remoteClient, string groupName, UUID groupID)
455 { 471 {
456 if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); 472 if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
@@ -502,8 +518,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
502 /// </summary> 518 /// </summary>
503 private IClientAPI GetActiveClient(UUID agentID) 519 private IClientAPI GetActiveClient(UUID agentID)
504 { 520 {
505 if (m_debugEnabled) m_log.WarnFormat("[GROUPS-MESSAGING]: Looking for local client {0}", agentID);
506
507 IClientAPI child = null; 521 IClientAPI child = null;
508 522
509 // Try root avatar first 523 // Try root avatar first
@@ -515,26 +529,16 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
515 ScenePresence user = (ScenePresence)scene.Entities[agentID]; 529 ScenePresence user = (ScenePresence)scene.Entities[agentID];
516 if (!user.IsChildAgent) 530 if (!user.IsChildAgent)
517 { 531 {
518 if (m_debugEnabled) m_log.WarnFormat("[GROUPS-MESSAGING]: Found root agent for client : {0}", user.ControllingClient.Name);
519 return user.ControllingClient; 532 return user.ControllingClient;
520 } 533 }
521 else 534 else
522 { 535 {
523 if (m_debugEnabled) m_log.WarnFormat("[GROUPS-MESSAGING]: Found child agent for client : {0}", user.ControllingClient.Name);
524 child = user.ControllingClient; 536 child = user.ControllingClient;
525 } 537 }
526 } 538 }
527 } 539 }
528 540
529 // If we didn't find a root, then just return whichever child we found, or null if none 541 // If we didn't find a root, then just return whichever child we found, or null if none
530 if (child == null)
531 {
532 if (m_debugEnabled) m_log.WarnFormat("[GROUPS-MESSAGING]: Could not find local client for agent : {0}", agentID);
533 }
534 else
535 {
536 if (m_debugEnabled) m_log.WarnFormat("[GROUPS-MESSAGING]: Returning child agent for client : {0}", child.Name);
537 }
538 return child; 542 return child;
539 } 543 }
540 544
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs
index 56c0d98..6b942cb 100644
--- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs
@@ -176,6 +176,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
176 176
177 scene.EventManager.OnNewClient += OnNewClient; 177 scene.EventManager.OnNewClient += OnNewClient;
178 scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage; 178 scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage;
179
179 // The InstantMessageModule itself doesn't do this, 180 // The InstantMessageModule itself doesn't do this,
180 // so lets see if things explode if we don't do it 181 // so lets see if things explode if we don't do it
181 // scene.EventManager.OnClientClosed += OnClientClosed; 182 // scene.EventManager.OnClientClosed += OnClientClosed;
@@ -509,7 +510,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
509 IClientAPI ejectee = GetActiveClient(ejecteeID); 510 IClientAPI ejectee = GetActiveClient(ejecteeID);
510 if (ejectee != null) 511 if (ejectee != null)
511 { 512 {
512 UUID groupID = new UUID(im.imSessionID); 513 UUID groupID = new UUID(im.fromAgentID);
513 ejectee.SendAgentDropGroup(groupID); 514 ejectee.SendAgentDropGroup(groupID);
514 } 515 }
515 } 516 }
@@ -600,14 +601,14 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
600 public List<GroupMembersData> GroupMembersRequest(IClientAPI remoteClient, UUID groupID) 601 public List<GroupMembersData> GroupMembersRequest(IClientAPI remoteClient, UUID groupID)
601 { 602 {
602 if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); 603 if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
603 List<GroupMembersData> data = m_groupData.GetGroupMembers(GetRequestingAgentID(remoteClient), groupID); 604 List<GroupMembersData> data = m_groupData.GetGroupMembers(GetRequestingAgentID(remoteClient), groupID);
604 605
605 if (m_debugEnabled) 606 if (m_debugEnabled)
606 { 607 {
607 foreach (GroupMembersData member in data) 608 foreach (GroupMembersData member in data)
608 { 609 {
609 m_log.DebugFormat("[GROUPS]: Member({0}) - IsOwner({1})", member.AgentID, member.IsOwner); 610 m_log.DebugFormat("[GROUPS]: Member({0}) - IsOwner({1})", member.AgentID, member.IsOwner);
610 } 611 }
611 } 612 }
612 613
613 return data; 614 return data;
@@ -627,14 +628,14 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
627 { 628 {
628 if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); 629 if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
629 630
630 List<GroupRoleMembersData> data = m_groupData.GetGroupRoleMembers(GetRequestingAgentID(remoteClient), groupID); 631 List<GroupRoleMembersData> data = m_groupData.GetGroupRoleMembers(GetRequestingAgentID(remoteClient), groupID);
631 632
632 if (m_debugEnabled) 633 if (m_debugEnabled)
633 { 634 {
634 foreach (GroupRoleMembersData member in data) 635 foreach (GroupRoleMembersData member in data)
635 { 636 {
636 m_log.DebugFormat("[GROUPS]: Member({0}) - Role({1})", member.MemberID, member.RoleID); 637 m_log.DebugFormat("[GROUPS]: Member({0}) - Role({1})", member.MemberID, member.RoleID);
637 } 638 }
638 } 639 }
639 return data; 640 return data;
640 } 641 }
@@ -1143,11 +1144,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
1143 OSDMap llDataStruct = new OSDMap(3); 1144 OSDMap llDataStruct = new OSDMap(3);
1144 llDataStruct.Add("AgentData", AgentData); 1145 llDataStruct.Add("AgentData", AgentData);
1145 llDataStruct.Add("GroupData", GroupData); 1146 llDataStruct.Add("GroupData", GroupData);
1146 llDataStruct.Add("NewGroupData", NewGroupData); 1147 llDataStruct.Add("NewGroupData", NewGroupData);
1147 1148
1148 if (m_debugEnabled) 1149 if (m_debugEnabled)
1149 { 1150 {
1150 m_log.InfoFormat("[GROUPS]: {0}", OSDParser.SerializeJsonString(llDataStruct)); 1151 m_log.InfoFormat("[GROUPS]: {0}", OSDParser.SerializeJsonString(llDataStruct));
1151 } 1152 }
1152 1153
1153 IEventQueue queue = remoteClient.Scene.RequestModuleInterface<IEventQueue>(); 1154 IEventQueue queue = remoteClient.Scene.RequestModuleInterface<IEventQueue>();
@@ -1307,16 +1308,16 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
1307 // 1308 //
1308 } 1309 }
1309 1310
1310 #endregion 1311 #endregion
1311 1312
1312 private UUID GetRequestingAgentID(IClientAPI client) 1313 private UUID GetRequestingAgentID(IClientAPI client)
1313 { 1314 {
1314 UUID requestingAgentID = UUID.Zero; 1315 UUID requestingAgentID = UUID.Zero;
1315 if (client != null) 1316 if (client != null)
1316 { 1317 {
1317 requestingAgentID = client.AgentId; 1318 requestingAgentID = client.AgentId;
1318 } 1319 }
1319 return requestingAgentID; 1320 return requestingAgentID;
1320 } 1321 }
1321 } 1322 }
1322 1323
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/IGroupsServicesConnector.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/IGroupsServicesConnector.cs
index a046e09..6487967 100644
--- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/IGroupsServicesConnector.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/IGroupsServicesConnector.cs
@@ -71,12 +71,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
71 void AddGroupNotice(UUID RequestingAgentID, UUID groupID, UUID noticeID, string fromName, string subject, string message, byte[] binaryBucket); 71 void AddGroupNotice(UUID RequestingAgentID, UUID groupID, UUID noticeID, string fromName, string subject, string message, byte[] binaryBucket);
72 GroupNoticeInfo GetGroupNotice(UUID RequestingAgentID, UUID noticeID); 72 GroupNoticeInfo GetGroupNotice(UUID RequestingAgentID, UUID noticeID);
73 List<GroupNoticeData> GetGroupNotices(UUID RequestingAgentID, UUID GroupID); 73 List<GroupNoticeData> GetGroupNotices(UUID RequestingAgentID, UUID GroupID);
74
75 void ResetAgentGroupChatSessions(UUID agentID);
76 bool hasAgentBeenInvitedToGroupChatSession(UUID agentID, UUID groupID);
77 bool hasAgentDroppedGroupChatSession(UUID agentID, UUID groupID);
78 void AgentDroppedFromGroupChatSession(UUID agentID, UUID groupID);
79 void AgentInvitedToGroupChatSession(UUID agentID, UUID groupID);
80 } 74 }
81 75
82 public class GroupInviteInfo 76 public class GroupInviteInfo
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs
index 9363205..590753e 100644
--- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs
@@ -55,9 +55,6 @@ using OpenSim.Services.Interfaces;
55 * UserID -> Group -> ActiveGroup 55 * UserID -> Group -> ActiveGroup
56 * + GroupID 56 * + GroupID
57 * 57 *
58 * UserID -> GroupSessionDropped -> GroupID
59 * UserID -> GroupSessionInvited -> GroupID
60 *
61 * UserID -> GroupMember -> GroupID 58 * UserID -> GroupMember -> GroupID
62 * + SelectedRoleID [UUID] 59 * + SelectedRoleID [UUID]
63 * + AcceptNotices [bool] 60 * + AcceptNotices [bool]
@@ -66,7 +63,6 @@ using OpenSim.Services.Interfaces;
66 * 63 *
67 * UserID -> GroupRole[GroupID] -> RoleID 64 * UserID -> GroupRole[GroupID] -> RoleID
68 * 65 *
69 *
70 * GroupID -> Group -> GroupName 66 * GroupID -> Group -> GroupName
71 * + Charter 67 * + Charter
72 * + ShowInList 68 * + ShowInList
@@ -163,13 +159,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
163 159
164 private bool m_connectorEnabled = false; 160 private bool m_connectorEnabled = false;
165 161
166 private string m_groupsServerURI = string.Empty; 162 private string m_serviceURL = string.Empty;
167 163
168 private bool m_debugEnabled = false; 164 private bool m_debugEnabled = false;
169 165
170 private ExpiringCache<string, OSDMap> m_memoryCache;
171 private int m_cacheTimeout = 30;
172
173 // private IUserAccountService m_accountService = null; 166 // private IUserAccountService m_accountService = null;
174 167
175 168
@@ -206,33 +199,17 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
206 return; 199 return;
207 } 200 }
208 201
209 m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR]: Initializing {0}", this.Name); 202 m_log.InfoFormat("[GROUPS-CONNECTOR]: Initializing {0}", this.Name);
210 203
211 m_groupsServerURI = groupsConfig.GetString("GroupsServerURI", string.Empty); 204 m_serviceURL = groupsConfig.GetString("XmlRpcServiceURL", string.Empty);
212 if ((m_groupsServerURI == null) || 205 if ((m_serviceURL == null) ||
213 (m_groupsServerURI == string.Empty)) 206 (m_serviceURL == string.Empty))
214 { 207 {
215 m_log.ErrorFormat("Please specify a valid Simian Server for GroupsServerURI in OpenSim.ini, [Groups]"); 208 m_log.ErrorFormat("Please specify a valid Simian Server URL for XmlRpcServiceURL in OpenSim.ini, [Groups]");
216 m_connectorEnabled = false; 209 m_connectorEnabled = false;
217 return; 210 return;
218 } 211 }
219 212
220
221 m_cacheTimeout = groupsConfig.GetInt("GroupsCacheTimeout", 30);
222 if (m_cacheTimeout == 0)
223 {
224 m_log.WarnFormat("[SIMIAN-GROUPS-CONNECTOR] Groups Cache Disabled.");
225 }
226 else
227 {
228 m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] Groups Cache Timeout set to {0}.", m_cacheTimeout);
229 }
230
231
232
233 m_memoryCache = new ExpiringCache<string,OSDMap>();
234
235
236 // If we got all the config options we need, lets start'er'up 213 // If we got all the config options we need, lets start'er'up
237 m_connectorEnabled = true; 214 m_connectorEnabled = true;
238 215
@@ -243,7 +220,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
243 220
244 public void Close() 221 public void Close()
245 { 222 {
246 m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR]: Closing {0}", this.Name); 223 m_log.InfoFormat("[GROUPS-CONNECTOR]: Closing {0}", this.Name);
247 } 224 }
248 225
249 public void AddRegion(OpenSim.Region.Framework.Scenes.Scene scene) 226 public void AddRegion(OpenSim.Region.Framework.Scenes.Scene scene)
@@ -311,8 +288,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
311 288
312 if(SimianAddGeneric(GroupID, "Group", name, GroupInfoMap)) 289 if(SimianAddGeneric(GroupID, "Group", name, GroupInfoMap))
313 { 290 {
314 AddGroupRole(requestingAgentID, GroupID, UUID.Zero, "Everyone", "Members of " + name, "Member of " + name, (ulong)m_DefaultEveryonePowers); 291 AddGroupRole(requestingAgentID, GroupID, UUID.Zero, "Everyone", "Members of " + name, "Member of " + name, (ulong)m_DefaultEveryonePowers);
315 AddGroupRole(requestingAgentID, GroupID, OwnerRoleID, "Owners", "Owners of " + name, "Owner of " + name, (ulong)m_DefaultOwnerPowers); 292 AddGroupRole(requestingAgentID, GroupID, OwnerRoleID, "Owners", "Owners of " + name, "Owner of " + name, (ulong)m_DefaultOwnerPowers);
316 293
317 AddAgentToGroup(requestingAgentID, requestingAgentID, GroupID, OwnerRoleID); 294 AddAgentToGroup(requestingAgentID, requestingAgentID, GroupID, OwnerRoleID);
318 295
@@ -436,7 +413,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
436 } 413 }
437 } 414 }
438 else if ((groupName != null) && (groupName != string.Empty)) 415 else if ((groupName != null) && (groupName != string.Empty))
439 { 416 {
440 if (!SimianGetFirstGenericEntry("Group", groupName, out groupID, out GroupInfoMap)) 417 if (!SimianGetFirstGenericEntry("Group", groupName, out groupID, out GroupInfoMap))
441 { 418 {
442 return null; 419 return null;
@@ -445,7 +422,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
445 422
446 GroupRecord GroupInfo = new GroupRecord(); 423 GroupRecord GroupInfo = new GroupRecord();
447 424
448 GroupInfo.GroupID = groupID; 425 GroupInfo.GroupID = groupID;
449 GroupInfo.GroupName = groupName; 426 GroupInfo.GroupName = groupName;
450 GroupInfo.Charter = GroupInfoMap["Charter"].AsString(); 427 GroupInfo.Charter = GroupInfoMap["Charter"].AsString();
451 GroupInfo.ShowInList = GroupInfoMap["ShowInList"].AsBoolean(); 428 GroupInfo.ShowInList = GroupInfoMap["ShowInList"].AsBoolean();
@@ -676,7 +653,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
676 }; 653 };
677 654
678 655
679 OSDMap response = CachedPostRequest(requestArgs); 656 OSDMap response = WebUtil.PostToService(m_serviceURL, requestArgs);
680 if (response["Success"].AsBoolean() && response["Entries"] is OSDArray) 657 if (response["Success"].AsBoolean() && response["Entries"] is OSDArray)
681 { 658 {
682 OSDArray entryArray = (OSDArray)response["Entries"]; 659 OSDArray entryArray = (OSDArray)response["Entries"];
@@ -774,9 +751,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
774 if (SimianGetGenericEntry(agentID, "Group", "ActiveGroup", out UserActiveGroup)) 751 if (SimianGetGenericEntry(agentID, "Group", "ActiveGroup", out UserActiveGroup))
775 { 752 {
776 GroupID = UserActiveGroup["GroupID"].AsUUID(); 753 GroupID = UserActiveGroup["GroupID"].AsUUID();
777 } 754 }
778 755
779 if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] Active GroupID : {0}", GroupID.ToString()); 756 if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] Active GroupID : {0}", GroupID.ToString());
780 return GetAgentGroupMembership(requestingAgentID, agentID, GroupID); 757 return GetAgentGroupMembership(requestingAgentID, agentID, GroupID);
781 } 758 }
782 759
@@ -804,24 +781,24 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
804 781
805 List<GroupRolesData> Roles = new List<GroupRolesData>(); 782 List<GroupRolesData> Roles = new List<GroupRolesData>();
806 783
807 Dictionary<string, OSDMap> GroupRoles; 784 Dictionary<string, OSDMap> GroupRoles;
808 if (SimianGetGenericEntries(groupID, "GroupRole", out GroupRoles)) 785 if (SimianGetGenericEntries(groupID, "GroupRole", out GroupRoles))
809 { 786 {
810 Dictionary<string, OSDMap> MemberRoles; 787 Dictionary<string, OSDMap> MemberRoles;
811 if (SimianGetGenericEntries(agentID, "GroupRole" + groupID.ToString(), out MemberRoles)) 788 if (SimianGetGenericEntries(agentID, "GroupRole" + groupID.ToString(), out MemberRoles))
812 { 789 {
813 foreach (KeyValuePair<string, OSDMap> kvp in MemberRoles) 790 foreach (KeyValuePair<string, OSDMap> kvp in MemberRoles)
814 { 791 {
815 GroupRolesData data = new GroupRolesData(); 792 GroupRolesData data = new GroupRolesData();
816 data.RoleID = UUID.Parse(kvp.Key); 793 data.RoleID = UUID.Parse(kvp.Key);
817 data.Name = GroupRoles[kvp.Key]["Name"].AsString(); 794 data.Name = GroupRoles[kvp.Key]["Name"].AsString();
818 data.Description = GroupRoles[kvp.Key]["Description"].AsString(); 795 data.Description = GroupRoles[kvp.Key]["Description"].AsString();
819 data.Title = GroupRoles[kvp.Key]["Title"].AsString(); 796 data.Title = GroupRoles[kvp.Key]["Title"].AsString();
820 data.Powers = GroupRoles[kvp.Key]["Powers"].AsULong(); 797 data.Powers = GroupRoles[kvp.Key]["Powers"].AsULong();
821 798
822 Roles.Add(data); 799 Roles.Add(data);
823 } 800 }
824 } 801 }
825 } 802 }
826 return Roles; 803 return Roles;
827 } 804 }
@@ -935,8 +912,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
935 { 912 {
936 foreach( KeyValuePair<UUID, OSDMap> GroupRoleMember in GroupRoleMembers ) 913 foreach( KeyValuePair<UUID, OSDMap> GroupRoleMember in GroupRoleMembers )
937 { 914 {
938 GroupRoleMembersData data = new GroupRoleMembersData(); 915 GroupRoleMembersData data = new GroupRoleMembersData();
939 916
940 data.MemberID = GroupRoleMember.Key; 917 data.MemberID = GroupRoleMember.Key;
941 data.RoleID = UUID.Parse(Role.Key); 918 data.RoleID = UUID.Parse(Role.Key);
942 919
@@ -1021,52 +998,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
1021 } 998 }
1022 #endregion 999 #endregion
1023 1000
1024 #region GroupSessionTracking
1025
1026 public void ResetAgentGroupChatSessions(UUID agentID)
1027 {
1028 Dictionary<string, OSDMap> agentSessions;
1029
1030 if (SimianGetGenericEntries(agentID, "GroupSessionDropped", out agentSessions))
1031 {
1032 foreach (string GroupID in agentSessions.Keys)
1033 {
1034 SimianRemoveGenericEntry(agentID, "GroupSessionDropped", GroupID);
1035 }
1036 }
1037
1038 if (SimianGetGenericEntries(agentID, "GroupSessionInvited", out agentSessions))
1039 {
1040 foreach (string GroupID in agentSessions.Keys)
1041 {
1042 SimianRemoveGenericEntry(agentID, "GroupSessionInvited", GroupID);
1043 }
1044 }
1045 }
1046
1047 public bool hasAgentDroppedGroupChatSession(UUID agentID, UUID groupID)
1048 {
1049 OSDMap session;
1050 return SimianGetGenericEntry(agentID, "GroupSessionDropped", groupID.ToString(), out session);
1051 }
1052
1053 public void AgentDroppedFromGroupChatSession(UUID agentID, UUID groupID)
1054 {
1055 SimianAddGeneric(agentID, "GroupSessionDropped", groupID.ToString(), new OSDMap());
1056 }
1057
1058 public void AgentInvitedToGroupChatSession(UUID agentID, UUID groupID)
1059 {
1060 SimianAddGeneric(agentID, "GroupSessionInvited", groupID.ToString(), new OSDMap());
1061 }
1062
1063 public bool hasAgentBeenInvitedToGroupChatSession(UUID agentID, UUID groupID)
1064 {
1065 OSDMap session;
1066 return SimianGetGenericEntry(agentID, "GroupSessionDropped", groupID.ToString(), out session);
1067 }
1068
1069 #endregion
1070 1001
1071 private void EnsureRoleNotSelectedByMember(UUID groupID, UUID roleID, UUID userID) 1002 private void EnsureRoleNotSelectedByMember(UUID groupID, UUID roleID, UUID userID)
1072 { 1003 {
@@ -1105,7 +1036,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
1105 }; 1036 };
1106 1037
1107 1038
1108 OSDMap Response = CachedPostRequest(RequestArgs); 1039 OSDMap Response = WebUtil.PostToService(m_serviceURL, RequestArgs);
1109 if (Response["Success"].AsBoolean()) 1040 if (Response["Success"].AsBoolean())
1110 { 1041 {
1111 return true; 1042 return true;
@@ -1132,23 +1063,23 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
1132 }; 1063 };
1133 1064
1134 1065
1135 OSDMap Response = CachedPostRequest(RequestArgs); 1066 OSDMap Response = WebUtil.PostToService(m_serviceURL, RequestArgs);
1136 if (Response["Success"].AsBoolean() && Response["Entries"] is OSDArray) 1067 if (Response["Success"].AsBoolean() && Response["Entries"] is OSDArray)
1137 { 1068 {
1138 OSDArray entryArray = (OSDArray)Response["Entries"]; 1069 OSDArray entryArray = (OSDArray)Response["Entries"];
1139 if (entryArray.Count >= 1) 1070 if (entryArray.Count >= 1)
1140 { 1071 {
1141 OSDMap entryMap = entryArray[0] as OSDMap; 1072 OSDMap entryMap = entryArray[0] as OSDMap;
1142 key = entryMap["Key"].AsString(); 1073 key = entryMap["Key"].AsString();
1143 map = (OSDMap)OSDParser.DeserializeJson(entryMap["Value"].AsString()); 1074 map = (OSDMap)OSDParser.DeserializeJson(entryMap["Value"].AsString());
1144 1075
1145 if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] Generics Result {0}", entryMap["Value"].AsString()); 1076 if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] Generics Result {0}", entryMap["Value"].AsString());
1146 1077
1147 return true; 1078 return true;
1148 } 1079 }
1149 else 1080 else
1150 { 1081 {
1151 if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] No Generics Results"); 1082 if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] No Generics Results");
1152 } 1083 }
1153 } 1084 }
1154 else 1085 else
@@ -1172,23 +1103,23 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
1172 }; 1103 };
1173 1104
1174 1105
1175 OSDMap Response = CachedPostRequest(RequestArgs); 1106 OSDMap Response = WebUtil.PostToService(m_serviceURL, RequestArgs);
1176 if (Response["Success"].AsBoolean() && Response["Entries"] is OSDArray) 1107 if (Response["Success"].AsBoolean() && Response["Entries"] is OSDArray)
1177 { 1108 {
1178 OSDArray entryArray = (OSDArray)Response["Entries"]; 1109 OSDArray entryArray = (OSDArray)Response["Entries"];
1179 if (entryArray.Count >= 1) 1110 if (entryArray.Count >= 1)
1180 { 1111 {
1181 OSDMap entryMap = entryArray[0] as OSDMap; 1112 OSDMap entryMap = entryArray[0] as OSDMap;
1182 ownerID = entryMap["OwnerID"].AsUUID(); 1113 ownerID = entryMap["OwnerID"].AsUUID();
1183 map = (OSDMap)OSDParser.DeserializeJson(entryMap["Value"].AsString()); 1114 map = (OSDMap)OSDParser.DeserializeJson(entryMap["Value"].AsString());
1184 1115
1185 if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] Generics Result {0}", entryMap["Value"].AsString()); 1116 if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] Generics Result {0}", entryMap["Value"].AsString());
1186 1117
1187 return true; 1118 return true;
1188 } 1119 }
1189 else 1120 else
1190 { 1121 {
1191 if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] No Generics Results"); 1122 if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] No Generics Results");
1192 } 1123 }
1193 } 1124 }
1194 else 1125 else
@@ -1213,7 +1144,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
1213 }; 1144 };
1214 1145
1215 1146
1216 OSDMap Response = CachedPostRequest(RequestArgs); 1147 OSDMap Response = WebUtil.PostToService(m_serviceURL, RequestArgs);
1217 if (Response["Success"].AsBoolean() && Response["Entries"] is OSDArray) 1148 if (Response["Success"].AsBoolean() && Response["Entries"] is OSDArray)
1218 { 1149 {
1219 OSDArray entryArray = (OSDArray)Response["Entries"]; 1150 OSDArray entryArray = (OSDArray)Response["Entries"];
@@ -1221,16 +1152,16 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
1221 { 1152 {
1222 OSDMap entryMap = entryArray[0] as OSDMap; 1153 OSDMap entryMap = entryArray[0] as OSDMap;
1223 key = entryMap["Key"].AsString(); 1154 key = entryMap["Key"].AsString();
1224 map = (OSDMap)OSDParser.DeserializeJson(entryMap["Value"].AsString()); 1155 map = (OSDMap)OSDParser.DeserializeJson(entryMap["Value"].AsString());
1225 1156
1226 if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] Generics Result {0}", entryMap["Value"].AsString()); 1157 if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] Generics Result {0}", entryMap["Value"].AsString());
1227 1158
1228 return true; 1159 return true;
1229 } 1160 }
1230 else 1161 else
1231 { 1162 {
1232 if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] No Generics Results"); 1163 if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] No Generics Results");
1233 } 1164 }
1234 } 1165 }
1235 else 1166 else
1236 { 1167 {
@@ -1253,20 +1184,20 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
1253 1184
1254 1185
1255 1186
1256 OSDMap response = CachedPostRequest(requestArgs); 1187 OSDMap response = WebUtil.PostToService(m_serviceURL, requestArgs);
1257 if (response["Success"].AsBoolean() && response["Entries"] is OSDArray) 1188 if (response["Success"].AsBoolean() && response["Entries"] is OSDArray)
1258 { 1189 {
1259 maps = new Dictionary<string, OSDMap>(); 1190 maps = new Dictionary<string, OSDMap>();
1260 1191
1261 OSDArray entryArray = (OSDArray)response["Entries"]; 1192 OSDArray entryArray = (OSDArray)response["Entries"];
1262 foreach (OSDMap entryMap in entryArray) 1193 foreach (OSDMap entryMap in entryArray)
1263 { 1194 {
1264 if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] Generics Result {0}", entryMap["Value"].AsString()); 1195 if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] Generics Result {0}", entryMap["Value"].AsString());
1265 maps.Add(entryMap["Key"].AsString(), (OSDMap)OSDParser.DeserializeJson(entryMap["Value"].AsString())); 1196 maps.Add(entryMap["Key"].AsString(), (OSDMap)OSDParser.DeserializeJson(entryMap["Value"].AsString()));
1266 } 1197 }
1267 if(maps.Count == 0) 1198 if(maps.Count == 0)
1268 { 1199 {
1269 if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] No Generics Results"); 1200 if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] No Generics Results");
1270 } 1201 }
1271 1202
1272 return true; 1203 return true;
@@ -1291,21 +1222,21 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
1291 1222
1292 1223
1293 1224
1294 OSDMap response = CachedPostRequest(requestArgs); 1225 OSDMap response = WebUtil.PostToService(m_serviceURL, requestArgs);
1295 if (response["Success"].AsBoolean() && response["Entries"] is OSDArray) 1226 if (response["Success"].AsBoolean() && response["Entries"] is OSDArray)
1296 { 1227 {
1297 maps = new Dictionary<UUID, OSDMap>(); 1228 maps = new Dictionary<UUID, OSDMap>();
1298 1229
1299 OSDArray entryArray = (OSDArray)response["Entries"]; 1230 OSDArray entryArray = (OSDArray)response["Entries"];
1300 foreach (OSDMap entryMap in entryArray) 1231 foreach (OSDMap entryMap in entryArray)
1301 { 1232 {
1302 if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] Generics Result {0}", entryMap["Value"].AsString()); 1233 if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] Generics Result {0}", entryMap["Value"].AsString());
1303 maps.Add(entryMap["OwnerID"].AsUUID(), (OSDMap)OSDParser.DeserializeJson(entryMap["Value"].AsString())); 1234 maps.Add(entryMap["OwnerID"].AsUUID(), (OSDMap)OSDParser.DeserializeJson(entryMap["Value"].AsString()));
1304 } 1235 }
1305 if (maps.Count == 0) 1236 if (maps.Count == 0)
1306 { 1237 {
1307 if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] No Generics Results"); 1238 if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] No Generics Results");
1308 } 1239 }
1309 return true; 1240 return true;
1310 } 1241 }
1311 else 1242 else
@@ -1329,7 +1260,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
1329 }; 1260 };
1330 1261
1331 1262
1332 OSDMap response = CachedPostRequest(requestArgs); 1263 OSDMap response = WebUtil.PostToService(m_serviceURL, requestArgs);
1333 if (response["Success"].AsBoolean()) 1264 if (response["Success"].AsBoolean())
1334 { 1265 {
1335 return true; 1266 return true;
@@ -1341,49 +1272,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
1341 } 1272 }
1342 } 1273 }
1343 #endregion 1274 #endregion
1344
1345 #region CheesyCache
1346 OSDMap CachedPostRequest(NameValueCollection requestArgs)
1347 {
1348 // Immediately forward the request if the cache is disabled.
1349 if (m_cacheTimeout == 0)
1350 {
1351 return WebUtil.PostToService(m_groupsServerURI, requestArgs);
1352 }
1353
1354 // Check if this is an update or a request
1355 if ( requestArgs["RequestMethod"] == "RemoveGeneric"
1356 || requestArgs["RequestMethod"] == "AddGeneric"
1357 )
1358
1359 {
1360 // Any and all updates cause the cache to clear
1361 m_memoryCache.Clear();
1362
1363 // Send update to server, return the response without caching it
1364 return WebUtil.PostToService(m_groupsServerURI, requestArgs);
1365
1366 }
1367
1368 // If we're not doing an update, we must be requesting data
1369
1370 // Create the cache key for the request and see if we have it cached
1371 string CacheKey = WebUtil.BuildQueryString(requestArgs);
1372 OSDMap response = null;
1373 if (!m_memoryCache.TryGetValue(CacheKey, out response))
1374 {
1375 // if it wasn't in the cache, pass the request to the Simian Grid Services
1376 response = WebUtil.PostToService(m_groupsServerURI, requestArgs);
1377
1378 // and cache the response
1379 m_memoryCache.AddOrUpdate(CacheKey, response, TimeSpan.FromSeconds(m_cacheTimeout));
1380 }
1381
1382 // return cached response
1383 return response;
1384 }
1385 #endregion
1386
1387 } 1275 }
1388 1276
1389} 1277}
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs
index 79b9a16..ab343c8 100644
--- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs
@@ -29,7 +29,6 @@ using System;
29using System.Collections; 29using System.Collections;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Reflection; 31using System.Reflection;
32using System.Text;
33 32
34using Nwc.XmlRpc; 33using Nwc.XmlRpc;
35 34
@@ -62,7 +61,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
62 61
63 private bool m_connectorEnabled = false; 62 private bool m_connectorEnabled = false;
64 63
65 private string m_groupsServerURI = string.Empty; 64 private string m_serviceURL = string.Empty;
66 65
67 private bool m_disableKeepAlive = false; 66 private bool m_disableKeepAlive = false;
68 67
@@ -70,17 +69,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
70 private string m_groupWriteKey = string.Empty; 69 private string m_groupWriteKey = string.Empty;
71 70
72 private IUserAccountService m_accountService = null; 71 private IUserAccountService m_accountService = null;
73 72
74 private ExpiringCache<string, XmlRpcResponse> m_memoryCache;
75 private int m_cacheTimeout = 30;
76
77 // Used to track which agents are have dropped from a group chat session
78 // Should be reset per agent, on logon
79 // TODO: move this to Flotsam XmlRpc Service
80 // SessionID, List<AgentID>
81 private Dictionary<UUID, List<UUID>> m_groupsAgentsDroppedFromChatSession = new Dictionary<UUID, List<UUID>>();
82 private Dictionary<UUID, List<UUID>> m_groupsAgentsInvitedToChatSession = new Dictionary<UUID, List<UUID>>();
83
84 73
85 #region IRegionModuleBase Members 74 #region IRegionModuleBase Members
86 75
@@ -115,13 +104,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
115 return; 104 return;
116 } 105 }
117 106
118 m_log.InfoFormat("[XMLRPC-GROUPS-CONNECTOR]: Initializing {0}", this.Name); 107 m_log.InfoFormat("[GROUPS-CONNECTOR]: Initializing {0}", this.Name);
119 108
120 m_groupsServerURI = groupsConfig.GetString("GroupsServerURI", string.Empty); 109 m_serviceURL = groupsConfig.GetString("XmlRpcServiceURL", string.Empty);
121 if ((m_groupsServerURI == null) || 110 if ((m_serviceURL == null) ||
122 (m_groupsServerURI == string.Empty)) 111 (m_serviceURL == string.Empty))
123 { 112 {
124 m_log.ErrorFormat("Please specify a valid URL for GroupsServerURI in OpenSim.ini, [Groups]"); 113 m_log.ErrorFormat("Please specify a valid URL for XmlRpcServiceURL in OpenSim.ini, [Groups]");
125 m_connectorEnabled = false; 114 m_connectorEnabled = false;
126 return; 115 return;
127 } 116 }
@@ -131,26 +120,17 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
131 m_groupReadKey = groupsConfig.GetString("XmlRpcServiceReadKey", string.Empty); 120 m_groupReadKey = groupsConfig.GetString("XmlRpcServiceReadKey", string.Empty);
132 m_groupWriteKey = groupsConfig.GetString("XmlRpcServiceWriteKey", string.Empty); 121 m_groupWriteKey = groupsConfig.GetString("XmlRpcServiceWriteKey", string.Empty);
133 122
123
134 124
135 m_cacheTimeout = groupsConfig.GetInt("GroupsCacheTimeout", 30);
136 if (m_cacheTimeout == 0)
137 {
138 m_log.WarnFormat("[XMLRPC-GROUPS-CONNECTOR]: Groups Cache Disabled.");
139 }
140 else
141 {
142 m_log.InfoFormat("[XMLRPC-GROUPS-CONNECTOR]: Groups Cache Timeout set to {0}.", m_cacheTimeout);
143 }
144 125
145 // If we got all the config options we need, lets start'er'up 126 // If we got all the config options we need, lets start'er'up
146 m_memoryCache = new ExpiringCache<string, XmlRpcResponse>();
147 m_connectorEnabled = true; 127 m_connectorEnabled = true;
148 } 128 }
149 } 129 }
150 130
151 public void Close() 131 public void Close()
152 { 132 {
153 m_log.InfoFormat("[XMLRPC-GROUPS-CONNECTOR]: Closing {0}", this.Name); 133 m_log.InfoFormat("[GROUPS-CONNECTOR]: Closing {0}", this.Name);
154 } 134 }
155 135
156 public void AddRegion(OpenSim.Region.Framework.Scenes.Scene scene) 136 public void AddRegion(OpenSim.Region.Framework.Scenes.Scene scene)
@@ -776,69 +756,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
776 756
777 XmlRpcCall(requestingAgentID, "groups.addGroupNotice", param); 757 XmlRpcCall(requestingAgentID, "groups.addGroupNotice", param);
778 } 758 }
779
780
781
782 #endregion
783
784 #region GroupSessionTracking
785
786 public void ResetAgentGroupChatSessions(UUID agentID)
787 {
788 foreach (List<UUID> agentList in m_groupsAgentsDroppedFromChatSession.Values)
789 {
790 agentList.Remove(agentID);
791 }
792 }
793
794 public bool hasAgentBeenInvitedToGroupChatSession(UUID agentID, UUID groupID)
795 {
796 // If we're tracking this group, and we can find them in the tracking, then they've been invited
797 return m_groupsAgentsInvitedToChatSession.ContainsKey(groupID)
798 && m_groupsAgentsInvitedToChatSession[groupID].Contains(agentID);
799 }
800
801 public bool hasAgentDroppedGroupChatSession(UUID agentID, UUID groupID)
802 {
803 // If we're tracking drops for this group,
804 // and we find them, well... then they've dropped
805 return m_groupsAgentsDroppedFromChatSession.ContainsKey(groupID)
806 && m_groupsAgentsDroppedFromChatSession[groupID].Contains(agentID);
807 }
808
809 public void AgentDroppedFromGroupChatSession(UUID agentID, UUID groupID)
810 {
811 if (m_groupsAgentsDroppedFromChatSession.ContainsKey(groupID))
812 {
813 // If not in dropped list, add
814 if (!m_groupsAgentsDroppedFromChatSession[groupID].Contains(agentID))
815 {
816 m_groupsAgentsDroppedFromChatSession[groupID].Add(agentID);
817 }
818 }
819 }
820
821 public void AgentInvitedToGroupChatSession(UUID agentID, UUID groupID)
822 {
823 // Add Session Status if it doesn't exist for this session
824 CreateGroupChatSessionTracking(groupID);
825
826 // If nessesary, remove from dropped list
827 if (m_groupsAgentsDroppedFromChatSession[groupID].Contains(agentID))
828 {
829 m_groupsAgentsDroppedFromChatSession[groupID].Remove(agentID);
830 }
831 }
832
833 private void CreateGroupChatSessionTracking(UUID groupID)
834 {
835 if (!m_groupsAgentsDroppedFromChatSession.ContainsKey(groupID))
836 {
837 m_groupsAgentsDroppedFromChatSession.Add(groupID, new List<UUID>());
838 m_groupsAgentsInvitedToChatSession.Add(groupID, new List<UUID>());
839 }
840
841 }
842 #endregion 759 #endregion
843 760
844 #region XmlRpcHashtableMarshalling 761 #region XmlRpcHashtableMarshalling
@@ -932,84 +849,50 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
932 /// </summary> 849 /// </summary>
933 private Hashtable XmlRpcCall(UUID requestingAgentID, string function, Hashtable param) 850 private Hashtable XmlRpcCall(UUID requestingAgentID, string function, Hashtable param)
934 { 851 {
935 XmlRpcResponse resp = null; 852 string UserService;
936 string CacheKey = null; 853 UUID SessionID;
937 854 GetClientGroupRequestID(requestingAgentID, out UserService, out SessionID);
938 // Only bother with the cache if it isn't disabled. 855 param.Add("requestingAgentID", requestingAgentID.ToString());
939 if (m_cacheTimeout > 0) 856 param.Add("RequestingAgentUserService", UserService);
940 { 857 param.Add("RequestingSessionID", SessionID.ToString());
941 if (!function.StartsWith("groups.get"))
942 {
943 // Any and all updates cause the cache to clear
944 m_memoryCache.Clear();
945 }
946 else
947 {
948 StringBuilder sb = new StringBuilder(requestingAgentID + function);
949 foreach (object key in param.Keys)
950 {
951 if (param[key] != null)
952 {
953 sb.AppendFormat(",{0}:{1}", key.ToString(), param[key].ToString());
954 }
955 }
956
957 CacheKey = sb.ToString();
958 m_memoryCache.TryGetValue(CacheKey, out resp);
959 }
960
961 }
962 858
963 if( resp == null )
964 {
965 string UserService;
966 UUID SessionID;
967 GetClientGroupRequestID(requestingAgentID, out UserService, out SessionID);
968 param.Add("requestingAgentID", requestingAgentID.ToString());
969 param.Add("RequestingAgentUserService", UserService);
970 param.Add("RequestingSessionID", SessionID.ToString());
971 859
860 param.Add("ReadKey", m_groupReadKey);
861 param.Add("WriteKey", m_groupWriteKey);
972 862
973 param.Add("ReadKey", m_groupReadKey);
974 param.Add("WriteKey", m_groupWriteKey);
975 863
864 IList parameters = new ArrayList();
865 parameters.Add(param);
976 866
977 IList parameters = new ArrayList(); 867 ConfigurableKeepAliveXmlRpcRequest req;
978 parameters.Add(param); 868 req = new ConfigurableKeepAliveXmlRpcRequest(function, parameters, m_disableKeepAlive);
979
980 ConfigurableKeepAliveXmlRpcRequest req;
981 req = new ConfigurableKeepAliveXmlRpcRequest(function, parameters, m_disableKeepAlive);
982 869
870 XmlRpcResponse resp = null;
983 871
984 try 872 try
985 { 873 {
986 resp = req.Send(m_groupsServerURI, 10000); 874 resp = req.Send(m_serviceURL, 10000);
875 }
876 catch (Exception e)
877 {
878
987 879
988 if ((m_cacheTimeout > 0) && (CacheKey != null)) 880 m_log.ErrorFormat("[XMLRPCGROUPDATA]: An error has occured while attempting to access the XmlRpcGroups server method: {0}", function);
989 { 881 m_log.ErrorFormat("[XMLRPCGROUPDATA]: {0} ", e.ToString());
990 m_memoryCache.AddOrUpdate(CacheKey, resp, TimeSpan.FromSeconds(m_cacheTimeout));
991 }
992 882
883 foreach (string ResponseLine in req.RequestResponse.Split(new string[] { Environment.NewLine },StringSplitOptions.None))
884 {
885 m_log.ErrorFormat("[XMLRPCGROUPDATA]: {0} ", ResponseLine);
993 } 886 }
994 catch (Exception e) 887
888 foreach (string key in param.Keys)
995 { 889 {
996 m_log.ErrorFormat("[XMLRPC-GROUPS-CONNECTOR]: An error has occured while attempting to access the XmlRpcGroups server method: {0}", function); 890 m_log.WarnFormat("[XMLRPCGROUPDATA]: {0} :: {1}", key, param[key].ToString());
997 m_log.ErrorFormat("[XMLRPC-GROUPS-CONNECTOR]: {0} ", e.ToString());
998
999 foreach (string ResponseLine in req.RequestResponse.Split(new string[] { Environment.NewLine }, StringSplitOptions.None))
1000 {
1001 m_log.ErrorFormat("[XMLRPC-GROUPS-CONNECTOR]: {0} ", ResponseLine);
1002 }
1003
1004 foreach (string key in param.Keys)
1005 {
1006 m_log.WarnFormat("[XMLRPC-GROUPS-CONNECTOR]: {0} :: {1}", key, param[key].ToString());
1007 }
1008
1009 Hashtable respData = new Hashtable();
1010 respData.Add("error", e.ToString());
1011 return respData;
1012 } 891 }
892
893 Hashtable respData = new Hashtable();
894 respData.Add("error", e.ToString());
895 return respData;
1013 } 896 }
1014 897
1015 if (resp.Value is Hashtable) 898 if (resp.Value is Hashtable)
@@ -1023,21 +906,21 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
1023 return respData; 906 return respData;
1024 } 907 }
1025 908
1026 m_log.ErrorFormat("[XMLRPC-GROUPS-CONNECTOR]: The XmlRpc server returned a {1} instead of a hashtable for {0}", function, resp.Value.GetType().ToString()); 909 m_log.ErrorFormat("[XMLRPCGROUPDATA]: The XmlRpc server returned a {1} instead of a hashtable for {0}", function, resp.Value.GetType().ToString());
1027 910
1028 if (resp.Value is ArrayList) 911 if (resp.Value is ArrayList)
1029 { 912 {
1030 ArrayList al = (ArrayList)resp.Value; 913 ArrayList al = (ArrayList)resp.Value;
1031 m_log.ErrorFormat("[XMLRPC-GROUPS-CONNECTOR]: Contains {0} elements", al.Count); 914 m_log.ErrorFormat("[XMLRPCGROUPDATA]: Contains {0} elements", al.Count);
1032 915
1033 foreach (object o in al) 916 foreach (object o in al)
1034 { 917 {
1035 m_log.ErrorFormat("[XMLRPC-GROUPS-CONNECTOR]: {0} :: {1}", o.GetType().ToString(), o.ToString()); 918 m_log.ErrorFormat("[XMLRPCGROUPDATA]: {0} :: {1}", o.GetType().ToString(), o.ToString());
1036 } 919 }
1037 } 920 }
1038 else 921 else
1039 { 922 {
1040 m_log.ErrorFormat("[XMLRPC-GROUPS-CONNECTOR]: Function returned: {0}", resp.Value.ToString()); 923 m_log.ErrorFormat("[XMLRPCGROUPDATA]: Function returned: {0}", resp.Value.ToString());
1041 } 924 }
1042 925
1043 Hashtable error = new Hashtable(); 926 Hashtable error = new Hashtable();
@@ -1047,16 +930,16 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
1047 930
1048 private void LogRespDataToConsoleError(Hashtable respData) 931 private void LogRespDataToConsoleError(Hashtable respData)
1049 { 932 {
1050 m_log.Error("[XMLRPC-GROUPS-CONNECTOR]: Error:"); 933 m_log.Error("[XMLRPCGROUPDATA]: Error:");
1051 934
1052 foreach (string key in respData.Keys) 935 foreach (string key in respData.Keys)
1053 { 936 {
1054 m_log.ErrorFormat("[XMLRPC-GROUPS-CONNECTOR]: Key: {0}", key); 937 m_log.ErrorFormat("[XMLRPCGROUPDATA]: Key: {0}", key);
1055 938
1056 string[] lines = respData[key].ToString().Split(new char[] { '\n' }); 939 string[] lines = respData[key].ToString().Split(new char[] { '\n' });
1057 foreach (string line in lines) 940 foreach (string line in lines)
1058 { 941 {
1059 m_log.ErrorFormat("[XMLRPC-GROUPS-CONNECTOR]: {0}", line); 942 m_log.ErrorFormat("[XMLRPCGROUPDATA]: {0}", line);
1060 } 943 }
1061 944
1062 } 945 }
@@ -1065,8 +948,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
1065 948
1066 /// <summary> 949 /// <summary>
1067 /// Group Request Tokens are an attempt to allow the groups service to authenticate 950 /// Group Request Tokens are an attempt to allow the groups service to authenticate
1068 /// requests. 951 /// requests. Currently uses UserService, AgentID, and SessionID
1069 /// TODO: This broke after the big grid refactor, either find a better way, or discard this 952 /// TODO: Find a better way to do this.
1070 /// </summary> 953 /// </summary>
1071 /// <param name="client"></param> 954 /// <param name="client"></param>
1072 /// <returns></returns> 955 /// <returns></returns>