diff options
author | onefang | 2019-09-11 16:36:50 +1000 |
---|---|---|
committer | onefang | 2019-09-11 16:36:50 +1000 |
commit | 50cd1ffd32f69228e566f2b0b89f86ea0d9fe489 (patch) | |
tree | 52f2ab0c04f1a5d7d6ac5dc872981b4b156447e7 /OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs | |
parent | Renamed branch to SledjChisl. (diff) | |
parent | Bump to release flavour, build 0. (diff) | |
download | opensim-SC_OLD-50cd1ffd32f69228e566f2b0b89f86ea0d9fe489.zip opensim-SC_OLD-50cd1ffd32f69228e566f2b0b89f86ea0d9fe489.tar.gz opensim-SC_OLD-50cd1ffd32f69228e566f2b0b89f86ea0d9fe489.tar.bz2 opensim-SC_OLD-50cd1ffd32f69228e566f2b0b89f86ea0d9fe489.tar.xz |
Merge branch 'SledjChisl'
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs | 237 |
1 files changed, 120 insertions, 117 deletions
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs index e1b6abb..8791235 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs | |||
@@ -125,7 +125,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
125 | { | 125 | { |
126 | if (!m_groupMessagingEnabled) | 126 | if (!m_groupMessagingEnabled) |
127 | return; | 127 | return; |
128 | 128 | ||
129 | scene.RegisterModuleInterface<IGroupsMessagingModule>(this); | 129 | scene.RegisterModuleInterface<IGroupsMessagingModule>(this); |
130 | 130 | ||
131 | scene.AddCommand( | 131 | scene.AddCommand( |
@@ -136,7 +136,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
136 | "This setting turns on very verbose groups messaging debugging", | 136 | "This setting turns on very verbose groups messaging debugging", |
137 | HandleDebugGroupsMessagingVerbose); | 137 | HandleDebugGroupsMessagingVerbose); |
138 | } | 138 | } |
139 | 139 | ||
140 | public void RegionLoaded(Scene scene) | 140 | public void RegionLoaded(Scene scene) |
141 | { | 141 | { |
142 | if (!m_groupMessagingEnabled) | 142 | if (!m_groupMessagingEnabled) |
@@ -205,7 +205,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
205 | m_msgTransferModule = null; | 205 | m_msgTransferModule = null; |
206 | } | 206 | } |
207 | 207 | ||
208 | public Type ReplaceableInterface | 208 | public Type ReplaceableInterface |
209 | { | 209 | { |
210 | get { return null; } | 210 | get { return null; } |
211 | } | 211 | } |
@@ -253,7 +253,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
253 | { | 253 | { |
254 | if (m_debugEnabled) | 254 | if (m_debugEnabled) |
255 | m_log.DebugFormat("[GROUPS-MESSAGING]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 255 | m_log.DebugFormat("[GROUPS-MESSAGING]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); |
256 | 256 | ||
257 | GroupRecord groupInfo = m_groupData.GetGroupRecord(agentID, groupID, null); | 257 | GroupRecord groupInfo = m_groupData.GetGroupRecord(agentID, groupID, null); |
258 | 258 | ||
259 | if (groupInfo != null) | 259 | if (groupInfo != null) |
@@ -270,7 +270,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
270 | { | 270 | { |
271 | SendMessageToGroup(im, groupID, new UUID(im.fromAgentID), null); | 271 | SendMessageToGroup(im, groupID, new UUID(im.fromAgentID), null); |
272 | } | 272 | } |
273 | 273 | ||
274 | public void SendMessageToGroup( | 274 | public void SendMessageToGroup( |
275 | GridInstantMessage im, UUID groupID, UUID sendingAgentForGroupCalls, Func<GroupMembersData, bool> sendCondition) | 275 | GridInstantMessage im, UUID groupID, UUID sendingAgentForGroupCalls, Func<GroupMembersData, bool> sendCondition) |
276 | { | 276 | { |
@@ -294,28 +294,19 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
294 | m_usersOnlineCache.Add(groupID, onlineAgents, m_usersOnlineCacheExpirySeconds); | 294 | m_usersOnlineCache.Add(groupID, onlineAgents, m_usersOnlineCacheExpirySeconds); |
295 | } | 295 | } |
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 | { |
311 | attemptDeliveryUuidSet | 302 | attemptDeliveryUuidSet |
312 | = new HashSet<string>(groupMembers.ConvertAll<string>(gmd => gmd.AgentID.ToString())); | 303 | = new HashSet<string>(groupMembers.ConvertAll<string>(gmd => gmd.AgentID.ToString())); |
313 | 304 | ||
314 | if (m_debugEnabled) | 305 | if (m_debugEnabled) |
315 | m_log.DebugFormat( | 306 | m_log.DebugFormat( |
316 | "[GROUPS-MESSAGING]: SendMessageToGroup called for group {0} with {1} visible members", | 307 | "[GROUPS-MESSAGING]: SendMessageToGroup called for group {0} with {1} visible members", |
317 | groupID, groupMembers.Count); | 308 | groupID, groupMembers.Count); |
318 | } | 309 | } |
319 | 310 | ||
320 | foreach (GroupMembersData member in groupMembers) | 311 | foreach (GroupMembersData member in groupMembers) |
321 | { | 312 | { |
@@ -323,9 +314,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
323 | { | 314 | { |
324 | if (!sendCondition(member)) | 315 | if (!sendCondition(member)) |
325 | { | 316 | { |
326 | if (m_debugEnabled) | 317 | if (m_debugEnabled) |
327 | m_log.DebugFormat( | 318 | m_log.DebugFormat( |
328 | "[GROUPS-MESSAGING]: Not sending to {0} as they do not fulfill send condition", | 319 | "[GROUPS-MESSAGING]: Not sending to {0} as they do not fulfill send condition", |
329 | member.AgentID); | 320 | member.AgentID); |
330 | 321 | ||
331 | continue; | 322 | continue; |
@@ -334,7 +325,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
334 | else if (m_groupData.hasAgentDroppedGroupChatSession(member.AgentID, groupID)) | 325 | else if (m_groupData.hasAgentDroppedGroupChatSession(member.AgentID, groupID)) |
335 | { | 326 | { |
336 | // Don't deliver messages to people who have dropped this session | 327 | // Don't deliver messages to people who have dropped this session |
337 | if (m_debugEnabled) | 328 | if (m_debugEnabled) |
338 | m_log.DebugFormat( | 329 | m_log.DebugFormat( |
339 | "[GROUPS-MESSAGING]: {0} has dropped session, not delivering to them", member.AgentID); | 330 | "[GROUPS-MESSAGING]: {0} has dropped session, not delivering to them", member.AgentID); |
340 | 331 | ||
@@ -369,9 +360,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
369 | // If they're not local, forward across the grid | 360 | // If they're not local, forward across the grid |
370 | m_msgTransferModule.SendInstantMessage(msg, delegate(bool success) { }); | 361 | m_msgTransferModule.SendInstantMessage(msg, delegate(bool success) { }); |
371 | 362 | ||
372 | if (m_debugEnabled) | 363 | if (m_debugEnabled) |
373 | m_log.DebugFormat( | 364 | m_log.DebugFormat( |
374 | "[GROUPS-MESSAGING]: Delivering to {0} via grid took {1} ms", | 365 | "[GROUPS-MESSAGING]: Delivering to {0} via grid took {1} ms", |
375 | member.AgentID, Environment.TickCount - startTick); | 366 | member.AgentID, Environment.TickCount - startTick); |
376 | } | 367 | } |
377 | else | 368 | else |
@@ -381,21 +372,22 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
381 | ProcessMessageFromGroupSession(msg, client); | 372 | ProcessMessageFromGroupSession(msg, client); |
382 | 373 | ||
383 | // Deliver locally, directly | 374 | // Deliver locally, directly |
384 | if (m_debugEnabled) | 375 | if (m_debugEnabled) |
385 | m_log.DebugFormat( | 376 | m_log.DebugFormat( |
386 | "[GROUPS-MESSAGING]: Delivering to {0} locally took {1} ms", | 377 | "[GROUPS-MESSAGING]: Delivering to {0} locally took {1} ms", |
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 | ||
394 | m_msgTransferModule.HandleUndeliverableMessage(msg, delegate(bool success) { }); | 386 | m_msgTransferModule.HandleUndeliverableMessage(msg, delegate(bool success) { }); |
395 | 387 | ||
396 | if (m_debugEnabled) | 388 | if (m_debugEnabled) |
397 | m_log.DebugFormat( | 389 | m_log.DebugFormat( |
398 | "[GROUPS-MESSAGING]: Handling undeliverable message for {0} took {1} ms", | 390 | "[GROUPS-MESSAGING]: Handling undeliverable message for {0} took {1} ms", |
399 | member.AgentID, Environment.TickCount - startTick); | 391 | member.AgentID, Environment.TickCount - startTick); |
400 | } | 392 | } |
401 | } | 393 | } |
@@ -405,7 +397,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
405 | "[GROUPS-MESSAGING]: Total SendMessageToGroup for group {0} with {1} members, {2} candidates for delivery took {3} ms", | 397 | "[GROUPS-MESSAGING]: Total SendMessageToGroup for group {0} with {1} members, {2} candidates for delivery took {3} ms", |
406 | groupID, groupMembersCount, attemptDeliveryUuidSet.Count(), Environment.TickCount - requestStartTick); | 398 | groupID, groupMembersCount, attemptDeliveryUuidSet.Count(), Environment.TickCount - requestStartTick); |
407 | } | 399 | } |
408 | 400 | ||
409 | #region SimGridEventHandlers | 401 | #region SimGridEventHandlers |
410 | 402 | ||
411 | void OnClientLogin(IClientAPI client) | 403 | void OnClientLogin(IClientAPI client) |
@@ -425,7 +417,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
425 | // The instant message module will only deliver messages of dialog types: | 417 | // The instant message module will only deliver messages of dialog types: |
426 | // MessageFromAgent, StartTyping, StopTyping, MessageFromObject | 418 | // MessageFromAgent, StartTyping, StopTyping, MessageFromObject |
427 | // | 419 | // |
428 | // Any other message type will not be delivered to a client by the | 420 | // Any other message type will not be delivered to a client by the |
429 | // Instant Message Module | 421 | // Instant Message Module |
430 | 422 | ||
431 | if (m_debugEnabled) | 423 | if (m_debugEnabled) |
@@ -436,28 +428,20 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
436 | } | 428 | } |
437 | 429 | ||
438 | // Incoming message from a group | 430 | // Incoming message from a group |
439 | if ((msg.fromGroup == true) && | 431 | if ((msg.fromGroup == true) && |
440 | ((msg.dialog == (byte)InstantMessageDialog.SessionSend) | 432 | ((msg.dialog == (byte)InstantMessageDialog.SessionSend) |
441 | || (msg.dialog == (byte)InstantMessageDialog.SessionAdd) | 433 | || (msg.dialog == (byte)InstantMessageDialog.SessionAdd) |
442 | || (msg.dialog == (byte)InstantMessageDialog.SessionDrop))) | 434 | || (msg.dialog == (byte)InstantMessageDialog.SessionDrop))) |
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); |
@@ -466,83 +450,101 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
466 | 450 | ||
467 | private void ProcessMessageFromGroupSession(GridInstantMessage msg, IClientAPI client) | 451 | private void ProcessMessageFromGroupSession(GridInstantMessage msg, IClientAPI client) |
468 | { | 452 | { |
469 | if (m_debugEnabled) | 453 | if (m_debugEnabled) |
470 | m_log.DebugFormat( | 454 | m_log.DebugFormat( |
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 | ); | 526 | { |
527 | client.SendInstantMessage(msg); | ||
530 | } | 528 | } |
531 | 529 | ||
532 | break; | 530 | // if (!m_groupData.hasAgentBeenInvitedToGroupChatSession(fromAgentID, GroupID)) |
533 | } | 531 | { |
534 | else if (!m_groupData.hasAgentDroppedGroupChatSession(AgentID, GroupID)) | 532 | m_groupData.AgentInvitedToGroupChatSession(fromAgentID, GroupID); |
535 | { | 533 | eq.ChatterBoxSessionAgentListUpdates( |
536 | // User hasn't dropped, so they're in the session, | 534 | GroupID |
537 | // maybe we should deliver it. | 535 | , fromAgentID |
538 | client.SendInstantMessage(msg); | 536 | , client.AgentId |
537 | , false //canVoiceChat | ||
538 | , false //isModerator | ||
539 | , false //text mute | ||
540 | , true // enter | ||
541 | ); | ||
542 | } | ||
539 | } | 543 | } |
540 | |||
541 | break; | 544 | break; |
542 | 545 | ||
543 | default: | 546 | default: |
544 | client.SendInstantMessage(msg); | 547 | client.SendInstantMessage(msg); |
545 | |||
546 | break;; | 548 | break;; |
547 | } | 549 | } |
548 | } | 550 | } |
@@ -559,41 +561,32 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
559 | DebugGridInstantMessage(im); | 561 | DebugGridInstantMessage(im); |
560 | } | 562 | } |
561 | 563 | ||
564 | UUID GroupID = new UUID(im.imSessionID); | ||
565 | UUID AgentID = new UUID(im.fromAgentID); | ||
566 | |||
562 | // Start group IM session | 567 | // Start group IM session |
563 | if ((im.dialog == (byte)InstantMessageDialog.SessionGroupStart)) | 568 | if ((im.dialog == (byte)InstantMessageDialog.SessionGroupStart)) |
564 | { | 569 | { |
565 | 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); |
566 | 571 | ||
567 | UUID GroupID = new UUID(im.imSessionID); | ||
568 | UUID AgentID = new UUID(im.fromAgentID); | ||
569 | |||
570 | GroupRecord groupInfo = m_groupData.GetGroupRecord(UUID.Zero, GroupID, null); | 572 | GroupRecord groupInfo = m_groupData.GetGroupRecord(UUID.Zero, GroupID, null); |
571 | 573 | ||
572 | if (groupInfo != null) | 574 | if (groupInfo != null) |
573 | { | 575 | { |
574 | m_groupData.AgentInvitedToGroupChatSession(AgentID, GroupID); | 576 | m_groupData.AgentInvitedToGroupChatSession(AgentID, GroupID); |
575 | 577 | ||
576 | ChatterBoxSessionStartReplyViaCaps(remoteClient, groupInfo.GroupName, GroupID); | 578 | ChatterBoxSessionStartReplyViaCaps(remoteClient, groupInfo.GroupName, GroupID); |
577 | 579 | ||
578 | IEventQueue queue = remoteClient.Scene.RequestModuleInterface<IEventQueue>(); | 580 | // we need to send here a list of known participants. |
579 | queue.ChatterBoxSessionAgentListUpdates( | 581 | im.dialog = (byte)InstantMessageDialog.SessionAdd; |
580 | GroupID | 582 | SendMessageToGroup(im, GroupID); |
581 | , AgentID | ||
582 | , new UUID(im.toAgentID) | ||
583 | , false //canVoiceChat | ||
584 | , false //isModerator | ||
585 | , false //text mute | ||
586 | ); | ||
587 | } | 583 | } |
588 | } | 584 | } |
589 | 585 | ||
590 | // Send a message from locally connected client to a group | 586 | // Send a message from locally connected client to a group |
591 | if ((im.dialog == (byte)InstantMessageDialog.SessionSend)) | 587 | if ((im.dialog == (byte)InstantMessageDialog.SessionSend)) |
592 | { | 588 | { |
593 | UUID GroupID = new UUID(im.imSessionID); | 589 | if (m_debugEnabled) |
594 | UUID AgentID = new UUID(im.fromAgentID); | ||
595 | |||
596 | if (m_debugEnabled) | ||
597 | 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()); |
598 | 591 | ||
599 | //If this agent is sending a message, then they want to be in the session | 592 | //If this agent is sending a message, then they want to be in the session |
@@ -601,6 +594,16 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
601 | 594 | ||
602 | SendMessageToGroup(im, GroupID); | 595 | SendMessageToGroup(im, GroupID); |
603 | } | 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 | } | ||
604 | } | 607 | } |
605 | 608 | ||
606 | #endregion | 609 | #endregion |
@@ -656,7 +659,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
656 | /// </summary> | 659 | /// </summary> |
657 | private IClientAPI GetActiveClient(UUID agentID) | 660 | private IClientAPI GetActiveClient(UUID agentID) |
658 | { | 661 | { |
659 | if (m_debugEnabled) | 662 | if (m_debugEnabled) |
660 | m_log.DebugFormat("[GROUPS-MESSAGING]: Looking for local client {0}", agentID); | 663 | m_log.DebugFormat("[GROUPS-MESSAGING]: Looking for local client {0}", agentID); |
661 | 664 | ||
662 | IClientAPI child = null; | 665 | IClientAPI child = null; |
@@ -669,14 +672,14 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
669 | { | 672 | { |
670 | if (!sp.IsChildAgent) | 673 | if (!sp.IsChildAgent) |
671 | { | 674 | { |
672 | if (m_debugEnabled) | 675 | if (m_debugEnabled) |
673 | m_log.DebugFormat("[GROUPS-MESSAGING]: Found root agent for client : {0}", sp.ControllingClient.Name); | 676 | m_log.DebugFormat("[GROUPS-MESSAGING]: Found root agent for client : {0}", sp.ControllingClient.Name); |
674 | 677 | ||
675 | return sp.ControllingClient; | 678 | return sp.ControllingClient; |
676 | } | 679 | } |
677 | else | 680 | else |
678 | { | 681 | { |
679 | if (m_debugEnabled) | 682 | if (m_debugEnabled) |
680 | m_log.DebugFormat("[GROUPS-MESSAGING]: Found child agent for client : {0}", sp.ControllingClient.Name); | 683 | m_log.DebugFormat("[GROUPS-MESSAGING]: Found child agent for client : {0}", sp.ControllingClient.Name); |
681 | 684 | ||
682 | child = sp.ControllingClient; | 685 | child = sp.ControllingClient; |
@@ -687,12 +690,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
687 | // If we didn't find a root, then just return whichever child we found, or null if none | 690 | // If we didn't find a root, then just return whichever child we found, or null if none |
688 | if (child == null) | 691 | if (child == null) |
689 | { | 692 | { |
690 | if (m_debugEnabled) | 693 | if (m_debugEnabled) |
691 | m_log.DebugFormat("[GROUPS-MESSAGING]: Could not find local client for agent : {0}", agentID); | 694 | m_log.DebugFormat("[GROUPS-MESSAGING]: Could not find local client for agent : {0}", agentID); |
692 | } | 695 | } |
693 | else | 696 | else |
694 | { | 697 | { |
695 | if (m_debugEnabled) | 698 | if (m_debugEnabled) |
696 | m_log.DebugFormat("[GROUPS-MESSAGING]: Returning child agent for client : {0}", child.Name); | 699 | m_log.DebugFormat("[GROUPS-MESSAGING]: Returning child agent for client : {0}", child.Name); |
697 | } | 700 | } |
698 | 701 | ||