aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs
diff options
context:
space:
mode:
authorMelanie2010-05-05 22:50:11 +0100
committerMelanie2010-05-05 22:50:11 +0100
commit7e0d5b866519a303490ee4c30b33c7598d99bbb1 (patch)
treeebe6627b312fb98e813ecc0d4adb98bf4fb36334 /OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs
parentPlumb Viewer version into ScenePresence for initial login. It's still not (diff)
parentStab a test fail (diff)
downloadopensim-SC-7e0d5b866519a303490ee4c30b33c7598d99bbb1.zip
opensim-SC-7e0d5b866519a303490ee4c30b33c7598d99bbb1.tar.gz
opensim-SC-7e0d5b866519a303490ee4c30b33c7598d99bbb1.tar.bz2
opensim-SC-7e0d5b866519a303490ee4c30b33c7598d99bbb1.tar.xz
Merge branch 'master' into careminster-presence-refactor
Diffstat (limited to 'OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs')
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs274
1 files changed, 139 insertions, 135 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