aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs186
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs12
2 files changed, 100 insertions, 98 deletions
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs
index 3d9175c..0aaf95c 100644
--- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs
@@ -296,15 +296,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
296 296
297 attemptDeliveryUuidSet 297 attemptDeliveryUuidSet
298 = new HashSet<string>(Array.ConvertAll<PresenceInfo, string>(onlineAgents, pi => pi.UserID)); 298 = new HashSet<string>(Array.ConvertAll<PresenceInfo, string>(onlineAgents, pi => pi.UserID));
299
300 //Array.ForEach<PresenceInfo>(onlineAgents, pi => attemptDeliveryUuidSet.Add(pi.UserID));
301
302 //groupMembers = groupMembers.Where(gmd => onlineAgentsUuidSet.Contains(gmd.AgentID.ToString())).ToList();
303
304 // if (m_debugEnabled)
305// m_log.DebugFormat(
306// "[GROUPS-MESSAGING]: SendMessageToGroup called for group {0} with {1} visible members, {2} online",
307// groupID, groupMembersCount, groupMembers.Count());
308 } 299 }
309 else 300 else
310 { 301 {
@@ -387,7 +378,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
387 member.AgentID, Environment.TickCount - startTick); 378 member.AgentID, Environment.TickCount - startTick);
388 } 379 }
389 } 380 }
390 else 381 else if(im.dialog != (byte)InstantMessageDialog.SessionAdd &&
382 im.dialog != (byte)InstantMessageDialog.SessionDrop)
391 { 383 {
392 int startTick = Environment.TickCount; 384 int startTick = Environment.TickCount;
393 385
@@ -443,21 +435,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
443 { 435 {
444 IClientAPI client = null; 436 IClientAPI client = null;
445 437
446 if (msg.dialog == (byte)InstantMessageDialog.SessionSend) 438 client = GetActiveClient(new UUID(msg.toAgentID));
447 {
448 client = GetActiveClient(new UUID(msg.toAgentID));
449 439
450 if (client != null) 440 if (client == null)
451 { 441 {
452 if (m_debugEnabled) 442 m_log.WarnFormat("[GROUPS-MESSAGING]: Received a message over the grid for a client that isn't here: {0}", msg.toAgentID);
453 m_log.DebugFormat("[GROUPS-MESSAGING]: Delivering to {0} locally", client.Name);
454 }
455 else
456 {
457 m_log.WarnFormat("[GROUPS-MESSAGING]: Received a message over the grid for a client that isn't here: {0}", msg.toAgentID);
458 443
459 return; 444 return;
460 }
461 } 445 }
462 446
463 ProcessMessageFromGroupSession(msg, client); 447 ProcessMessageFromGroupSession(msg, client);
@@ -471,79 +455,96 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
471 "[GROUPS-MESSAGING]: Session message from {0} going to agent {1}, sessionID {2}, type {3}", 455 "[GROUPS-MESSAGING]: Session message from {0} going to agent {1}, sessionID {2}, type {3}",
472 msg.fromAgentName, msg.toAgentID, msg.imSessionID, (InstantMessageDialog)msg.dialog); 456 msg.fromAgentName, msg.toAgentID, msg.imSessionID, (InstantMessageDialog)msg.dialog);
473 457
474 UUID AgentID = new UUID(msg.fromAgentID); 458 UUID fromAgentID = new UUID(msg.fromAgentID);
475 UUID GroupID = new UUID(msg.imSessionID); 459 UUID GroupID = new UUID(msg.imSessionID);
460 IEventQueue eq = client.Scene.RequestModuleInterface<IEventQueue>();
476 461
477 switch (msg.dialog) 462 switch (msg.dialog)
478 { 463 {
479 case (byte)InstantMessageDialog.SessionAdd: 464 case (byte)InstantMessageDialog.SessionAdd:
480 m_groupData.AgentInvitedToGroupChatSession(AgentID, GroupID); 465 m_groupData.AgentInvitedToGroupChatSession(fromAgentID, GroupID);
466 if(eq != null)
467 eq.ChatterBoxSessionAgentListUpdates(
468 GroupID
469 , fromAgentID
470 , client.AgentId
471 , false //canVoiceChat
472 , false //isModerator
473 , false //text mute
474 , true // enter
475 );
481 break; 476 break;
482 477
483 case (byte)InstantMessageDialog.SessionDrop: 478 case (byte)InstantMessageDialog.SessionDrop:
484 m_groupData.AgentDroppedFromGroupChatSession(AgentID, GroupID); 479 m_groupData.AgentDroppedFromGroupChatSession(fromAgentID, GroupID);
480 if(eq != null)
481 eq.ChatterBoxSessionAgentListUpdates(
482 GroupID
483 , fromAgentID
484 , client.AgentId
485 , false //canVoiceChat
486 , false //isModerator
487 , false //text mute
488 , false // leave
489 );
485 break; 490 break;
486 491
487 case (byte)InstantMessageDialog.SessionSend: 492 case (byte)InstantMessageDialog.SessionSend:
488 if (!m_groupData.hasAgentDroppedGroupChatSession(AgentID, GroupID) 493 if (!m_groupData.hasAgentDroppedGroupChatSession(client.AgentId, GroupID))
489 && !m_groupData.hasAgentBeenInvitedToGroupChatSession(AgentID, GroupID)
490 )
491 { 494 {
492 // Agent not in session and hasn't dropped from session 495 if(!m_groupData.hasAgentBeenInvitedToGroupChatSession(client.AgentId, GroupID))
493 // Add them to the session for now, and Invite them
494 m_groupData.AgentInvitedToGroupChatSession(AgentID, GroupID);
495
496 GroupRecord groupInfo = m_groupData.GetGroupRecord(UUID.Zero, GroupID, null);
497 if (groupInfo != null)
498 { 496 {
499 if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: Sending chatterbox invite instant message");
500 497
501 // Force? open the group session dialog??? 498 GroupRecord groupInfo = m_groupData.GetGroupRecord(UUID.Zero, GroupID, null);
502 // and simultanously deliver the message, so we don't need to do a seperate client.SendInstantMessage(msg); 499 if (groupInfo != null)
503 IEventQueue eq = client.Scene.RequestModuleInterface<IEventQueue>(); 500 {
504 eq.ChatterboxInvitation( 501 if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: Sending chatterbox invite instant message");
505 GroupID 502
506 , groupInfo.GroupName 503 if(eq != null)
507 , new UUID(msg.fromAgentID) 504 {
508 , msg.message 505 eq.ChatterboxInvitation(
509 , new UUID(msg.toAgentID) 506 GroupID
510 , msg.fromAgentName 507 , groupInfo.GroupName
511 , msg.dialog 508 , fromAgentID
512 , msg.timestamp 509 , msg.message
513 , msg.offline == 1 510 , client.AgentId
514 , (int)msg.ParentEstateID 511 , msg.fromAgentName
515 , msg.Position 512 , msg.dialog
516 , 1 513 , msg.timestamp
517 , new UUID(msg.imSessionID) 514 , msg.offline == 1
518 , msg.fromGroup 515 , (int)msg.ParentEstateID
519 , Utils.StringToBytes(groupInfo.GroupName) 516 , msg.Position
520 ); 517 , 1
521 518 , new UUID(msg.imSessionID)
522 eq.ChatterBoxSessionAgentListUpdates( 519 , msg.fromGroup
523 new UUID(GroupID) 520 , Utils.StringToBytes(groupInfo.GroupName)
524 , new UUID(msg.fromAgentID) 521 );
525 , new UUID(msg.toAgentID) 522 }
526 , false //canVoiceChat 523 }
527 , false //isModerator 524 }
528 , false //text mute 525 else
529 , true // enter 526 {
530 ); 527 client.SendInstantMessage(msg);
531 } 528 }
532 529
533 break; 530// if (!m_groupData.hasAgentBeenInvitedToGroupChatSession(fromAgentID, GroupID))
534 } 531 {
535 else if (!m_groupData.hasAgentDroppedGroupChatSession(AgentID, GroupID)) 532 m_groupData.AgentInvitedToGroupChatSession(fromAgentID, GroupID);
536 { 533 eq.ChatterBoxSessionAgentListUpdates(
537 // User hasn't dropped, so they're in the session, 534 GroupID
538 // maybe we should deliver it. 535 , fromAgentID
539 client.SendInstantMessage(msg); 536 , client.AgentId
537 , false //canVoiceChat
538 , false //isModerator
539 , false //text mute
540 , true // enter
541 );
542 }
540 } 543 }
541
542 break; 544 break;
543 545
544 default: 546 default:
545 client.SendInstantMessage(msg); 547 client.SendInstantMessage(msg);
546
547 break;; 548 break;;
548 } 549 }
549 } 550 }
@@ -560,14 +561,14 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
560 DebugGridInstantMessage(im); 561 DebugGridInstantMessage(im);
561 } 562 }
562 563
564 UUID GroupID = new UUID(im.imSessionID);
565 UUID AgentID = new UUID(im.fromAgentID);
566
563 // Start group IM session 567 // Start group IM session
564 if ((im.dialog == (byte)InstantMessageDialog.SessionGroupStart)) 568 if ((im.dialog == (byte)InstantMessageDialog.SessionGroupStart))
565 { 569 {
566 if (m_debugEnabled) m_log.InfoFormat("[GROUPS-MESSAGING]: imSessionID({0}) toAgentID({1})", im.imSessionID, im.toAgentID); 570 if (m_debugEnabled) m_log.InfoFormat("[GROUPS-MESSAGING]: imSessionID({0}) toAgentID({1})", im.imSessionID, im.toAgentID);
567 571
568 UUID GroupID = new UUID(im.imSessionID);
569 UUID AgentID = new UUID(im.fromAgentID);
570
571 GroupRecord groupInfo = m_groupData.GetGroupRecord(UUID.Zero, GroupID, null); 572 GroupRecord groupInfo = m_groupData.GetGroupRecord(UUID.Zero, GroupID, null);
572 573
573 if (groupInfo != null) 574 if (groupInfo != null)
@@ -575,27 +576,16 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
575 m_groupData.AgentInvitedToGroupChatSession(AgentID, GroupID); 576 m_groupData.AgentInvitedToGroupChatSession(AgentID, GroupID);
576 577
577 ChatterBoxSessionStartReplyViaCaps(remoteClient, groupInfo.GroupName, GroupID); 578 ChatterBoxSessionStartReplyViaCaps(remoteClient, groupInfo.GroupName, GroupID);
578/* this seems wrong 579
579 IEventQueue queue = remoteClient.Scene.RequestModuleInterface<IEventQueue>(); 580 // we need to send here a list of known participants.
580 queue.ChatterBoxSessionAgentListUpdates( 581 im.dialog = (byte)InstantMessageDialog.SessionAdd;
581 GroupID 582 SendMessageToGroup(im, GroupID);
582 , AgentID
583 , new UUID(im.toAgentID)
584 , false //canVoiceChat
585 , false //isModerator
586 , false //text mute
587 , true
588 );
589*/
590 } 583 }
591 } 584 }
592 585
593 // Send a message from locally connected client to a group 586 // Send a message from locally connected client to a group
594 if ((im.dialog == (byte)InstantMessageDialog.SessionSend)) 587 if ((im.dialog == (byte)InstantMessageDialog.SessionSend))
595 { 588 {
596 UUID GroupID = new UUID(im.imSessionID);
597 UUID AgentID = new UUID(im.fromAgentID);
598
599 if (m_debugEnabled) 589 if (m_debugEnabled)
600 m_log.DebugFormat("[GROUPS-MESSAGING]: Send message to session for group {0} with session ID {1}", GroupID, im.imSessionID.ToString()); 590 m_log.DebugFormat("[GROUPS-MESSAGING]: Send message to session for group {0} with session ID {1}", GroupID, im.imSessionID.ToString());
601 591
@@ -604,6 +594,16 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
604 594
605 SendMessageToGroup(im, GroupID); 595 SendMessageToGroup(im, GroupID);
606 } 596 }
597
598 if ((im.dialog == (byte)InstantMessageDialog.SessionDrop))
599 {
600 if (m_debugEnabled)
601 m_log.DebugFormat("[GROUPS-MESSAGING]: Send message to session for group {0} with session ID {1}", GroupID, im.imSessionID.ToString());
602
603 m_groupData.AgentDroppedFromGroupChatSession(AgentID, GroupID);
604
605 SendMessageToGroup(im, GroupID);
606 }
607 } 607 }
608 608
609 #endregion 609 #endregion
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs
index 2dda3a1..83f08e0 100644
--- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs
@@ -803,11 +803,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
803 { 803 {
804 if (m_groupsAgentsDroppedFromChatSession.ContainsKey(groupID)) 804 if (m_groupsAgentsDroppedFromChatSession.ContainsKey(groupID))
805 { 805 {
806 if (m_groupsAgentsInvitedToChatSession[groupID].Contains(agentID))
807 m_groupsAgentsInvitedToChatSession[groupID].Remove(agentID);
808
806 // If not in dropped list, add 809 // If not in dropped list, add
807 if (!m_groupsAgentsDroppedFromChatSession[groupID].Contains(agentID)) 810 if (!m_groupsAgentsDroppedFromChatSession[groupID].Contains(agentID))
808 {
809 m_groupsAgentsDroppedFromChatSession[groupID].Add(agentID); 811 m_groupsAgentsDroppedFromChatSession[groupID].Add(agentID);
810 }
811 } 812 }
812 } 813 }
813 814
@@ -818,10 +819,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
818 819
819 // If nessesary, remove from dropped list 820 // If nessesary, remove from dropped list
820 if (m_groupsAgentsDroppedFromChatSession[groupID].Contains(agentID)) 821 if (m_groupsAgentsDroppedFromChatSession[groupID].Contains(agentID))
821 {
822 m_groupsAgentsDroppedFromChatSession[groupID].Remove(agentID); 822 m_groupsAgentsDroppedFromChatSession[groupID].Remove(agentID);
823 } 823
824 } 824 if (!m_groupsAgentsInvitedToChatSession[groupID].Contains(agentID))
825 m_groupsAgentsInvitedToChatSession[groupID].Add(agentID);
826 }
825 827
826 private void CreateGroupChatSessionTracking(UUID groupID) 828 private void CreateGroupChatSessionTracking(UUID groupID)
827 { 829 {