aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs')
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs128
1 files changed, 64 insertions, 64 deletions
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs
index 17a5349..185d44d 100644
--- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs
@@ -49,9 +49,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
49 49
50 private List<Scene> m_sceneList = new List<Scene>(); 50 private List<Scene> m_sceneList = new List<Scene>();
51 51
52 private IMessageTransferModule m_msgTransferModule = null; 52 private IMessageTransferModule m_msgTransferModule = null;
53 53
54 private IGroupsServicesConnector m_groupData = null; 54 private IGroupsServicesConnector m_groupData = null;
55 55
56 // Config Options 56 // Config Options
57 private bool m_groupMessagingEnabled = false; 57 private bool m_groupMessagingEnabled = false;
@@ -108,13 +108,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
108 if (!m_groupMessagingEnabled) 108 if (!m_groupMessagingEnabled)
109 return; 109 return;
110 110
111 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);
112 112
113 m_groupData = scene.RequestModuleInterface<IGroupsServicesConnector>(); 113 m_groupData = scene.RequestModuleInterface<IGroupsServicesConnector>();
114 114
115 // No groups module, no groups messaging 115 // No groups module, no groups messaging
116 if (m_groupData == null) 116 if (m_groupData == null)
117 { 117 {
118 m_log.Error("[GROUPS-MESSAGING]: Could not get IGroupsServicesConnector, GroupsMessagingModule is now disabled."); 118 m_log.Error("[GROUPS-MESSAGING]: Could not get IGroupsServicesConnector, GroupsMessagingModule is now disabled.");
119 Close(); 119 Close();
120 m_groupMessagingEnabled = false; 120 m_groupMessagingEnabled = false;
@@ -190,9 +190,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
190 190
191 #endregion 191 #endregion
192 192
193 /// <summary> 193 /// <summary>
194 /// Not really needed, but does confirm that the group exists. 194 /// Not really needed, but does confirm that the group exists.
195 /// </summary> 195 /// </summary>
196 public bool StartGroupChatSession(UUID agentID, UUID groupID) 196 public bool StartGroupChatSession(UUID agentID, UUID groupID)
197 { 197 {
198 if (m_debugEnabled) 198 if (m_debugEnabled)
@@ -201,7 +201,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
201 GroupRecord groupInfo = m_groupData.GetGroupRecord(agentID, groupID, null); 201 GroupRecord groupInfo = m_groupData.GetGroupRecord(agentID, groupID, null);
202 202
203 if (groupInfo != null) 203 if (groupInfo != null)
204 { 204 {
205 return true; 205 return true;
206 } 206 }
207 else 207 else
@@ -213,11 +213,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
213 public void SendMessageToGroup(GridInstantMessage im, UUID groupID) 213 public void SendMessageToGroup(GridInstantMessage im, UUID groupID)
214 { 214 {
215 if (m_debugEnabled) 215 if (m_debugEnabled)
216 m_log.DebugFormat("[GROUPS-MESSAGING]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); 216 m_log.DebugFormat("[GROUPS-MESSAGING]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
217 217
218 218
219 foreach (GroupMembersData member in m_groupData.GetGroupMembers(UUID.Zero, groupID)) 219 foreach (GroupMembersData member in m_groupData.GetGroupMembers(UUID.Zero, groupID))
220 { 220 {
221 if (m_groupData.hasAgentDroppedGroupChatSession(member.AgentID, groupID)) 221 if (m_groupData.hasAgentDroppedGroupChatSession(member.AgentID, groupID))
222 { 222 {
223 // Don't deliver messages to people who have dropped this session 223 // Don't deliver messages to people who have dropped this session
@@ -226,7 +226,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
226 } 226 }
227 227
228 // Copy Message 228 // Copy Message
229 GridInstantMessage msg = new GridInstantMessage(); 229 GridInstantMessage msg = new GridInstantMessage();
230 msg.imSessionID = groupID.Guid; 230 msg.imSessionID = groupID.Guid;
231 msg.fromAgentName = im.fromAgentName; 231 msg.fromAgentName = im.fromAgentName;
232 msg.message = im.message; 232 msg.message = im.message;
@@ -259,13 +259,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
259 } 259 }
260 } 260 }
261 261
262 #region SimGridEventHandlers 262 #region SimGridEventHandlers
263 263
264 void OnClientLogin(IClientAPI client) 264 void OnClientLogin(IClientAPI client)
265 { 265 {
266 if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: OnInstantMessage registered for {0}", client.Name); 266 if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: OnInstantMessage registered for {0}", client.Name);
267 267
268 268
269 } 269 }
270 270
271 private void OnNewClient(IClientAPI client) 271 private void OnNewClient(IClientAPI client)
@@ -303,28 +303,28 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
303 303
304 private void ProcessMessageFromGroupSession(GridInstantMessage msg) 304 private void ProcessMessageFromGroupSession(GridInstantMessage msg)
305 { 305 {
306 if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: Session message from {0} going to agent {1}", msg.fromAgentName, msg.toAgentID); 306 if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: Session message from {0} going to agent {1}", msg.fromAgentName, msg.toAgentID);
307 307
308 UUID AgentID = new UUID(msg.fromAgentID); 308 UUID AgentID = new UUID(msg.fromAgentID);
309 UUID GroupID = new UUID(msg.imSessionID); 309 UUID GroupID = new UUID(msg.imSessionID);
310 310
311 switch (msg.dialog) 311 switch (msg.dialog)
312 { 312 {
313 case (byte)InstantMessageDialog.SessionAdd: 313 case (byte)InstantMessageDialog.SessionAdd:
314 m_groupData.AgentInvitedToGroupChatSession(AgentID, GroupID); 314 m_groupData.AgentInvitedToGroupChatSession(AgentID, GroupID);
315 break; 315 break;
316 316
317 case (byte)InstantMessageDialog.SessionDrop: 317 case (byte)InstantMessageDialog.SessionDrop:
318 m_groupData.AgentDroppedFromGroupChatSession(AgentID, GroupID); 318 m_groupData.AgentDroppedFromGroupChatSession(AgentID, GroupID);
319 break; 319 break;
320 320
321 case (byte)InstantMessageDialog.SessionSend: 321 case (byte)InstantMessageDialog.SessionSend:
322 if (!m_groupData.hasAgentDroppedGroupChatSession(AgentID, GroupID) 322 if (!m_groupData.hasAgentDroppedGroupChatSession(AgentID, GroupID)
323 && !m_groupData.hasAgentBeenInvitedToGroupChatSession(AgentID, GroupID) 323 && !m_groupData.hasAgentBeenInvitedToGroupChatSession(AgentID, GroupID)
324 ) 324 )
325 { 325 {
326 // Agent not in session and hasn't dropped from session 326 // Agent not in session and hasn't dropped from session
327 // Add them to the session for now, and Invite them 327 // Add them to the session for now, and Invite them
328 m_groupData.AgentInvitedToGroupChatSession(AgentID, GroupID); 328 m_groupData.AgentInvitedToGroupChatSession(AgentID, GroupID);
329 329
330 UUID toAgentID = new UUID(msg.toAgentID); 330 UUID toAgentID = new UUID(msg.toAgentID);
@@ -336,10 +336,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
336 { 336 {
337 if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: Sending chatterbox invite instant message"); 337 if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: Sending chatterbox invite instant message");
338 338
339 // Force? open the group session dialog??? 339 // Force? open the group session dialog???
340 // and simultanously deliver the message, so we don't need to do a seperate client.SendInstantMessage(msg); 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>(); 341 IEventQueue eq = activeClient.Scene.RequestModuleInterface<IEventQueue>();
342 eq.ChatterboxInvitation( 342 eq.ChatterboxInvitation(
343 GroupID 343 GroupID
344 , groupInfo.GroupName 344 , groupInfo.GroupName
345 , new UUID(msg.fromAgentID) 345 , new UUID(msg.fromAgentID)
@@ -357,7 +357,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
357 , Utils.StringToBytes(groupInfo.GroupName) 357 , Utils.StringToBytes(groupInfo.GroupName)
358 ); 358 );
359 359
360 eq.ChatterBoxSessionAgentListUpdates( 360 eq.ChatterBoxSessionAgentListUpdates(
361 new UUID(GroupID) 361 new UUID(GroupID)
362 , new UUID(msg.fromAgentID) 362 , new UUID(msg.fromAgentID)
363 , new UUID(msg.toAgentID) 363 , new UUID(msg.toAgentID)
@@ -367,7 +367,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
367 ); 367 );
368 } 368 }
369 } 369 }
370 } 370 }
371 else if (!m_groupData.hasAgentDroppedGroupChatSession(AgentID, GroupID)) 371 else if (!m_groupData.hasAgentDroppedGroupChatSession(AgentID, GroupID))
372 { 372 {
373 // User hasn't dropped, so they're in the session, 373 // User hasn't dropped, so they're in the session,
@@ -394,8 +394,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
394 394
395 #endregion 395 #endregion
396 396
397 397
398 #region ClientEvents 398 #region ClientEvents
399 private void OnInstantMessage(IClientAPI remoteClient, GridInstantMessage im) 399 private void OnInstantMessage(IClientAPI remoteClient, GridInstantMessage im)
400 { 400 {
401 if (m_debugEnabled) 401 if (m_debugEnabled)
@@ -407,23 +407,23 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
407 407
408 // Start group IM session 408 // Start group IM session
409 if ((im.dialog == (byte)InstantMessageDialog.SessionGroupStart)) 409 if ((im.dialog == (byte)InstantMessageDialog.SessionGroupStart))
410 { 410 {
411 if (m_debugEnabled) m_log.InfoFormat("[GROUPS-MESSAGING]: imSessionID({0}) toAgentID({1})", im.imSessionID, im.toAgentID); 411 if (m_debugEnabled) m_log.InfoFormat("[GROUPS-MESSAGING]: imSessionID({0}) toAgentID({1})", im.imSessionID, im.toAgentID);
412 412
413 UUID GroupID = new UUID(im.imSessionID); 413 UUID GroupID = new UUID(im.imSessionID);
414 UUID AgentID = new UUID(im.fromAgentID); 414 UUID AgentID = new UUID(im.fromAgentID);
415 415
416 GroupRecord groupInfo = m_groupData.GetGroupRecord(UUID.Zero, GroupID, null); 416 GroupRecord groupInfo = m_groupData.GetGroupRecord(UUID.Zero, GroupID, null);
417 417
418 if (groupInfo != null) 418 if (groupInfo != null)
419 { 419 {
420 m_groupData.AgentInvitedToGroupChatSession(AgentID, GroupID); 420 m_groupData.AgentInvitedToGroupChatSession(AgentID, GroupID);
421 421
422 ChatterBoxSessionStartReplyViaCaps(remoteClient, groupInfo.GroupName, GroupID); 422 ChatterBoxSessionStartReplyViaCaps(remoteClient, groupInfo.GroupName, GroupID);
423 423
424 IEventQueue queue = remoteClient.Scene.RequestModuleInterface<IEventQueue>(); 424 IEventQueue queue = remoteClient.Scene.RequestModuleInterface<IEventQueue>();
425 queue.ChatterBoxSessionAgentListUpdates( 425 queue.ChatterBoxSessionAgentListUpdates(
426 GroupID 426 GroupID
427 , AgentID 427 , AgentID
428 , new UUID(im.toAgentID) 428 , new UUID(im.toAgentID)
429 , false //canVoiceChat 429 , false //canVoiceChat
@@ -435,16 +435,16 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
435 435
436 // Send a message from locally connected client to a group 436 // Send a message from locally connected client to a group
437 if ((im.dialog == (byte)InstantMessageDialog.SessionSend)) 437 if ((im.dialog == (byte)InstantMessageDialog.SessionSend))
438 { 438 {
439 UUID GroupID = new UUID(im.imSessionID); 439 UUID GroupID = new UUID(im.imSessionID);
440 UUID AgentID = new UUID(im.fromAgentID); 440 UUID AgentID = new UUID(im.fromAgentID);
441 441
442 if (m_debugEnabled) 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()); 443 m_log.DebugFormat("[GROUPS-MESSAGING]: Send message to session for group {0} with session ID {1}", GroupID, im.imSessionID.ToString());
444 444
445 //If this agent is sending a message, then they want to be in the session 445 //If this agent is sending a message, then they want to be in the session
446 m_groupData.AgentInvitedToGroupChatSession(AgentID, GroupID); 446 m_groupData.AgentInvitedToGroupChatSession(AgentID, GroupID);
447 447
448 SendMessageToGroup(im, GroupID); 448 SendMessageToGroup(im, GroupID);
449 } 449 }
450 } 450 }
@@ -501,7 +501,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
501 /// Try to find an active IClientAPI reference for agentID giving preference to root connections 501 /// Try to find an active IClientAPI reference for agentID giving preference to root connections
502 /// </summary> 502 /// </summary>
503 private IClientAPI GetActiveClient(UUID agentID) 503 private IClientAPI GetActiveClient(UUID agentID)
504 { 504 {
505 if (m_debugEnabled) m_log.WarnFormat("[GROUPS-MESSAGING]: Looking for local client {0}", agentID); 505 if (m_debugEnabled) m_log.WarnFormat("[GROUPS-MESSAGING]: Looking for local client {0}", agentID);
506 506
507 IClientAPI child = null; 507 IClientAPI child = null;
@@ -514,26 +514,26 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
514 { 514 {
515 ScenePresence user = (ScenePresence)scene.Entities[agentID]; 515 ScenePresence user = (ScenePresence)scene.Entities[agentID];
516 if (!user.IsChildAgent) 516 if (!user.IsChildAgent)
517 { 517 {
518 if (m_debugEnabled) m_log.WarnFormat("[GROUPS-MESSAGING]: Found root agent for client : {0}", user.ControllingClient.Name); 518 if (m_debugEnabled) m_log.WarnFormat("[GROUPS-MESSAGING]: Found root agent for client : {0}", user.ControllingClient.Name);
519 return user.ControllingClient; 519 return user.ControllingClient;
520 } 520 }
521 else 521 else
522 { 522 {
523 if (m_debugEnabled) m_log.WarnFormat("[GROUPS-MESSAGING]: Found child agent for client : {0}", user.ControllingClient.Name); 523 if (m_debugEnabled) m_log.WarnFormat("[GROUPS-MESSAGING]: Found child agent for client : {0}", user.ControllingClient.Name);
524 child = user.ControllingClient; 524 child = user.ControllingClient;
525 } 525 }
526 } 526 }
527 } 527 }
528 528
529 // If we didn't find a root, then just return whichever child we found, or null if none 529 // If we didn't find a root, then just return whichever child we found, or null if none
530 if (child == null) 530 if (child == null)
531 { 531 {
532 if (m_debugEnabled) m_log.WarnFormat("[GROUPS-MESSAGING]: Could not find local client for agent : {0}", agentID); 532 if (m_debugEnabled) m_log.WarnFormat("[GROUPS-MESSAGING]: Could not find local client for agent : {0}", agentID);
533 } 533 }
534 else 534 else
535 { 535 {
536 if (m_debugEnabled) m_log.WarnFormat("[GROUPS-MESSAGING]: Returning child agent for client : {0}", child.Name); 536 if (m_debugEnabled) m_log.WarnFormat("[GROUPS-MESSAGING]: Returning child agent for client : {0}", child.Name);
537 } 537 }
538 return child; 538 return child;
539 } 539 }