diff options
Diffstat (limited to 'OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups')
6 files changed, 515 insertions, 457 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 | ||
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs index 1565da9..20b7c5e 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs | |||
@@ -50,19 +50,19 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
50 | /// ; To use this module, you must specify the following in your OpenSim.ini | 50 | /// ; To use this module, you must specify the following in your OpenSim.ini |
51 | /// [GROUPS] | 51 | /// [GROUPS] |
52 | /// Enabled = true | 52 | /// Enabled = true |
53 | /// | 53 | /// |
54 | /// Module = GroupsModule | 54 | /// Module = GroupsModule |
55 | /// NoticesEnabled = true | 55 | /// NoticesEnabled = true |
56 | /// DebugEnabled = true | 56 | /// DebugEnabled = true |
57 | /// | 57 | /// |
58 | /// GroupsServicesConnectorModule = XmlRpcGroupsServicesConnector | 58 | /// GroupsServicesConnectorModule = XmlRpcGroupsServicesConnector |
59 | /// XmlRpcServiceURL = http://osflotsam.org/xmlrpc.php | 59 | /// XmlRpcServiceURL = http://osflotsam.org/xmlrpc.php |
60 | /// XmlRpcServiceReadKey = 1234 | 60 | /// XmlRpcServiceReadKey = 1234 |
61 | /// XmlRpcServiceWriteKey = 1234 | 61 | /// XmlRpcServiceWriteKey = 1234 |
62 | /// | 62 | /// |
63 | /// MessagingModule = GroupsMessagingModule | 63 | /// MessagingModule = GroupsMessagingModule |
64 | /// MessagingEnabled = true | 64 | /// MessagingEnabled = true |
65 | /// | 65 | /// |
66 | /// ; Disables HTTP Keep-Alive for Groups Module HTTP Requests, work around for | 66 | /// ; Disables HTTP Keep-Alive for Groups Module HTTP Requests, work around for |
67 | /// ; a problem discovered on some Windows based region servers. Only disable | 67 | /// ; a problem discovered on some Windows based region servers. Only disable |
68 | /// ; if you see a large number (dozens) of the following Exceptions: | 68 | /// ; if you see a large number (dozens) of the following Exceptions: |
@@ -79,7 +79,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
79 | private IMessageTransferModule m_msgTransferModule; | 79 | private IMessageTransferModule m_msgTransferModule; |
80 | 80 | ||
81 | private IGroupsMessagingModule m_groupsMessagingModule; | 81 | private IGroupsMessagingModule m_groupsMessagingModule; |
82 | 82 | ||
83 | private IGroupsServicesConnector m_groupData; | 83 | private IGroupsServicesConnector m_groupData; |
84 | 84 | ||
85 | // Configuration settings | 85 | // Configuration settings |
@@ -205,10 +205,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
205 | } | 205 | } |
206 | 206 | ||
207 | scene.EventManager.OnNewClient += OnNewClient; | 207 | scene.EventManager.OnNewClient += OnNewClient; |
208 | scene.EventManager.OnMakeRootAgent += OnMakeRoot; | ||
209 | scene.EventManager.OnMakeChildAgent += OnMakeChild; | ||
208 | scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage; | 210 | scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage; |
209 | // The InstantMessageModule itself doesn't do this, | 211 | scene.EventManager.OnClientClosed += OnClientClosed; |
210 | // so lets see if things explode if we don't do it | ||
211 | // scene.EventManager.OnClientClosed += OnClientClosed; | ||
212 | 212 | ||
213 | } | 213 | } |
214 | 214 | ||
@@ -217,6 +217,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
217 | if (!m_groupsEnabled) | 217 | if (!m_groupsEnabled) |
218 | return; | 218 | return; |
219 | 219 | ||
220 | if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | ||
221 | |||
222 | scene.EventManager.OnNewClient -= OnNewClient; | ||
223 | scene.EventManager.OnMakeRootAgent -= OnMakeRoot; | ||
224 | scene.EventManager.OnMakeChildAgent -= OnMakeChild; | ||
225 | scene.EventManager.OnIncomingInstantMessage -= OnGridInstantMessage; | ||
226 | scene.EventManager.OnClientClosed -= OnClientClosed; | ||
220 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 227 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); |
221 | 228 | ||
222 | lock (m_sceneList) | 229 | lock (m_sceneList) |
@@ -233,7 +240,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
233 | if (m_debugEnabled) m_log.Debug("[GROUPS]: Shutting down Groups module."); | 240 | if (m_debugEnabled) m_log.Debug("[GROUPS]: Shutting down Groups module."); |
234 | } | 241 | } |
235 | 242 | ||
236 | public Type ReplaceableInterface | 243 | public Type ReplaceableInterface |
237 | { | 244 | { |
238 | get { return null; } | 245 | get { return null; } |
239 | } | 246 | } |
@@ -255,84 +262,124 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
255 | #endregion | 262 | #endregion |
256 | 263 | ||
257 | #region EventHandlers | 264 | #region EventHandlers |
265 | |||
266 | private void OnMakeRoot(ScenePresence sp) | ||
267 | { | ||
268 | if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | ||
269 | |||
270 | sp.ControllingClient.OnUUIDGroupNameRequest += HandleUUIDGroupNameRequest; | ||
271 | // Used for Notices and Group Invites/Accept/Reject | ||
272 | sp.ControllingClient.OnInstantMessage += OnInstantMessage; | ||
273 | |||
274 | // comented out because some viewers no longer suport it | ||
275 | // sp.ControllingClient.AddGenericPacketHandler("avatargroupsrequest", AvatarGroupsRequest); | ||
276 | |||
277 | // Send out group data update for compatibility. | ||
278 | // There might be some problem with the thread we're generating this on but not | ||
279 | // doing the update at this time causes problems (Mantis #7920 and #7915) | ||
280 | // TODO: move sending this update to a later time in the rootification of the client. | ||
281 | if(!sp.haveGroupInformation) | ||
282 | SendAgentGroupDataUpdate(sp.ControllingClient, false); | ||
283 | } | ||
284 | |||
285 | private void OnMakeChild(ScenePresence sp) | ||
286 | { | ||
287 | if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | ||
288 | |||
289 | sp.ControllingClient.OnUUIDGroupNameRequest -= HandleUUIDGroupNameRequest; | ||
290 | sp.ControllingClient.OnInstantMessage -= OnInstantMessage; | ||
291 | } | ||
292 | |||
258 | private void OnNewClient(IClientAPI client) | 293 | private void OnNewClient(IClientAPI client) |
259 | { | 294 | { |
260 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 295 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); |
261 | 296 | ||
262 | client.OnUUIDGroupNameRequest += HandleUUIDGroupNameRequest; | ||
263 | client.OnAgentDataUpdateRequest += OnAgentDataUpdateRequest; | 297 | client.OnAgentDataUpdateRequest += OnAgentDataUpdateRequest; |
264 | client.OnRequestAvatarProperties += OnRequestAvatarProperties; | 298 | client.OnRequestAvatarProperties += OnRequestAvatarProperties; |
265 | 299 | ||
266 | // Used for Notices and Group Invites/Accept/Reject | ||
267 | client.OnInstantMessage += OnInstantMessage; | ||
268 | 300 | ||
269 | // Send client their groups information. | ||
270 | SendAgentGroupDataUpdate(client, client.AgentId); | ||
271 | } | 301 | } |
272 | 302 | ||
303 | /* this should be the right message to ask for other avatars groups | ||
304 | |||
305 | private void AvatarGroupsRequest(Object sender, string method, List<String> args) | ||
306 | { | ||
307 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | ||
308 | |||
309 | if (!(sender is IClientAPI)) | ||
310 | return; | ||
311 | |||
312 | IClientAPI remoteClient = (IClientAPI)sender; | ||
313 | |||
314 | UUID avatarID; | ||
315 | UUID.TryParse(args[0], out avatarID); | ||
316 | |||
317 | if (avatarID != UUID.Zero) | ||
318 | { | ||
319 | GroupMembershipData[] avatarGroups = GetProfileListedGroupMemberships(remoteClient, avatarID); | ||
320 | remoteClient.SendAvatarGroupsReply(avatarID, avatarGroups); | ||
321 | } | ||
322 | } | ||
323 | */ | ||
324 | |||
325 | // this should not be used to send groups memberships, but some viewers do expect it | ||
326 | // it does send unnecessary memberships, when viewers just want other properties information | ||
273 | private void OnRequestAvatarProperties(IClientAPI remoteClient, UUID avatarID) | 327 | private void OnRequestAvatarProperties(IClientAPI remoteClient, UUID avatarID) |
274 | { | 328 | { |
275 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 329 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); |
276 | 330 | ||
277 | //GroupMembershipData[] avatarGroups = m_groupData.GetAgentGroupMemberships(GetRequestingAgentID(remoteClient), avatarID).ToArray(); | ||
278 | GroupMembershipData[] avatarGroups = GetProfileListedGroupMemberships(remoteClient, avatarID); | 331 | GroupMembershipData[] avatarGroups = GetProfileListedGroupMemberships(remoteClient, avatarID); |
279 | remoteClient.SendAvatarGroupsReply(avatarID, avatarGroups); | 332 | remoteClient.SendAvatarGroupsReply(avatarID, avatarGroups); |
280 | } | 333 | } |
281 | 334 | ||
282 | /* | 335 | |
283 | * This becomes very problematic in a shared module. In a shared module you may have more then one | 336 | private void OnClientClosed(UUID AgentId, Scene scene) |
284 | * reference to IClientAPI's, one for 0 or 1 root connections, and 0 or more child connections. | ||
285 | * The OnClientClosed event does not provide anything to indicate which one of those should be closed | ||
286 | * nor does it provide what scene it was from so that the specific reference can be looked up. | ||
287 | * The InstantMessageModule.cs does not currently worry about unregistering the handles, | ||
288 | * and it should be an issue, since it's the client that references us not the other way around | ||
289 | * , so as long as we don't keep a reference to the client laying around, the client can still be GC'ed | ||
290 | private void OnClientClosed(UUID AgentId) | ||
291 | { | 337 | { |
292 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 338 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); |
339 | if (scene == null) | ||
340 | return; | ||
293 | 341 | ||
294 | lock (m_ActiveClients) | 342 | ScenePresence sp = scene.GetScenePresence(AgentId); |
343 | IClientAPI client = sp.ControllingClient; | ||
344 | if (client != null) | ||
295 | { | 345 | { |
296 | if (m_ActiveClients.ContainsKey(AgentId)) | 346 | client.OnAgentDataUpdateRequest -= OnAgentDataUpdateRequest; |
347 | client.OnRequestAvatarProperties -= OnRequestAvatarProperties; | ||
348 | // make child possible not called? | ||
349 | client.OnUUIDGroupNameRequest -= HandleUUIDGroupNameRequest; | ||
350 | client.OnInstantMessage -= OnInstantMessage; | ||
351 | } | ||
352 | |||
353 | /* | ||
354 | lock (m_ActiveClients) | ||
297 | { | 355 | { |
298 | IClientAPI client = m_ActiveClients[AgentId]; | 356 | if (m_ActiveClients.ContainsKey(AgentId)) |
299 | client.OnUUIDGroupNameRequest -= HandleUUIDGroupNameRequest; | 357 | { |
300 | client.OnAgentDataUpdateRequest -= OnAgentDataUpdateRequest; | 358 | IClientAPI client = m_ActiveClients[AgentId]; |
301 | client.OnDirFindQuery -= OnDirFindQuery; | 359 | client.OnUUIDGroupNameRequest -= HandleUUIDGroupNameRequest; |
302 | client.OnInstantMessage -= OnInstantMessage; | 360 | client.OnAgentDataUpdateRequest -= OnAgentDataUpdateRequest; |
361 | client.OnDirFindQuery -= OnDirFindQuery; | ||
362 | client.OnInstantMessage -= OnInstantMessage; | ||
303 | 363 | ||
304 | m_ActiveClients.Remove(AgentId); | 364 | m_ActiveClients.Remove(AgentId); |
305 | } | 365 | } |
306 | else | 366 | else |
307 | { | 367 | { |
308 | if (m_debugEnabled) m_log.WarnFormat("[GROUPS]: Client closed that wasn't registered here."); | 368 | if (m_debugEnabled) m_log.WarnFormat("[GROUPS]: Client closed that wasn't registered here."); |
369 | } | ||
309 | } | 370 | } |
310 | 371 | */ | |
311 | |||
312 | } | ||
313 | } | 372 | } |
314 | */ | ||
315 | 373 | ||
316 | private void OnAgentDataUpdateRequest(IClientAPI remoteClient, UUID dataForAgentID, UUID sessionID) | 374 | private void OnAgentDataUpdateRequest(IClientAPI remoteClient, UUID dataForAgentID, UUID sessionID) |
317 | { | 375 | { |
318 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 376 | // this a private message for own agent only |
319 | 377 | if (dataForAgentID != GetRequestingAgentID(remoteClient)) | |
320 | UUID activeGroupID = UUID.Zero; | 378 | return; |
321 | string activeGroupTitle = string.Empty; | ||
322 | string activeGroupName = string.Empty; | ||
323 | ulong activeGroupPowers = (ulong)GroupPowers.None; | ||
324 | |||
325 | GroupMembershipData membership = m_groupData.GetAgentActiveMembership(GetRequestingAgentID(remoteClient), dataForAgentID); | ||
326 | if (membership != null) | ||
327 | { | ||
328 | activeGroupID = membership.GroupID; | ||
329 | activeGroupTitle = membership.GroupTitle; | ||
330 | activeGroupPowers = membership.GroupPowers; | ||
331 | } | ||
332 | |||
333 | SendAgentDataUpdate(remoteClient, dataForAgentID, activeGroupID, activeGroupName, activeGroupPowers, activeGroupTitle); | ||
334 | 379 | ||
335 | SendScenePresenceUpdate(dataForAgentID, activeGroupTitle); | 380 | SendAgentGroupDataUpdate(remoteClient, false); |
381 | // its a info request not a change, so nothing is sent to others | ||
382 | // they do get the group title with the avatar object update on arrivel to a region | ||
336 | } | 383 | } |
337 | 384 | ||
338 | private void HandleUUIDGroupNameRequest(UUID GroupID, IClientAPI remoteClient) | 385 | private void HandleUUIDGroupNameRequest(UUID GroupID, IClientAPI remoteClient) |
@@ -340,7 +387,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
340 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 387 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); |
341 | 388 | ||
342 | string GroupName; | 389 | string GroupName; |
343 | 390 | ||
344 | GroupRecord group = m_groupData.GetGroupRecord(GetRequestingAgentID(remoteClient), GroupID, null); | 391 | GroupRecord group = m_groupData.GetGroupRecord(GetRequestingAgentID(remoteClient), GroupID, null); |
345 | if (group != null) | 392 | if (group != null) |
346 | { | 393 | { |
@@ -356,9 +403,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
356 | 403 | ||
357 | private void OnInstantMessage(IClientAPI remoteClient, GridInstantMessage im) | 404 | private void OnInstantMessage(IClientAPI remoteClient, GridInstantMessage im) |
358 | { | 405 | { |
359 | if (m_debugEnabled) | 406 | if (m_debugEnabled) |
360 | m_log.DebugFormat( | 407 | m_log.DebugFormat( |
361 | "[GROUPS]: {0} called for {1}, message type {2}", | 408 | "[GROUPS]: {0} called for {1}, message type {2}", |
362 | System.Reflection.MethodBase.GetCurrentMethod().Name, remoteClient.Name, (InstantMessageDialog)im.dialog); | 409 | System.Reflection.MethodBase.GetCurrentMethod().Name, remoteClient.Name, (InstantMessageDialog)im.dialog); |
363 | 410 | ||
364 | // Group invitations | 411 | // Group invitations |
@@ -403,11 +450,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
403 | 450 | ||
404 | OutgoingInstantMessage(msg, inviteInfo.AgentID); | 451 | OutgoingInstantMessage(msg, inviteInfo.AgentID); |
405 | 452 | ||
406 | UpdateAllClientsWithGroupInfo(inviteInfo.AgentID); | 453 | IClientAPI inviteeClient = GetActiveRootClient(inviteInfo.AgentID); |
407 | 454 | if(inviteeClient !=null) | |
408 | // TODO: If the inviter is still online, they need an agent dataupdate | 455 | { |
409 | // and maybe group membership updates for the invitee | 456 | SendAgentGroupDataUpdate(inviteeClient,true); |
410 | 457 | } | |
411 | m_groupData.RemoveAgentToGroupInvite(GetRequestingAgentID(remoteClient), inviteID); | 458 | m_groupData.RemoveAgentToGroupInvite(GetRequestingAgentID(remoteClient), inviteID); |
412 | } | 459 | } |
413 | 460 | ||
@@ -459,8 +506,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
459 | //variable will be set to null and attachment will | 506 | //variable will be set to null and attachment will |
460 | //not be included with the group notice. | 507 | //not be included with the group notice. |
461 | Scene scene = (Scene)remoteClient.Scene; | 508 | Scene scene = (Scene)remoteClient.Scene; |
462 | item = new InventoryItemBase(itemID, ownerID); | 509 | item = scene.InventoryService.GetItem(ownerID, itemID); |
463 | item = scene.InventoryService.GetItem(item); | ||
464 | 510 | ||
465 | if (item != null) | 511 | if (item != null) |
466 | { | 512 | { |
@@ -523,20 +569,20 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
523 | if (targetUser != null) | 569 | if (targetUser != null) |
524 | { | 570 | { |
525 | m_log.DebugFormat( | 571 | m_log.DebugFormat( |
526 | "[GROUPS]: Prepping group notice {0} for agent: {1} who Accepts Notices ({2})", | 572 | "[GROUPS]: Prepping group notice {0} for agent: {1} who Accepts Notices ({2})", |
527 | NoticeID, targetUser.FirstName + " " + targetUser.LastName, member.AcceptNotices); | 573 | NoticeID, targetUser.FirstName + " " + targetUser.LastName, member.AcceptNotices); |
528 | } | 574 | } |
529 | else | 575 | else |
530 | { | 576 | { |
531 | m_log.DebugFormat( | 577 | m_log.DebugFormat( |
532 | "[GROUPS]: Prepping group notice {0} for agent: {1} who Accepts Notices ({2})", | 578 | "[GROUPS]: Prepping group notice {0} for agent: {1} who Accepts Notices ({2})", |
533 | NoticeID, member.AgentID, member.AcceptNotices); | 579 | NoticeID, member.AgentID, member.AcceptNotices); |
534 | } | 580 | } |
535 | } | 581 | } |
536 | } | 582 | } |
537 | } | 583 | } |
538 | 584 | ||
539 | GridInstantMessage msg | 585 | GridInstantMessage msg |
540 | = CreateGroupNoticeIM(UUID.Zero, NoticeID, (byte)OpenMetaverse.InstantMessageDialog.GroupNotice); | 586 | = CreateGroupNoticeIM(UUID.Zero, NoticeID, (byte)OpenMetaverse.InstantMessageDialog.GroupNotice); |
541 | 587 | ||
542 | if (m_groupsMessagingModule != null) | 588 | if (m_groupsMessagingModule != null) |
@@ -553,7 +599,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
553 | 599 | ||
554 | UUID noticeID = new UUID(im.imSessionID); | 600 | UUID noticeID = new UUID(im.imSessionID); |
555 | 601 | ||
556 | if (m_debugEnabled) | 602 | if (m_debugEnabled) |
557 | m_log.DebugFormat("[GROUPS]: Requesting notice {0} for {1}", noticeID, remoteClient.AgentId); | 603 | m_log.DebugFormat("[GROUPS]: Requesting notice {0} for {1}", noticeID, remoteClient.AgentId); |
558 | 604 | ||
559 | GroupNoticeInfo notice = m_groupData.GetGroupNotice(GetRequestingAgentID(remoteClient), noticeID); | 605 | GroupNoticeInfo notice = m_groupData.GetGroupNotice(GetRequestingAgentID(remoteClient), noticeID); |
@@ -579,10 +625,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
579 | } | 625 | } |
580 | else | 626 | else |
581 | { | 627 | { |
582 | if (m_debugEnabled) | 628 | if (m_debugEnabled) |
583 | m_log.DebugFormat( | 629 | m_log.DebugFormat( |
584 | "[GROUPS]: Could not find notice {0} for {1} on GroupNoticeInventoryAccepted.", | 630 | "[GROUPS]: Could not find notice {0} for {1} on GroupNoticeInventoryAccepted.", |
585 | noticeID, remoteClient.AgentId); | 631 | noticeID, remoteClient.AgentId); |
586 | } | 632 | } |
587 | } | 633 | } |
588 | 634 | ||
@@ -598,15 +644,16 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
598 | // so we need to send local updates to the agent. | 644 | // so we need to send local updates to the agent. |
599 | 645 | ||
600 | UUID ejecteeID = new UUID(im.toAgentID); | 646 | UUID ejecteeID = new UUID(im.toAgentID); |
601 | 647 | im.imSessionID = UUID.Zero.Guid; | |
602 | im.dialog = (byte)InstantMessageDialog.MessageFromAgent; | 648 | im.dialog = (byte)InstantMessageDialog.MessageFromAgent; |
603 | OutgoingInstantMessage(im, ejecteeID); | 649 | OutgoingInstantMessage(im, ejecteeID); |
604 | 650 | ||
605 | IClientAPI ejectee = GetActiveClient(ejecteeID); | 651 | IClientAPI ejectee = GetActiveRootClient(ejecteeID); |
606 | if (ejectee != null) | 652 | if (ejectee != null) |
607 | { | 653 | { |
608 | UUID groupID = new UUID(im.imSessionID); | 654 | UUID groupID = new UUID(im.imSessionID); |
609 | ejectee.SendAgentDropGroup(groupID); | 655 | ejectee.SendAgentDropGroup(groupID); |
656 | SendAgentGroupDataUpdate(ejectee,true); | ||
610 | } | 657 | } |
611 | } | 658 | } |
612 | } | 659 | } |
@@ -626,7 +673,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
626 | case (byte)InstantMessageDialog.GroupInvitation: | 673 | case (byte)InstantMessageDialog.GroupInvitation: |
627 | case (byte)InstantMessageDialog.GroupNotice: | 674 | case (byte)InstantMessageDialog.GroupNotice: |
628 | UUID toAgentID = new UUID(msg.toAgentID); | 675 | UUID toAgentID = new UUID(msg.toAgentID); |
629 | IClientAPI localClient = GetActiveClient(toAgentID); | 676 | IClientAPI localClient = GetActiveRootClient(toAgentID); |
630 | if (localClient != null) | 677 | if (localClient != null) |
631 | { | 678 | { |
632 | localClient.SendInstantMessage(msg); | 679 | localClient.SendInstantMessage(msg); |
@@ -651,18 +698,16 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
651 | { | 698 | { |
652 | return m_groupData.GetGroupRecord(UUID.Zero, UUID.Zero, name); | 699 | return m_groupData.GetGroupRecord(UUID.Zero, UUID.Zero, name); |
653 | } | 700 | } |
654 | 701 | ||
655 | public void ActivateGroup(IClientAPI remoteClient, UUID groupID) | 702 | public void ActivateGroup(IClientAPI remoteClient, UUID groupID) |
656 | { | 703 | { |
657 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 704 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); |
658 | 705 | ||
659 | m_groupData.SetAgentActiveGroup(GetRequestingAgentID(remoteClient), GetRequestingAgentID(remoteClient), groupID); | 706 | UUID agentID = GetRequestingAgentID(remoteClient); |
707 | m_groupData.SetAgentActiveGroup(agentID, agentID, groupID); | ||
660 | 708 | ||
661 | // Changing active group changes title, active powers, all kinds of things | 709 | // llClientView does this |
662 | // anyone who is in any region that can see this client, should probably be | 710 | SendAgentGroupDataUpdate(remoteClient, true); |
663 | // updated with new group info. At a minimum, they should get ScenePresence | ||
664 | // updated with new title. | ||
665 | UpdateAllClientsWithGroupInfo(GetRequestingAgentID(remoteClient)); | ||
666 | } | 711 | } |
667 | 712 | ||
668 | /// <summary> | 713 | /// <summary> |
@@ -672,7 +717,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
672 | { | 717 | { |
673 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 718 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); |
674 | 719 | ||
675 | |||
676 | List<GroupRolesData> agentRoles = m_groupData.GetAgentGroupRoles(GetRequestingAgentID(remoteClient), GetRequestingAgentID(remoteClient), groupID); | 720 | List<GroupRolesData> agentRoles = m_groupData.GetAgentGroupRoles(GetRequestingAgentID(remoteClient), GetRequestingAgentID(remoteClient), groupID); |
677 | GroupMembershipData agentMembership = m_groupData.GetAgentGroupMembership(GetRequestingAgentID(remoteClient), GetRequestingAgentID(remoteClient), groupID); | 721 | GroupMembershipData agentMembership = m_groupData.GetAgentGroupMembership(GetRequestingAgentID(remoteClient), GetRequestingAgentID(remoteClient), groupID); |
678 | 722 | ||
@@ -695,10 +739,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
695 | 739 | ||
696 | public List<GroupMembersData> GroupMembersRequest(IClientAPI remoteClient, UUID groupID) | 740 | public List<GroupMembersData> GroupMembersRequest(IClientAPI remoteClient, UUID groupID) |
697 | { | 741 | { |
698 | if (m_debugEnabled) | 742 | if (m_debugEnabled) |
699 | m_log.DebugFormat( | 743 | m_log.DebugFormat( |
700 | "[GROUPS]: GroupMembersRequest called for {0} from client {1}", groupID, remoteClient.Name); | 744 | "[GROUPS]: GroupMembersRequest called for {0} from client {1}", groupID, remoteClient.Name); |
701 | 745 | ||
702 | List<GroupMembersData> data = m_groupData.GetGroupMembers(GetRequestingAgentID(remoteClient), groupID); | 746 | List<GroupMembersData> data = m_groupData.GetGroupMembers(GetRequestingAgentID(remoteClient), groupID); |
703 | 747 | ||
704 | if (m_debugEnabled) | 748 | if (m_debugEnabled) |
@@ -710,7 +754,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
710 | } | 754 | } |
711 | 755 | ||
712 | return data; | 756 | return data; |
713 | |||
714 | } | 757 | } |
715 | 758 | ||
716 | public List<GroupRolesData> GroupRoleDataRequest(IClientAPI remoteClient, UUID groupID) | 759 | public List<GroupRolesData> GroupRoleDataRequest(IClientAPI remoteClient, UUID groupID) |
@@ -744,7 +787,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
744 | 787 | ||
745 | GroupProfileData profile = new GroupProfileData(); | 788 | GroupProfileData profile = new GroupProfileData(); |
746 | 789 | ||
747 | |||
748 | GroupRecord groupInfo = m_groupData.GetGroupRecord(GetRequestingAgentID(remoteClient), groupID, null); | 790 | GroupRecord groupInfo = m_groupData.GetGroupRecord(GetRequestingAgentID(remoteClient), groupID, null); |
749 | if (groupInfo != null) | 791 | if (groupInfo != null) |
750 | { | 792 | { |
@@ -770,7 +812,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
770 | profile.MemberTitle = memberInfo.GroupTitle; | 812 | profile.MemberTitle = memberInfo.GroupTitle; |
771 | profile.PowersMask = memberInfo.GroupPowers; | 813 | profile.PowersMask = memberInfo.GroupPowers; |
772 | } | 814 | } |
773 | 815 | /* | |
816 | this should save xmlrpc calls, but seems to return wrong GroupMembershipCount and GroupRolesCount | ||
817 | UUID agent = GetRequestingAgentID(remoteClient); | ||
818 | GroupProfileData profile = m_groupData.GetMemberGroupProfile(agent, groupID, agent); | ||
819 | */ | ||
774 | return profile; | 820 | return profile; |
775 | } | 821 | } |
776 | 822 | ||
@@ -783,7 +829,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
783 | 829 | ||
784 | public GroupMembershipData GetMembershipData(UUID groupID, UUID agentID) | 830 | public GroupMembershipData GetMembershipData(UUID groupID, UUID agentID) |
785 | { | 831 | { |
786 | if (m_debugEnabled) | 832 | if (m_debugEnabled) |
787 | m_log.DebugFormat( | 833 | m_log.DebugFormat( |
788 | "[GROUPS]: {0} called with groupID={1}, agentID={2}", | 834 | "[GROUPS]: {0} called with groupID={1}, agentID={2}", |
789 | System.Reflection.MethodBase.GetCurrentMethod().Name, groupID, agentID); | 835 | System.Reflection.MethodBase.GetCurrentMethod().Name, groupID, agentID); |
@@ -791,6 +837,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
791 | return m_groupData.GetAgentGroupMembership(UUID.Zero, agentID, groupID); | 837 | return m_groupData.GetAgentGroupMembership(UUID.Zero, agentID, groupID); |
792 | } | 838 | } |
793 | 839 | ||
840 | public GroupMembershipData GetActiveMembershipData(UUID agentID) | ||
841 | { | ||
842 | return m_groupData.GetAgentActiveMembership(agentID, agentID); | ||
843 | } | ||
844 | |||
794 | public void UpdateGroupInfo(IClientAPI remoteClient, UUID groupID, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, bool allowPublish, bool maturePublish) | 845 | public void UpdateGroupInfo(IClientAPI remoteClient, UUID groupID, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, bool allowPublish, bool maturePublish) |
795 | { | 846 | { |
796 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 847 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); |
@@ -811,7 +862,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
811 | { | 862 | { |
812 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 863 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); |
813 | 864 | ||
814 | if (m_groupData.GetGroupRecord(GetRequestingAgentID(remoteClient), UUID.Zero, name) != null) | 865 | GroupRecord groupRecord = m_groupData.GetGroupRecord(GetRequestingAgentID(remoteClient), UUID.Zero, name); |
866 | |||
867 | if (groupRecord != null) | ||
815 | { | 868 | { |
816 | remoteClient.SendCreateGroupReply(UUID.Zero, false, "A group with the same name already exists."); | 869 | remoteClient.SendCreateGroupReply(UUID.Zero, false, "A group with the same name already exists."); |
817 | return UUID.Zero; | 870 | return UUID.Zero; |
@@ -824,31 +877,31 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
824 | 877 | ||
825 | if (avatar != null) | 878 | if (avatar != null) |
826 | { | 879 | { |
827 | if (avatar.UserLevel < m_levelGroupCreate) | 880 | if (avatar.GodController.UserLevel < m_levelGroupCreate) |
828 | { | 881 | { |
829 | remoteClient.SendCreateGroupReply(UUID.Zero, false, "You have got insufficient permissions to create a group."); | 882 | remoteClient.SendCreateGroupReply(UUID.Zero, false, "You have insufficient permissions to create a group."); |
830 | return UUID.Zero; | 883 | return UUID.Zero; |
831 | } | 884 | } |
832 | } | 885 | } |
833 | 886 | ||
834 | // check funds | 887 | // check funds |
835 | // is there is a money module present ? | 888 | // is there a money module present ? |
836 | IMoneyModule money = scene.RequestModuleInterface<IMoneyModule>(); | 889 | IMoneyModule money = scene.RequestModuleInterface<IMoneyModule>(); |
837 | if (money != null) | 890 | if (money != null && money.GroupCreationCharge > 0) |
838 | { | 891 | { |
839 | // do the transaction, that is if the agent has got sufficient funds | 892 | // do the transaction, that is if the agent has sufficient funds |
840 | if (!money.AmountCovered(remoteClient.AgentId, money.GroupCreationCharge)) { | 893 | if (!money.AmountCovered(remoteClient.AgentId, money.GroupCreationCharge)) { |
841 | remoteClient.SendCreateGroupReply(UUID.Zero, false, "You have got insufficient funds to create a group."); | 894 | remoteClient.SendCreateGroupReply(UUID.Zero, false, "You have insufficient funds to create a group."); |
842 | return UUID.Zero; | 895 | return UUID.Zero; |
843 | } | 896 | } |
844 | money.ApplyCharge(GetRequestingAgentID(remoteClient), money.GroupCreationCharge, MoneyTransactionType.GroupCreate); | 897 | money.ApplyCharge(GetRequestingAgentID(remoteClient), money.GroupCreationCharge, MoneyTransactionType.GroupCreate, name); |
845 | } | 898 | } |
846 | UUID groupID = m_groupData.CreateGroup(GetRequestingAgentID(remoteClient), name, charter, showInList, insigniaID, membershipFee, openEnrollment, allowPublish, maturePublish, GetRequestingAgentID(remoteClient)); | 899 | UUID groupID = m_groupData.CreateGroup(GetRequestingAgentID(remoteClient), name, charter, showInList, insigniaID, membershipFee, openEnrollment, allowPublish, maturePublish, GetRequestingAgentID(remoteClient)); |
847 | 900 | ||
848 | remoteClient.SendCreateGroupReply(groupID, true, "Group created successfullly"); | 901 | remoteClient.SendCreateGroupReply(groupID, true, "Group created successfully"); |
849 | 902 | ||
850 | // Update the founder with new group information. | 903 | // Update the founder with new group information. |
851 | SendAgentGroupDataUpdate(remoteClient, GetRequestingAgentID(remoteClient)); | 904 | SendAgentGroupDataUpdate(remoteClient, true); |
852 | 905 | ||
853 | return groupID; | 906 | return groupID; |
854 | } | 907 | } |
@@ -873,7 +926,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
873 | if (membership != null) | 926 | if (membership != null) |
874 | { | 927 | { |
875 | return membership.GroupTitle; | 928 | return membership.GroupTitle; |
876 | } | 929 | } |
877 | return string.Empty; | 930 | return string.Empty; |
878 | } | 931 | } |
879 | 932 | ||
@@ -889,10 +942,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
889 | // TODO: Not sure what all is needed here, but if the active group role change is for the group | 942 | // TODO: Not sure what all is needed here, but if the active group role change is for the group |
890 | // the client currently has set active, then we need to do a scene presence update too | 943 | // the client currently has set active, then we need to do a scene presence update too |
891 | // if (m_groupData.GetAgentActiveMembership(GetRequestingAgentID(remoteClient)).GroupID == GroupID) | 944 | // if (m_groupData.GetAgentActiveMembership(GetRequestingAgentID(remoteClient)).GroupID == GroupID) |
892 | |||
893 | UpdateAllClientsWithGroupInfo(GetRequestingAgentID(remoteClient)); | ||
894 | } | ||
895 | 945 | ||
946 | SendDataUpdate(remoteClient, true); | ||
947 | } | ||
896 | 948 | ||
897 | public void GroupRoleUpdate(IClientAPI remoteClient, UUID groupID, UUID roleID, string name, string description, string title, ulong powers, byte updateType) | 949 | public void GroupRoleUpdate(IClientAPI remoteClient, UUID groupID, UUID roleID, string name, string description, string title, ulong powers, byte updateType) |
898 | { | 950 | { |
@@ -929,7 +981,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
929 | } | 981 | } |
930 | 982 | ||
931 | // TODO: This update really should send out updates for everyone in the role that just got changed. | 983 | // TODO: This update really should send out updates for everyone in the role that just got changed. |
932 | SendAgentGroupDataUpdate(remoteClient, GetRequestingAgentID(remoteClient)); | 984 | SendAgentGroupDataUpdate(remoteClient, false); |
933 | } | 985 | } |
934 | 986 | ||
935 | public void GroupRoleChanges(IClientAPI remoteClient, UUID groupID, UUID roleID, UUID memberID, uint changes) | 987 | public void GroupRoleChanges(IClientAPI remoteClient, UUID groupID, UUID roleID, UUID memberID, uint changes) |
@@ -947,7 +999,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
947 | case 1: | 999 | case 1: |
948 | // Remove | 1000 | // Remove |
949 | m_groupData.RemoveAgentFromGroupRole(GetRequestingAgentID(remoteClient), memberID, groupID, roleID); | 1001 | m_groupData.RemoveAgentFromGroupRole(GetRequestingAgentID(remoteClient), memberID, groupID, roleID); |
950 | 1002 | ||
951 | break; | 1003 | break; |
952 | default: | 1004 | default: |
953 | m_log.ErrorFormat("[GROUPS]: {0} does not understand changes == {1}", System.Reflection.MethodBase.GetCurrentMethod().Name, changes); | 1005 | m_log.ErrorFormat("[GROUPS]: {0} does not understand changes == {1}", System.Reflection.MethodBase.GetCurrentMethod().Name, changes); |
@@ -955,7 +1007,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
955 | } | 1007 | } |
956 | 1008 | ||
957 | // TODO: This update really should send out updates for everyone in the role that just got changed. | 1009 | // TODO: This update really should send out updates for everyone in the role that just got changed. |
958 | SendAgentGroupDataUpdate(remoteClient, GetRequestingAgentID(remoteClient)); | 1010 | SendAgentGroupDataUpdate(remoteClient, false); |
959 | } | 1011 | } |
960 | 1012 | ||
961 | public void GroupNoticeRequest(IClientAPI remoteClient, UUID groupNoticeID) | 1013 | public void GroupNoticeRequest(IClientAPI remoteClient, UUID groupNoticeID) |
@@ -983,7 +1035,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
983 | msg.toAgentID = agentID.Guid; | 1035 | msg.toAgentID = agentID.Guid; |
984 | msg.dialog = dialog; | 1036 | msg.dialog = dialog; |
985 | msg.fromGroup = true; | 1037 | msg.fromGroup = true; |
986 | msg.offline = (byte)0; | 1038 | msg.offline = (byte)1; // Allow this message to be stored for offline use |
987 | msg.ParentEstateID = 0; | 1039 | msg.ParentEstateID = 0; |
988 | msg.Position = Vector3.Zero; | 1040 | msg.Position = Vector3.Zero; |
989 | msg.RegionID = UUID.Zero.Guid; | 1041 | msg.RegionID = UUID.Zero.Guid; |
@@ -1035,14 +1087,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
1035 | return msg; | 1087 | return msg; |
1036 | } | 1088 | } |
1037 | 1089 | ||
1038 | public void SendAgentGroupDataUpdate(IClientAPI remoteClient) | ||
1039 | { | ||
1040 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | ||
1041 | |||
1042 | // Send agent information about his groups | ||
1043 | SendAgentGroupDataUpdate(remoteClient, GetRequestingAgentID(remoteClient)); | ||
1044 | } | ||
1045 | |||
1046 | public void JoinGroupRequest(IClientAPI remoteClient, UUID groupID) | 1090 | public void JoinGroupRequest(IClientAPI remoteClient, UUID groupID) |
1047 | { | 1091 | { |
1048 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 1092 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); |
@@ -1050,10 +1094,30 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
1050 | // Should check to see if OpenEnrollment, or if there's an outstanding invitation | 1094 | // Should check to see if OpenEnrollment, or if there's an outstanding invitation |
1051 | m_groupData.AddAgentToGroup(GetRequestingAgentID(remoteClient), GetRequestingAgentID(remoteClient), groupID, UUID.Zero); | 1095 | m_groupData.AddAgentToGroup(GetRequestingAgentID(remoteClient), GetRequestingAgentID(remoteClient), groupID, UUID.Zero); |
1052 | 1096 | ||
1097 | // check funds | ||
1098 | // is there a money module present ? | ||
1099 | GroupRecord groupRecord = m_groupData.GetGroupRecord(GetRequestingAgentID(remoteClient), groupID, null); | ||
1100 | IMoneyModule money = remoteClient.Scene.RequestModuleInterface<IMoneyModule>(); | ||
1101 | if (money != null && groupRecord.MembershipFee > 0) | ||
1102 | { | ||
1103 | // do the transaction, that is if the agent has sufficient funds | ||
1104 | if (!money.AmountCovered(GetRequestingAgentID(remoteClient), groupRecord.MembershipFee)) { | ||
1105 | remoteClient.SendCreateGroupReply(UUID.Zero, false, "You have insufficient funds to join the group."); | ||
1106 | return; | ||
1107 | } | ||
1108 | money.ApplyCharge(GetRequestingAgentID(remoteClient), groupRecord.MembershipFee, MoneyTransactionType.GroupJoin, groupRecord.GroupName); | ||
1109 | } | ||
1110 | |||
1053 | remoteClient.SendJoinGroupReply(groupID, true); | 1111 | remoteClient.SendJoinGroupReply(groupID, true); |
1054 | 1112 | ||
1055 | // Should this send updates to everyone in the group? | 1113 | SendAgentGroupDataUpdate(remoteClient, true); |
1056 | SendAgentGroupDataUpdate(remoteClient, GetRequestingAgentID(remoteClient)); | 1114 | } |
1115 | |||
1116 | public void JoinGroup(string agentID, UUID groupID) | ||
1117 | { | ||
1118 | // Should check to see if OpenEnrollment, or if there's an outstanding invitation | ||
1119 | UUID u = new UUID(agentID); | ||
1120 | m_groupData.AddAgentToGroup(u, u, groupID, UUID.Zero); | ||
1057 | } | 1121 | } |
1058 | 1122 | ||
1059 | public void LeaveGroupRequest(IClientAPI remoteClient, UUID groupID) | 1123 | public void LeaveGroupRequest(IClientAPI remoteClient, UUID groupID) |
@@ -1068,7 +1132,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
1068 | 1132 | ||
1069 | // SL sends out notifcations to the group messaging session that the person has left | 1133 | // SL sends out notifcations to the group messaging session that the person has left |
1070 | // Should this also update everyone who is in the group? | 1134 | // Should this also update everyone who is in the group? |
1071 | SendAgentGroupDataUpdate(remoteClient, GetRequestingAgentID(remoteClient)); | 1135 | SendAgentGroupDataUpdate(remoteClient, true); |
1072 | } | 1136 | } |
1073 | 1137 | ||
1074 | public void EjectGroupMemberRequest(IClientAPI remoteClient, UUID groupID, UUID ejecteeID) | 1138 | public void EjectGroupMemberRequest(IClientAPI remoteClient, UUID groupID, UUID ejecteeID) |
@@ -1120,17 +1184,41 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
1120 | } | 1184 | } |
1121 | 1185 | ||
1122 | GroupRecord groupInfo = m_groupData.GetGroupRecord(agentID, groupID, null); | 1186 | GroupRecord groupInfo = m_groupData.GetGroupRecord(agentID, groupID, null); |
1123 | 1187 | if (groupInfo == null) | |
1124 | UserAccount account = m_sceneList[0].UserAccountService.GetUserAccount(regionInfo.ScopeID, ejecteeID); | ||
1125 | if ((groupInfo == null) || (account == null)) | ||
1126 | { | ||
1127 | return; | 1188 | return; |
1128 | } | 1189 | |
1190 | |||
1191 | IClientAPI ejecteeClient = GetActiveRootClient(ejecteeID); | ||
1129 | 1192 | ||
1130 | // Send Message to Ejectee | 1193 | // Send Message to Ejectee |
1131 | GridInstantMessage msg = new GridInstantMessage(); | 1194 | GridInstantMessage msg = new GridInstantMessage(); |
1132 | 1195 | ||
1133 | msg.imSessionID = UUID.Zero.Guid; | 1196 | string ejecteeName = "Unknown member"; |
1197 | // if local send a normal message | ||
1198 | if(ejecteeClient != null) | ||
1199 | { | ||
1200 | msg.imSessionID = UUID.Zero.Guid; | ||
1201 | msg.dialog = (byte)OpenMetaverse.InstantMessageDialog.MessageFromAgent; | ||
1202 | // also execute and send update | ||
1203 | ejecteeClient.SendAgentDropGroup(groupID); | ||
1204 | SendAgentGroupDataUpdate(ejecteeClient,true); | ||
1205 | ejecteeName = ejecteeClient.Name; | ||
1206 | } | ||
1207 | else // send | ||
1208 | { | ||
1209 | // Interop, received special 210 code for ejecting a group member | ||
1210 | // this only works within the comms servers domain, and won't work hypergrid | ||
1211 | // TODO:FIXME: Use a presence server of some kind to find out where the | ||
1212 | // client actually is, and try contacting that region directly to notify them, | ||
1213 | // or provide the notification via xmlrpc update queue | ||
1214 | |||
1215 | msg.imSessionID = groupInfo.GroupID.Guid; | ||
1216 | msg.dialog = (byte)210; //interop | ||
1217 | UserAccount account = m_sceneList[0].UserAccountService.GetUserAccount(regionInfo.ScopeID, ejecteeID); | ||
1218 | if (account != null) | ||
1219 | ejecteeName = account.FirstName + " " + account.LastName; | ||
1220 | } | ||
1221 | |||
1134 | msg.fromAgentID = agentID.Guid; | 1222 | msg.fromAgentID = agentID.Guid; |
1135 | // msg.fromAgentID = info.GroupID; | 1223 | // msg.fromAgentID = info.GroupID; |
1136 | msg.toAgentID = ejecteeID.Guid; | 1224 | msg.toAgentID = ejecteeID.Guid; |
@@ -1138,7 +1226,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
1138 | msg.timestamp = 0; | 1226 | msg.timestamp = 0; |
1139 | msg.fromAgentName = agentName; | 1227 | msg.fromAgentName = agentName; |
1140 | msg.message = string.Format("You have been ejected from '{1}' by {0}.", agentName, groupInfo.GroupName); | 1228 | msg.message = string.Format("You have been ejected from '{1}' by {0}.", agentName, groupInfo.GroupName); |
1141 | msg.dialog = (byte)OpenMetaverse.InstantMessageDialog.MessageFromAgent; | 1229 | // |
1142 | msg.fromGroup = false; | 1230 | msg.fromGroup = false; |
1143 | msg.offline = (byte)0; | 1231 | msg.offline = (byte)0; |
1144 | msg.ParentEstateID = 0; | 1232 | msg.ParentEstateID = 0; |
@@ -1148,11 +1236,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
1148 | OutgoingInstantMessage(msg, ejecteeID); | 1236 | OutgoingInstantMessage(msg, ejecteeID); |
1149 | 1237 | ||
1150 | // Message to ejector | 1238 | // Message to ejector |
1151 | // Interop, received special 210 code for ejecting a group member | ||
1152 | // this only works within the comms servers domain, and won't work hypergrid | ||
1153 | // TODO:FIXME: Use a presence server of some kind to find out where the | ||
1154 | // client actually is, and try contacting that region directly to notify them, | ||
1155 | // or provide the notification via xmlrpc update queue | ||
1156 | 1239 | ||
1157 | msg = new GridInstantMessage(); | 1240 | msg = new GridInstantMessage(); |
1158 | msg.imSessionID = UUID.Zero.Guid; | 1241 | msg.imSessionID = UUID.Zero.Guid; |
@@ -1160,15 +1243,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
1160 | msg.toAgentID = agentID.Guid; | 1243 | msg.toAgentID = agentID.Guid; |
1161 | msg.timestamp = 0; | 1244 | msg.timestamp = 0; |
1162 | msg.fromAgentName = agentName; | 1245 | msg.fromAgentName = agentName; |
1163 | if (account != null) | 1246 | |
1164 | { | 1247 | msg.message = string.Format("{2} has been ejected from '{1}' by {0}.", agentName, groupInfo.GroupName, ejecteeName); |
1165 | msg.message = string.Format("{2} has been ejected from '{1}' by {0}.", agentName, groupInfo.GroupName, account.FirstName + " " + account.LastName); | 1248 | |
1166 | } | 1249 | // msg.dialog = (byte)210; //interop |
1167 | else | 1250 | msg.dialog = (byte)OpenMetaverse.InstantMessageDialog.MessageFromAgent; |
1168 | { | ||
1169 | msg.message = string.Format("{2} has been ejected from '{1}' by {0}.", agentName, groupInfo.GroupName, "Unknown member"); | ||
1170 | } | ||
1171 | msg.dialog = (byte)210; //interop | ||
1172 | msg.fromGroup = false; | 1251 | msg.fromGroup = false; |
1173 | msg.offline = (byte)0; | 1252 | msg.offline = (byte)0; |
1174 | msg.ParentEstateID = 0; | 1253 | msg.ParentEstateID = 0; |
@@ -1176,11 +1255,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
1176 | msg.RegionID = regionInfo.RegionID.Guid; | 1255 | msg.RegionID = regionInfo.RegionID.Guid; |
1177 | msg.binaryBucket = new byte[0]; | 1256 | msg.binaryBucket = new byte[0]; |
1178 | OutgoingInstantMessage(msg, agentID); | 1257 | OutgoingInstantMessage(msg, agentID); |
1179 | |||
1180 | |||
1181 | // SL sends out messages to everyone in the group | ||
1182 | // Who all should receive updates and what should they be updated with? | ||
1183 | UpdateAllClientsWithGroupInfo(ejecteeID); | ||
1184 | } | 1258 | } |
1185 | 1259 | ||
1186 | public void InviteGroupRequest(IClientAPI remoteClient, UUID groupID, UUID invitedAgentID, UUID roleID) | 1260 | public void InviteGroupRequest(IClientAPI remoteClient, UUID groupID, UUID invitedAgentID, UUID roleID) |
@@ -1275,6 +1349,19 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
1275 | 1349 | ||
1276 | #region Client/Update Tools | 1350 | #region Client/Update Tools |
1277 | 1351 | ||
1352 | private IClientAPI GetActiveRootClient(UUID agentID) | ||
1353 | { | ||
1354 | foreach (Scene scene in m_sceneList) | ||
1355 | { | ||
1356 | ScenePresence sp = scene.GetScenePresence(agentID); | ||
1357 | if (sp != null && !sp.IsChildAgent && !sp.IsDeleted) | ||
1358 | { | ||
1359 | return sp.ControllingClient; | ||
1360 | } | ||
1361 | } | ||
1362 | return null; | ||
1363 | } | ||
1364 | |||
1278 | /// <summary> | 1365 | /// <summary> |
1279 | /// Try to find an active IClientAPI reference for agentID giving preference to root connections | 1366 | /// Try to find an active IClientAPI reference for agentID giving preference to root connections |
1280 | /// </summary> | 1367 | /// </summary> |
@@ -1286,7 +1373,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
1286 | foreach (Scene scene in m_sceneList) | 1373 | foreach (Scene scene in m_sceneList) |
1287 | { | 1374 | { |
1288 | ScenePresence sp = scene.GetScenePresence(agentID); | 1375 | ScenePresence sp = scene.GetScenePresence(agentID); |
1289 | if (sp != null) | 1376 | if (sp != null && !sp.IsDeleted) |
1290 | { | 1377 | { |
1291 | if (!sp.IsChildAgent) | 1378 | if (!sp.IsChildAgent) |
1292 | { | 1379 | { |
@@ -1303,67 +1390,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
1303 | return child; | 1390 | return child; |
1304 | } | 1391 | } |
1305 | 1392 | ||
1306 | /// <summary> | ||
1307 | /// Send 'remoteClient' the group membership 'data' for agent 'dataForAgentID'. | ||
1308 | /// </summary> | ||
1309 | private void SendGroupMembershipInfoViaCaps(IClientAPI remoteClient, UUID dataForAgentID, GroupMembershipData[] data) | ||
1310 | { | ||
1311 | if (m_debugEnabled) m_log.InfoFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | ||
1312 | |||
1313 | OSDArray AgentData = new OSDArray(1); | ||
1314 | OSDMap AgentDataMap = new OSDMap(1); | ||
1315 | AgentDataMap.Add("AgentID", OSD.FromUUID(dataForAgentID)); | ||
1316 | AgentData.Add(AgentDataMap); | ||
1317 | |||
1318 | OSDArray GroupData = new OSDArray(data.Length); | ||
1319 | OSDArray NewGroupData = new OSDArray(data.Length); | ||
1320 | |||
1321 | foreach (GroupMembershipData membership in data) | ||
1322 | { | ||
1323 | if (GetRequestingAgentID(remoteClient) != dataForAgentID) | ||
1324 | { | ||
1325 | if (!membership.ListInProfile) | ||
1326 | { | ||
1327 | // If we're sending group info to remoteclient about another agent, | ||
1328 | // filter out groups the other agent doesn't want to share. | ||
1329 | continue; | ||
1330 | } | ||
1331 | } | ||
1332 | |||
1333 | OSDMap GroupDataMap = new OSDMap(6); | ||
1334 | OSDMap NewGroupDataMap = new OSDMap(1); | ||
1335 | |||
1336 | GroupDataMap.Add("GroupID", OSD.FromUUID(membership.GroupID)); | ||
1337 | GroupDataMap.Add("GroupPowers", OSD.FromULong(membership.GroupPowers)); | ||
1338 | GroupDataMap.Add("AcceptNotices", OSD.FromBoolean(membership.AcceptNotices)); | ||
1339 | GroupDataMap.Add("GroupInsigniaID", OSD.FromUUID(membership.GroupPicture)); | ||
1340 | GroupDataMap.Add("Contribution", OSD.FromInteger(membership.Contribution)); | ||
1341 | GroupDataMap.Add("GroupName", OSD.FromString(membership.GroupName)); | ||
1342 | NewGroupDataMap.Add("ListInProfile", OSD.FromBoolean(membership.ListInProfile)); | ||
1343 | |||
1344 | GroupData.Add(GroupDataMap); | ||
1345 | NewGroupData.Add(NewGroupDataMap); | ||
1346 | } | ||
1347 | |||
1348 | OSDMap llDataStruct = new OSDMap(3); | ||
1349 | llDataStruct.Add("AgentData", AgentData); | ||
1350 | llDataStruct.Add("GroupData", GroupData); | ||
1351 | llDataStruct.Add("NewGroupData", NewGroupData); | ||
1352 | |||
1353 | if (m_debugEnabled) | ||
1354 | { | ||
1355 | m_log.InfoFormat("[GROUPS]: {0}", OSDParser.SerializeJsonString(llDataStruct)); | ||
1356 | } | ||
1357 | |||
1358 | IEventQueue queue = remoteClient.Scene.RequestModuleInterface<IEventQueue>(); | ||
1359 | |||
1360 | if (queue != null) | ||
1361 | { | ||
1362 | queue.Enqueue(queue.BuildEvent("AgentGroupDataUpdate", llDataStruct), GetRequestingAgentID(remoteClient)); | ||
1363 | } | ||
1364 | |||
1365 | } | ||
1366 | |||
1367 | private void SendScenePresenceUpdate(UUID AgentID, string Title) | 1393 | private void SendScenePresenceUpdate(UUID AgentID, string Title) |
1368 | { | 1394 | { |
1369 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: Updating scene title for {0} with title: {1}", AgentID, Title); | 1395 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: Updating scene title for {0} with title: {1}", AgentID, Title); |
@@ -1380,54 +1406,40 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
1380 | presence.Grouptitle = Title; | 1406 | presence.Grouptitle = Title; |
1381 | 1407 | ||
1382 | if (! presence.IsChildAgent) | 1408 | if (! presence.IsChildAgent) |
1383 | presence.SendAvatarDataToAllClients(); | 1409 | presence.SendAvatarDataToAllAgents(); |
1384 | } | 1410 | } |
1385 | } | 1411 | } |
1386 | } | 1412 | } |
1387 | } | 1413 | } |
1388 | 1414 | ||
1389 | /// <summary> | 1415 | public void SendAgentGroupDataUpdate(IClientAPI remoteClient) |
1390 | /// Send updates to all clients who might be interested in groups data for dataForClientID | ||
1391 | /// </summary> | ||
1392 | private void UpdateAllClientsWithGroupInfo(UUID dataForClientID) | ||
1393 | { | 1416 | { |
1394 | if (m_debugEnabled) m_log.InfoFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 1417 | SendAgentGroupDataUpdate(remoteClient, true); |
1395 | |||
1396 | // TODO: Probably isn't nessesary to update every client in every scene. | ||
1397 | // Need to examine client updates and do only what's nessesary. | ||
1398 | lock (m_sceneList) | ||
1399 | { | ||
1400 | foreach (Scene scene in m_sceneList) | ||
1401 | { | ||
1402 | scene.ForEachClient(delegate(IClientAPI client) { SendAgentGroupDataUpdate(client, dataForClientID); }); | ||
1403 | } | ||
1404 | } | ||
1405 | } | 1418 | } |
1406 | 1419 | ||
1407 | /// <summary> | 1420 | /// <summary> |
1408 | /// Update remoteClient with group information about dataForAgentID | 1421 | /// Tell remoteClient about its agent groups, and optionally send title to others |
1409 | /// </summary> | 1422 | /// </summary> |
1410 | private void SendAgentGroupDataUpdate(IClientAPI remoteClient, UUID dataForAgentID) | 1423 | private void SendAgentGroupDataUpdate(IClientAPI remoteClient, bool tellOthers) |
1411 | { | 1424 | { |
1412 | if (m_debugEnabled) m_log.InfoFormat("[GROUPS]: {0} called for {1}", System.Reflection.MethodBase.GetCurrentMethod().Name, remoteClient.Name); | 1425 | if (m_debugEnabled) m_log.InfoFormat("[GROUPS]: {0} called for {1}", System.Reflection.MethodBase.GetCurrentMethod().Name, remoteClient.Name); |
1413 | 1426 | ||
1427 | // NPCs currently don't have a CAPs structure or event queues. There is a strong argument for conveying this information | ||
1428 | // to them anyway since it makes writing server-side bots a lot easier, but for now we don't do anything. | ||
1429 | if (remoteClient.SceneAgent.PresenceType == PresenceType.Npc) | ||
1430 | return; | ||
1431 | |||
1414 | // TODO: All the client update functions need to be reexamined because most do too much and send too much stuff | 1432 | // TODO: All the client update functions need to be reexamined because most do too much and send too much stuff |
1415 | 1433 | ||
1416 | OnAgentDataUpdateRequest(remoteClient, dataForAgentID, UUID.Zero); | 1434 | UUID agentID = GetRequestingAgentID(remoteClient); |
1417 | 1435 | ||
1418 | // Need to send a group membership update to the client | 1436 | SendDataUpdate(remoteClient, tellOthers); |
1419 | // UDP version doesn't seem to behave nicely. But we're going to send it out here | ||
1420 | // with an empty group membership to hopefully remove groups being displayed due | ||
1421 | // to the core Groups Stub | ||
1422 | remoteClient.SendGroupMembership(new GroupMembershipData[0]); | ||
1423 | 1437 | ||
1424 | GroupMembershipData[] membershipArray = GetProfileListedGroupMemberships(remoteClient, dataForAgentID); | 1438 | GroupMembershipData[] membershipArray = GetProfileListedGroupMemberships(remoteClient, agentID); |
1425 | SendGroupMembershipInfoViaCaps(remoteClient, dataForAgentID, membershipArray); | 1439 | remoteClient.UpdateGroupMembership(membershipArray); |
1426 | remoteClient.SendAvatarGroupsReply(dataForAgentID, membershipArray); | ||
1427 | 1440 | ||
1428 | if (remoteClient.AgentId == dataForAgentID) | 1441 | remoteClient.SendAgentGroupDataUpdate(agentID, membershipArray); |
1429 | remoteClient.RefreshGroupMembership(); | 1442 | } |
1430 | } | ||
1431 | 1443 | ||
1432 | /// <summary> | 1444 | /// <summary> |
1433 | /// Get a list of groups memberships for the agent that are marked "ListInProfile" | 1445 | /// Get a list of groups memberships for the agent that are marked "ListInProfile" |
@@ -1465,7 +1477,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
1465 | membershipArray = membershipData.ToArray(); | 1477 | membershipArray = membershipData.ToArray(); |
1466 | } | 1478 | } |
1467 | } | 1479 | } |
1468 | 1480 | ||
1469 | if (m_debugEnabled) | 1481 | if (m_debugEnabled) |
1470 | { | 1482 | { |
1471 | m_log.InfoFormat("[GROUPS]: Get group membership information for {0} requested by {1}", dataForAgentID, requestingClient.AgentId); | 1483 | m_log.InfoFormat("[GROUPS]: Get group membership information for {0} requested by {1}", dataForAgentID, requestingClient.AgentId); |
@@ -1478,13 +1490,27 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
1478 | return membershipArray; | 1490 | return membershipArray; |
1479 | } | 1491 | } |
1480 | 1492 | ||
1481 | 1493 | //tell remoteClient about its agent group info, and optionally send title to others | |
1482 | private void SendAgentDataUpdate(IClientAPI remoteClient, UUID dataForAgentID, UUID activeGroupID, string activeGroupName, ulong activeGroupPowers, string activeGroupTitle) | 1494 | private void SendDataUpdate(IClientAPI remoteClient, bool tellOthers) |
1483 | { | 1495 | { |
1484 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 1496 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); |
1485 | 1497 | ||
1486 | // TODO: All the client update functions need to be reexamined because most do too much and send too much stuff | 1498 | UUID activeGroupID = UUID.Zero; |
1487 | UserAccount account = m_sceneList[0].UserAccountService.GetUserAccount(remoteClient.Scene.RegionInfo.ScopeID, dataForAgentID); | 1499 | string activeGroupTitle = string.Empty; |
1500 | string activeGroupName = string.Empty; | ||
1501 | ulong activeGroupPowers = (ulong)GroupPowers.None; | ||
1502 | |||
1503 | UUID agentID = GetRequestingAgentID(remoteClient); | ||
1504 | GroupMembershipData membership = m_groupData.GetAgentActiveMembership(agentID, agentID); | ||
1505 | if (membership != null) | ||
1506 | { | ||
1507 | activeGroupID = membership.GroupID; | ||
1508 | activeGroupTitle = membership.GroupTitle; | ||
1509 | activeGroupPowers = membership.GroupPowers; | ||
1510 | activeGroupName = membership.GroupName; | ||
1511 | } | ||
1512 | |||
1513 | UserAccount account = m_sceneList[0].UserAccountService.GetUserAccount(remoteClient.Scene.RegionInfo.ScopeID, agentID); | ||
1488 | string firstname, lastname; | 1514 | string firstname, lastname; |
1489 | if (account != null) | 1515 | if (account != null) |
1490 | { | 1516 | { |
@@ -1497,9 +1523,17 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
1497 | lastname = "Unknown"; | 1523 | lastname = "Unknown"; |
1498 | } | 1524 | } |
1499 | 1525 | ||
1500 | remoteClient.SendAgentDataUpdate(dataForAgentID, activeGroupID, firstname, | 1526 | remoteClient.SendAgentDataUpdate(agentID, activeGroupID, firstname, |
1501 | lastname, activeGroupPowers, activeGroupName, | 1527 | lastname, activeGroupPowers, activeGroupName, |
1502 | activeGroupTitle); | 1528 | activeGroupTitle); |
1529 | |||
1530 | |||
1531 | if (tellOthers) | ||
1532 | SendScenePresenceUpdate(agentID, activeGroupTitle); | ||
1533 | |||
1534 | ScenePresence sp = (ScenePresence)remoteClient.SceneAgent; | ||
1535 | if (sp != null) | ||
1536 | sp.Grouptitle = activeGroupTitle; | ||
1503 | } | 1537 | } |
1504 | 1538 | ||
1505 | #endregion | 1539 | #endregion |
@@ -1510,7 +1544,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
1510 | { | 1544 | { |
1511 | if (m_debugEnabled) m_log.InfoFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 1545 | if (m_debugEnabled) m_log.InfoFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); |
1512 | 1546 | ||
1513 | IClientAPI localClient = GetActiveClient(msgTo); | 1547 | IClientAPI localClient = GetActiveRootClient(msgTo); |
1514 | if (localClient != null) | 1548 | if (localClient != null) |
1515 | { | 1549 | { |
1516 | if (m_debugEnabled) m_log.InfoFormat("[GROUPS]: MsgTo ({0}) is local, delivering directly", localClient.Name); | 1550 | if (m_debugEnabled) m_log.InfoFormat("[GROUPS]: MsgTo ({0}) is local, delivering directly", localClient.Name); |
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/IGroupsServicesConnector.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/IGroupsServicesConnector.cs index 6b5b40a..08c7096 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/IGroupsServicesConnector.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/IGroupsServicesConnector.cs | |||
@@ -43,7 +43,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
43 | /// <returns></returns> | 43 | /// <returns></returns> |
44 | /// <param name='RequestingAgentID'>The UUID of the user making the request.</param> | 44 | /// <param name='RequestingAgentID'>The UUID of the user making the request.</param> |
45 | /// <param name='GroupID'> | 45 | /// <param name='GroupID'> |
46 | /// The ID of the record to retrieve. | 46 | /// The ID of the record to retrieve. |
47 | /// GroupName may be specified instead, in which case this parameter will be UUID.Zero | 47 | /// GroupName may be specified instead, in which case this parameter will be UUID.Zero |
48 | /// </param> | 48 | /// </param> |
49 | /// <param name='GroupName'> | 49 | /// <param name='GroupName'> |
@@ -51,7 +51,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
51 | /// GroupID may be specified instead, in which case this parmeter will be null. | 51 | /// GroupID may be specified instead, in which case this parmeter will be null. |
52 | /// </param> | 52 | /// </param> |
53 | GroupRecord GetGroupRecord(UUID RequestingAgentID, UUID GroupID, string GroupName); | 53 | GroupRecord GetGroupRecord(UUID RequestingAgentID, UUID GroupID, string GroupName); |
54 | 54 | GroupProfileData GetMemberGroupProfile(UUID requestingAgentID, UUID GroupID, UUID AgentID); | |
55 | |||
55 | List<DirGroupsReplyData> FindGroups(UUID RequestingAgentID, string search); | 56 | List<DirGroupsReplyData> FindGroups(UUID RequestingAgentID, string search); |
56 | List<GroupMembersData> GetGroupMembers(UUID RequestingAgentID, UUID GroupID); | 57 | List<GroupMembersData> GetGroupMembers(UUID RequestingAgentID, UUID GroupID); |
57 | 58 | ||
@@ -88,7 +89,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
88 | /// If the user is a member of the group then the data structure is returned. If not, then null is returned. | 89 | /// If the user is a member of the group then the data structure is returned. If not, then null is returned. |
89 | /// </returns> | 90 | /// </returns> |
90 | GroupMembershipData GetAgentGroupMembership(UUID RequestingAgentID, UUID AgentID, UUID GroupID); | 91 | GroupMembershipData GetAgentGroupMembership(UUID RequestingAgentID, UUID AgentID, UUID GroupID); |
91 | 92 | ||
92 | /// <summary> | 93 | /// <summary> |
93 | /// Get information about the groups to which a user belongs. | 94 | /// Get information about the groups to which a user belongs. |
94 | /// </summary> | 95 | /// </summary> |
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs index 1cb4747..98c7ed4 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs | |||
@@ -48,16 +48,16 @@ using OpenSim.Services.Interfaces; | |||
48 | /*************************************************************************** | 48 | /*************************************************************************** |
49 | * Simian Data Map | 49 | * Simian Data Map |
50 | * =============== | 50 | * =============== |
51 | * | 51 | * |
52 | * OwnerID -> Type -> Key | 52 | * OwnerID -> Type -> Key |
53 | * ----------------------- | 53 | * ----------------------- |
54 | * | 54 | * |
55 | * UserID -> Group -> ActiveGroup | 55 | * UserID -> Group -> ActiveGroup |
56 | * + GroupID | 56 | * + GroupID |
57 | * | 57 | * |
58 | * UserID -> GroupSessionDropped -> GroupID | 58 | * UserID -> GroupSessionDropped -> GroupID |
59 | * UserID -> GroupSessionInvited -> GroupID | 59 | * UserID -> GroupSessionInvited -> GroupID |
60 | * | 60 | * |
61 | * UserID -> GroupMember -> GroupID | 61 | * UserID -> GroupMember -> GroupID |
62 | * + SelectedRoleID [UUID] | 62 | * + SelectedRoleID [UUID] |
63 | * + AcceptNotices [bool] | 63 | * + AcceptNotices [bool] |
@@ -65,9 +65,9 @@ using OpenSim.Services.Interfaces; | |||
65 | * + Contribution [int] | 65 | * + Contribution [int] |
66 | * | 66 | * |
67 | * UserID -> GroupRole[GroupID] -> RoleID | 67 | * UserID -> GroupRole[GroupID] -> RoleID |
68 | * | 68 | * |
69 | * | 69 | * |
70 | * GroupID -> Group -> GroupName | 70 | * GroupID -> Group -> GroupName |
71 | * + Charter | 71 | * + Charter |
72 | * + ShowInList | 72 | * + ShowInList |
73 | * + InsigniaID | 73 | * + InsigniaID |
@@ -79,17 +79,17 @@ using OpenSim.Services.Interfaces; | |||
79 | * + EveryonePowers | 79 | * + EveryonePowers |
80 | * + OwnerRoleID | 80 | * + OwnerRoleID |
81 | * + OwnersPowers | 81 | * + OwnersPowers |
82 | * | 82 | * |
83 | * GroupID -> GroupRole -> RoleID | 83 | * GroupID -> GroupRole -> RoleID |
84 | * + Name | 84 | * + Name |
85 | * + Description | 85 | * + Description |
86 | * + Title | 86 | * + Title |
87 | * + Powers | 87 | * + Powers |
88 | * | 88 | * |
89 | * GroupID -> GroupMemberInvite -> InviteID | 89 | * GroupID -> GroupMemberInvite -> InviteID |
90 | * + AgentID | 90 | * + AgentID |
91 | * + RoleID | 91 | * + RoleID |
92 | * | 92 | * |
93 | * GroupID -> GroupNotice -> NoticeID | 93 | * GroupID -> GroupNotice -> NoticeID |
94 | * + TimeStamp [uint] | 94 | * + TimeStamp [uint] |
95 | * + FromName [string] | 95 | * + FromName [string] |
@@ -106,12 +106,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
106 | { | 106 | { |
107 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 107 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
108 | 108 | ||
109 | public const GroupPowers m_DefaultEveryonePowers = GroupPowers.AllowSetHome | | 109 | public const GroupPowers m_DefaultEveryonePowers = GroupPowers.AllowSetHome | |
110 | GroupPowers.Accountable | | 110 | GroupPowers.Accountable | |
111 | GroupPowers.JoinChat | | 111 | GroupPowers.JoinChat | |
112 | GroupPowers.AllowVoiceChat | | 112 | GroupPowers.AllowVoiceChat | |
113 | GroupPowers.ReceiveNotices | | 113 | GroupPowers.ReceiveNotices | |
114 | GroupPowers.StartProposal | | 114 | GroupPowers.StartProposal | |
115 | GroupPowers.VoteOnProposal; | 115 | GroupPowers.VoteOnProposal; |
116 | 116 | ||
117 | // Would this be cleaner as (GroupPowers)ulong.MaxValue; | 117 | // Would this be cleaner as (GroupPowers)ulong.MaxValue; |
@@ -168,12 +168,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
168 | private bool m_debugEnabled = false; | 168 | private bool m_debugEnabled = false; |
169 | 169 | ||
170 | private Dictionary<string, bool> m_pendingRequests = new Dictionary<string,bool>(); | 170 | private Dictionary<string, bool> m_pendingRequests = new Dictionary<string,bool>(); |
171 | 171 | ||
172 | private ExpiringCache<string, OSDMap> m_memoryCache; | 172 | private ExpiringCache<string, OSDMap> m_memoryCache; |
173 | private int m_cacheTimeout = 30; | 173 | private int m_cacheTimeout = 30; |
174 | 174 | ||
175 | // private IUserAccountService m_accountService = null; | 175 | // private IUserAccountService m_accountService = null; |
176 | 176 | ||
177 | 177 | ||
178 | #region Region Module interfaceBase Members | 178 | #region Region Module interfaceBase Members |
179 | 179 | ||
@@ -229,10 +229,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
229 | m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] Groups Cache Timeout set to {0}.", m_cacheTimeout); | 229 | m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] Groups Cache Timeout set to {0}.", m_cacheTimeout); |
230 | } | 230 | } |
231 | 231 | ||
232 | 232 | ||
233 | 233 | ||
234 | m_memoryCache = new ExpiringCache<string,OSDMap>(); | 234 | m_memoryCache = new ExpiringCache<string,OSDMap>(); |
235 | 235 | ||
236 | 236 | ||
237 | // If we got all the config options we need, lets start'er'up | 237 | // If we got all the config options we need, lets start'er'up |
238 | m_connectorEnabled = true; | 238 | m_connectorEnabled = true; |
@@ -244,7 +244,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
244 | 244 | ||
245 | public void Close() | 245 | public void Close() |
246 | { | 246 | { |
247 | m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR]: Closing {0}", this.Name); | ||
248 | } | 247 | } |
249 | 248 | ||
250 | public void AddRegion(OpenSim.Region.Framework.Scenes.Scene scene) | 249 | public void AddRegion(OpenSim.Region.Framework.Scenes.Scene scene) |
@@ -288,8 +287,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
288 | /// <summary> | 287 | /// <summary> |
289 | /// Create a Group, including Everyone and Owners Role, place FounderID in both groups, select Owner as selected role, and newly created group as agent's active role. | 288 | /// Create a Group, including Everyone and Owners Role, place FounderID in both groups, select Owner as selected role, and newly created group as agent's active role. |
290 | /// </summary> | 289 | /// </summary> |
291 | public UUID CreateGroup(UUID requestingAgentID, string name, string charter, bool showInList, UUID insigniaID, | 290 | public UUID CreateGroup(UUID requestingAgentID, string name, string charter, bool showInList, UUID insigniaID, |
292 | int membershipFee, bool openEnrollment, bool allowPublish, | 291 | int membershipFee, bool openEnrollment, bool allowPublish, |
293 | bool maturePublish, UUID founderID) | 292 | bool maturePublish, UUID founderID) |
294 | { | 293 | { |
295 | if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 294 | if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); |
@@ -314,7 +313,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
314 | { | 313 | { |
315 | AddGroupRole(requestingAgentID, GroupID, UUID.Zero, "Everyone", "Members of " + name, "Member of " + name, (ulong)m_DefaultEveryonePowers); | 314 | AddGroupRole(requestingAgentID, GroupID, UUID.Zero, "Everyone", "Members of " + name, "Member of " + name, (ulong)m_DefaultEveryonePowers); |
316 | AddGroupRole(requestingAgentID, GroupID, OwnerRoleID, "Owners", "Owners of " + name, "Owner of " + name, (ulong)m_DefaultOwnerPowers); | 315 | AddGroupRole(requestingAgentID, GroupID, OwnerRoleID, "Owners", "Owners of " + name, "Owner of " + name, (ulong)m_DefaultOwnerPowers); |
317 | 316 | ||
318 | AddAgentToGroup(requestingAgentID, requestingAgentID, GroupID, OwnerRoleID); | 317 | AddAgentToGroup(requestingAgentID, requestingAgentID, GroupID, OwnerRoleID); |
319 | 318 | ||
320 | return GroupID; | 319 | return GroupID; |
@@ -326,8 +325,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
326 | } | 325 | } |
327 | 326 | ||
328 | 327 | ||
329 | public void UpdateGroup(UUID requestingAgentID, UUID groupID, string charter, bool showInList, | 328 | public void UpdateGroup(UUID requestingAgentID, UUID groupID, string charter, bool showInList, |
330 | UUID insigniaID, int membershipFee, bool openEnrollment, | 329 | UUID insigniaID, int membershipFee, bool openEnrollment, |
331 | bool allowPublish, bool maturePublish) | 330 | bool allowPublish, bool maturePublish) |
332 | { | 331 | { |
333 | if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 332 | if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); |
@@ -351,7 +350,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
351 | } | 350 | } |
352 | 351 | ||
353 | 352 | ||
354 | public void AddGroupRole(UUID requestingAgentID, UUID groupID, UUID roleID, string name, string description, | 353 | public void AddGroupRole(UUID requestingAgentID, UUID groupID, UUID roleID, string name, string description, |
355 | string title, ulong powers) | 354 | string title, ulong powers) |
356 | { | 355 | { |
357 | if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 356 | if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); |
@@ -394,7 +393,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
394 | } | 393 | } |
395 | 394 | ||
396 | 395 | ||
397 | public void UpdateGroupRole(UUID requestingAgentID, UUID groupID, UUID roleID, string name, string description, | 396 | public void UpdateGroupRole(UUID requestingAgentID, UUID groupID, UUID roleID, string name, string description, |
398 | string title, ulong powers) | 397 | string title, ulong powers) |
399 | { | 398 | { |
400 | if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 399 | if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); |
@@ -435,7 +434,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
435 | { | 434 | { |
436 | return null; | 435 | return null; |
437 | } | 436 | } |
438 | } | 437 | } |
439 | else if (!string.IsNullOrEmpty(groupName)) | 438 | else if (!string.IsNullOrEmpty(groupName)) |
440 | { | 439 | { |
441 | if (!SimianGetFirstGenericEntry("Group", groupName, out groupID, out GroupInfoMap)) | 440 | if (!SimianGetFirstGenericEntry("Group", groupName, out groupID, out GroupInfoMap)) |
@@ -482,7 +481,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
482 | { | 481 | { |
483 | MemberGroupProfile.Charter = groupProfile["Charter"].AsString(); | 482 | MemberGroupProfile.Charter = groupProfile["Charter"].AsString(); |
484 | } | 483 | } |
485 | 484 | ||
486 | MemberGroupProfile.ShowInList = groupProfile["ShowInList"].AsString() == "1"; | 485 | MemberGroupProfile.ShowInList = groupProfile["ShowInList"].AsString() == "1"; |
487 | MemberGroupProfile.InsigniaID = groupProfile["InsigniaID"].AsUUID(); | 486 | MemberGroupProfile.InsigniaID = groupProfile["InsigniaID"].AsUUID(); |
488 | MemberGroupProfile.MembershipFee = groupProfile["MembershipFee"].AsInteger(); | 487 | MemberGroupProfile.MembershipFee = groupProfile["MembershipFee"].AsInteger(); |
@@ -490,7 +489,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
490 | MemberGroupProfile.AllowPublish = groupProfile["AllowPublish"].AsBoolean(); | 489 | MemberGroupProfile.AllowPublish = groupProfile["AllowPublish"].AsBoolean(); |
491 | MemberGroupProfile.MaturePublish = groupProfile["MaturePublish"].AsBoolean(); | 490 | MemberGroupProfile.MaturePublish = groupProfile["MaturePublish"].AsBoolean(); |
492 | MemberGroupProfile.FounderID = groupProfile["FounderID"].AsUUID();; | 491 | MemberGroupProfile.FounderID = groupProfile["FounderID"].AsUUID();; |
493 | MemberGroupProfile.OwnerRole = groupProfile["OwnerRoleID"].AsUUID(); | 492 | MemberGroupProfile.OwnerRole = groupProfile["OwnerRoleID"].AsUUID(); |
494 | 493 | ||
495 | Dictionary<UUID, OSDMap> Members; | 494 | Dictionary<UUID, OSDMap> Members; |
496 | if (SimianGetGenericEntries("GroupMember",groupID.ToString(), out Members)) | 495 | if (SimianGetGenericEntries("GroupMember",groupID.ToString(), out Members)) |
@@ -547,7 +546,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
547 | { | 546 | { |
548 | GroupMemberInfo = new OSDMap(); | 547 | GroupMemberInfo = new OSDMap(); |
549 | } | 548 | } |
550 | 549 | ||
551 | GroupMemberInfo["AcceptNotices"] = OSD.FromBoolean(acceptNotices); | 550 | GroupMemberInfo["AcceptNotices"] = OSD.FromBoolean(acceptNotices); |
552 | GroupMemberInfo["ListInProfile"] = OSD.FromBoolean(listInProfile); | 551 | GroupMemberInfo["ListInProfile"] = OSD.FromBoolean(listInProfile); |
553 | GroupMemberInfo["Contribution"] = OSD.FromInteger(0); | 552 | GroupMemberInfo["Contribution"] = OSD.FromInteger(0); |
@@ -625,7 +624,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
625 | // Remove Group Member information for this group | 624 | // Remove Group Member information for this group |
626 | SimianRemoveGenericEntry(agentID, "GroupMember", groupID.ToString()); | 625 | SimianRemoveGenericEntry(agentID, "GroupMember", groupID.ToString()); |
627 | 626 | ||
628 | // By using a Simian Generics Type consisting of a prefix and a groupID, | 627 | // By using a Simian Generics Type consisting of a prefix and a groupID, |
629 | // combined with RoleID as key allows us to get a list of roles a particular member | 628 | // combined with RoleID as key allows us to get a list of roles a particular member |
630 | // of a group is assigned to. | 629 | // of a group is assigned to. |
631 | string GroupRoleMemberType = "GroupRole" + groupID.ToString(); | 630 | string GroupRoleMemberType = "GroupRole" + groupID.ToString(); |
@@ -697,7 +696,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
697 | { | 696 | { |
698 | data.members = 0; | 697 | data.members = 0; |
699 | } | 698 | } |
700 | 699 | ||
701 | // TODO: sort results? | 700 | // TODO: sort results? |
702 | // data.searchOrder = order; | 701 | // data.searchOrder = order; |
703 | 702 | ||
@@ -722,8 +721,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
722 | data.AcceptNotices = UserGroupMemberInfo["AcceptNotices"].AsBoolean(); | 721 | data.AcceptNotices = UserGroupMemberInfo["AcceptNotices"].AsBoolean(); |
723 | data.Contribution = UserGroupMemberInfo["Contribution"].AsInteger(); | 722 | data.Contribution = UserGroupMemberInfo["Contribution"].AsInteger(); |
724 | data.ListInProfile = UserGroupMemberInfo["ListInProfile"].AsBoolean(); | 723 | data.ListInProfile = UserGroupMemberInfo["ListInProfile"].AsBoolean(); |
725 | data.ActiveRole = UserGroupMemberInfo["SelectedRoleID"].AsUUID(); | 724 | data.ActiveRole = UserGroupMemberInfo["SelectedRoleID"].AsUUID(); |
726 | 725 | ||
727 | /////////////////////////////// | 726 | /////////////////////////////// |
728 | // Agent Specific Information: | 727 | // Agent Specific Information: |
729 | // | 728 | // |
@@ -731,7 +730,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
731 | if (SimianGetGenericEntry(agentID, "Group", "ActiveGroup", out UserActiveGroup)) | 730 | if (SimianGetGenericEntry(agentID, "Group", "ActiveGroup", out UserActiveGroup)) |
732 | { | 731 | { |
733 | data.Active = UserActiveGroup["GroupID"].AsUUID().Equals(groupID); | 732 | data.Active = UserActiveGroup["GroupID"].AsUUID().Equals(groupID); |
734 | } | 733 | } |
735 | 734 | ||
736 | /////////////////////////////// | 735 | /////////////////////////////// |
737 | // Role Specific Information: | 736 | // Role Specific Information: |
@@ -741,8 +740,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
741 | { | 740 | { |
742 | data.GroupTitle = GroupRoleInfo["Title"].AsString(); | 741 | data.GroupTitle = GroupRoleInfo["Title"].AsString(); |
743 | data.GroupPowers = GroupRoleInfo["Powers"].AsULong(); | 742 | data.GroupPowers = GroupRoleInfo["Powers"].AsULong(); |
744 | } | 743 | } |
745 | 744 | ||
746 | /////////////////////////////// | 745 | /////////////////////////////// |
747 | // Group Specific Information: | 746 | // Group Specific Information: |
748 | // | 747 | // |
@@ -760,7 +759,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
760 | data.MembershipFee = GroupInfo["MembershipFee"].AsInteger(); | 759 | data.MembershipFee = GroupInfo["MembershipFee"].AsInteger(); |
761 | data.OpenEnrollment = GroupInfo["OpenEnrollment"].AsBoolean(); | 760 | data.OpenEnrollment = GroupInfo["OpenEnrollment"].AsBoolean(); |
762 | data.ShowInList = GroupInfo["ShowInList"].AsBoolean(); | 761 | data.ShowInList = GroupInfo["ShowInList"].AsBoolean(); |
763 | } | 762 | } |
764 | } | 763 | } |
765 | 764 | ||
766 | return data; | 765 | return data; |
@@ -795,7 +794,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
795 | memberships.Add(GetAgentGroupMembership(requestingAgentID, agentID, UUID.Parse(key))); | 794 | memberships.Add(GetAgentGroupMembership(requestingAgentID, agentID, UUID.Parse(key))); |
796 | } | 795 | } |
797 | } | 796 | } |
798 | 797 | ||
799 | return memberships; | 798 | return memberships; |
800 | } | 799 | } |
801 | 800 | ||
@@ -1018,7 +1017,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
1018 | Notice["BinaryBucket"] = OSD.FromBinary(binaryBucket); | 1017 | Notice["BinaryBucket"] = OSD.FromBinary(binaryBucket); |
1019 | 1018 | ||
1020 | SimianAddGeneric(groupID, "GroupNotice", noticeID.ToString(), Notice); | 1019 | SimianAddGeneric(groupID, "GroupNotice", noticeID.ToString(), Notice); |
1021 | 1020 | ||
1022 | } | 1021 | } |
1023 | #endregion | 1022 | #endregion |
1024 | 1023 | ||
@@ -1251,7 +1250,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
1251 | { "OwnerID", ownerID.ToString() }, | 1250 | { "OwnerID", ownerID.ToString() }, |
1252 | { "Type", type } | 1251 | { "Type", type } |
1253 | }; | 1252 | }; |
1254 | 1253 | ||
1255 | 1254 | ||
1256 | 1255 | ||
1257 | OSDMap response = CachedPostRequest(requestArgs); | 1256 | OSDMap response = CachedPostRequest(requestArgs); |
@@ -1358,7 +1357,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
1358 | || requestArgs["RequestMethod"] == "AddGeneric") | 1357 | || requestArgs["RequestMethod"] == "AddGeneric") |
1359 | { | 1358 | { |
1360 | m_log.WarnFormat("[SIMIAN GROUPS CONNECTOR]: clearing generics cache"); | 1359 | m_log.WarnFormat("[SIMIAN GROUPS CONNECTOR]: clearing generics cache"); |
1361 | 1360 | ||
1362 | // Any and all updates cause the cache to clear | 1361 | // Any and all updates cause the cache to clear |
1363 | m_memoryCache.Clear(); | 1362 | m_memoryCache.Clear(); |
1364 | 1363 | ||
@@ -1384,14 +1383,14 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
1384 | { | 1383 | { |
1385 | if (m_memoryCache.TryGetValue(CacheKey, out response)) | 1384 | if (m_memoryCache.TryGetValue(CacheKey, out response)) |
1386 | return response; | 1385 | return response; |
1387 | 1386 | ||
1388 | if (! m_pendingRequests.ContainsKey(CacheKey)) | 1387 | if (! m_pendingRequests.ContainsKey(CacheKey)) |
1389 | { | 1388 | { |
1390 | m_pendingRequests.Add(CacheKey,true); | 1389 | m_pendingRequests.Add(CacheKey,true); |
1391 | firstRequest = true; | 1390 | firstRequest = true; |
1392 | } | 1391 | } |
1393 | } | 1392 | } |
1394 | 1393 | ||
1395 | if (firstRequest) | 1394 | if (firstRequest) |
1396 | { | 1395 | { |
1397 | // if it wasn't in the cache, pass the request to the Simian Grid Services | 1396 | // if it wasn't in the cache, pass the request to the Simian Grid Services |
@@ -1403,7 +1402,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
1403 | { | 1402 | { |
1404 | m_log.ErrorFormat("[SIMIAN GROUPS CONNECTOR]: request failed {0}", CacheKey); | 1403 | m_log.ErrorFormat("[SIMIAN GROUPS CONNECTOR]: request failed {0}", CacheKey); |
1405 | } | 1404 | } |
1406 | 1405 | ||
1407 | // and cache the response | 1406 | // and cache the response |
1408 | lock (m_memoryCache) | 1407 | lock (m_memoryCache) |
1409 | { | 1408 | { |
@@ -1421,7 +1420,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
1421 | // { | 1420 | // { |
1422 | // m_log.WarnFormat("[SIMIAN GROUPS CONNECTOR]: query not in the cache"); | 1421 | // m_log.WarnFormat("[SIMIAN GROUPS CONNECTOR]: query not in the cache"); |
1423 | // Util.PrintCallStack(); | 1422 | // Util.PrintCallStack(); |
1424 | 1423 | ||
1425 | // // if it wasn't in the cache, pass the request to the Simian Grid Services | 1424 | // // if it wasn't in the cache, pass the request to the Simian Grid Services |
1426 | // response = WebUtil.PostToService(m_groupsServerURI, requestArgs); | 1425 | // response = WebUtil.PostToService(m_groupsServerURI, requestArgs); |
1427 | 1426 | ||
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs index 9a42bac..ccfcd8b 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs | |||
@@ -74,14 +74,15 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups.Tests | |||
74 | [Test] | 74 | [Test] |
75 | public void TestSendAgentGroupDataUpdate() | 75 | public void TestSendAgentGroupDataUpdate() |
76 | { | 76 | { |
77 | /* AgentGroupDataUpdate is udp | ||
77 | TestHelpers.InMethod(); | 78 | TestHelpers.InMethod(); |
78 | // TestHelpers.EnableLogging(); | 79 | // TestHelpers.EnableLogging(); |
79 | 80 | ||
80 | TestScene scene = new SceneHelpers().SetupScene(); | 81 | TestScene scene = new SceneHelpers().SetupScene(); |
81 | IConfigSource configSource = new IniConfigSource(); | 82 | IConfigSource configSource = new IniConfigSource(); |
82 | IConfig config = configSource.AddConfig("Groups"); | 83 | IConfig config = configSource.AddConfig("Groups"); |
83 | config.Set("Enabled", true); | 84 | config.Set("Enabled", true); |
84 | config.Set("Module", "GroupsModule"); | 85 | config.Set("Module", "GroupsModule"); |
85 | config.Set("DebugEnabled", true); | 86 | config.Set("DebugEnabled", true); |
86 | 87 | ||
87 | GroupsModule gm = new GroupsModule(); | 88 | GroupsModule gm = new GroupsModule(); |
@@ -98,6 +99,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups.Tests | |||
98 | 99 | ||
99 | Hashtable eventsResponse = eqgm.GetEvents(UUID.Zero, sp.UUID); | 100 | Hashtable eventsResponse = eqgm.GetEvents(UUID.Zero, sp.UUID); |
100 | 101 | ||
102 | if((int)eventsResponse["int_response_code"] != (int)HttpStatusCode.OK) | ||
103 | { | ||
104 | eventsResponse = eqgm.GetEvents(UUID.Zero, sp.UUID); | ||
105 | if((int)eventsResponse["int_response_code"] != (int)HttpStatusCode.OK) | ||
106 | eventsResponse = eqgm.GetEvents(UUID.Zero, sp.UUID); | ||
107 | } | ||
108 | |||
101 | Assert.That((int)eventsResponse["int_response_code"], Is.EqualTo((int)HttpStatusCode.OK)); | 109 | Assert.That((int)eventsResponse["int_response_code"], Is.EqualTo((int)HttpStatusCode.OK)); |
102 | 110 | ||
103 | // Console.WriteLine("Response [{0}]", (string)eventsResponse["str_response_string"]); | 111 | // Console.WriteLine("Response [{0}]", (string)eventsResponse["str_response_string"]); |
@@ -116,7 +124,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups.Tests | |||
116 | 124 | ||
117 | Assert.That(foundUpdate, Is.True, "Did not find AgentGroupDataUpdate in response"); | 125 | Assert.That(foundUpdate, Is.True, "Did not find AgentGroupDataUpdate in response"); |
118 | 126 | ||
119 | // TODO: More checking of more actual event data. | 127 | // TODO: More checking of more actual event data. |
128 | */ | ||
120 | } | 129 | } |
121 | 130 | ||
122 | [Test] | 131 | [Test] |
@@ -124,7 +133,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups.Tests | |||
124 | { | 133 | { |
125 | TestHelpers.InMethod(); | 134 | TestHelpers.InMethod(); |
126 | // TestHelpers.EnableLogging(); | 135 | // TestHelpers.EnableLogging(); |
127 | 136 | ||
128 | TestScene scene = new SceneHelpers().SetupScene(); | 137 | TestScene scene = new SceneHelpers().SetupScene(); |
129 | 138 | ||
130 | MessageTransferModule mtm = new MessageTransferModule(); | 139 | MessageTransferModule mtm = new MessageTransferModule(); |
@@ -135,12 +144,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups.Tests | |||
135 | IConfigSource configSource = new IniConfigSource(); | 144 | IConfigSource configSource = new IniConfigSource(); |
136 | 145 | ||
137 | { | 146 | { |
138 | IConfig config = configSource.AddConfig("Messaging"); | 147 | IConfig config = configSource.AddConfig("Messaging"); |
139 | config.Set("MessageTransferModule", mtm.Name); | 148 | config.Set("MessageTransferModule", mtm.Name); |
140 | } | 149 | } |
141 | 150 | ||
142 | { | 151 | { |
143 | IConfig config = configSource.AddConfig("Groups"); | 152 | IConfig config = configSource.AddConfig("Groups"); |
144 | config.Set("Enabled", true); | 153 | config.Set("Enabled", true); |
145 | config.Set("Module", gm.Name); | 154 | config.Set("Module", gm.Name); |
146 | config.Set("DebugEnabled", true); | 155 | config.Set("DebugEnabled", true); |
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs index 20555e4..fab7e8c 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs | |||
@@ -53,17 +53,17 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
53 | 53 | ||
54 | private bool m_debugEnabled = false; | 54 | private bool m_debugEnabled = false; |
55 | 55 | ||
56 | public const GroupPowers DefaultEveryonePowers | 56 | public const GroupPowers DefaultEveryonePowers |
57 | = GroupPowers.AllowSetHome | 57 | = GroupPowers.AllowSetHome |
58 | | GroupPowers.Accountable | 58 | | GroupPowers.Accountable |
59 | | GroupPowers.JoinChat | 59 | | GroupPowers.JoinChat |
60 | | GroupPowers.AllowVoiceChat | 60 | | GroupPowers.AllowVoiceChat |
61 | | GroupPowers.ReceiveNotices | 61 | | GroupPowers.ReceiveNotices |
62 | | GroupPowers.StartProposal | 62 | | GroupPowers.StartProposal |
63 | | GroupPowers.VoteOnProposal; | 63 | | GroupPowers.VoteOnProposal; |
64 | 64 | ||
65 | // Would this be cleaner as (GroupPowers)ulong.MaxValue? | 65 | // Would this be cleaner as (GroupPowers)ulong.MaxValue? |
66 | public const GroupPowers DefaultOwnerPowers | 66 | public const GroupPowers DefaultOwnerPowers |
67 | = GroupPowers.Accountable | 67 | = GroupPowers.Accountable |
68 | | GroupPowers.AllowEditLand | 68 | | GroupPowers.AllowEditLand |
69 | | GroupPowers.AllowFly | 69 | | GroupPowers.AllowFly |
@@ -114,7 +114,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
114 | 114 | ||
115 | private string m_groupsServerURI = string.Empty; | 115 | private string m_groupsServerURI = string.Empty; |
116 | 116 | ||
117 | private bool m_disableKeepAlive = false; | 117 | private bool m_disableKeepAlive = true; |
118 | 118 | ||
119 | private string m_groupReadKey = string.Empty; | 119 | private string m_groupReadKey = string.Empty; |
120 | private string m_groupWriteKey = string.Empty; | 120 | private string m_groupWriteKey = string.Empty; |
@@ -174,13 +174,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
174 | return; | 174 | return; |
175 | } | 175 | } |
176 | 176 | ||
177 | m_disableKeepAlive = groupsConfig.GetBoolean("XmlRpcDisableKeepAlive", false); | 177 | m_disableKeepAlive = groupsConfig.GetBoolean("XmlRpcDisableKeepAlive", true); |
178 | 178 | ||
179 | m_groupReadKey = groupsConfig.GetString("XmlRpcServiceReadKey", string.Empty); | 179 | m_groupReadKey = groupsConfig.GetString("XmlRpcServiceReadKey", string.Empty); |
180 | m_groupWriteKey = groupsConfig.GetString("XmlRpcServiceWriteKey", string.Empty); | 180 | m_groupWriteKey = groupsConfig.GetString("XmlRpcServiceWriteKey", string.Empty); |
181 | 181 | ||
182 | |||
183 | m_cacheTimeout = groupsConfig.GetInt("GroupsCacheTimeout", 30); | 182 | m_cacheTimeout = groupsConfig.GetInt("GroupsCacheTimeout", 30); |
183 | |||
184 | if (m_cacheTimeout == 0) | 184 | if (m_cacheTimeout == 0) |
185 | { | 185 | { |
186 | m_log.WarnFormat("[XMLRPC-GROUPS-CONNECTOR]: Groups Cache Disabled."); | 186 | m_log.WarnFormat("[XMLRPC-GROUPS-CONNECTOR]: Groups Cache Disabled."); |
@@ -200,7 +200,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
200 | 200 | ||
201 | public void Close() | 201 | public void Close() |
202 | { | 202 | { |
203 | m_log.DebugFormat("[XMLRPC-GROUPS-CONNECTOR]: Closing {0}", this.Name); | ||
204 | } | 203 | } |
205 | 204 | ||
206 | public void AddRegion(OpenSim.Region.Framework.Scenes.Scene scene) | 205 | public void AddRegion(OpenSim.Region.Framework.Scenes.Scene scene) |
@@ -383,10 +382,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
383 | 382 | ||
384 | GroupMembershipData MemberInfo = GetAgentGroupMembership(requestingAgentID, AgentID, GroupID); | 383 | GroupMembershipData MemberInfo = GetAgentGroupMembership(requestingAgentID, AgentID, GroupID); |
385 | GroupProfileData MemberGroupProfile = GroupProfileHashtableToGroupProfileData(respData); | 384 | GroupProfileData MemberGroupProfile = GroupProfileHashtableToGroupProfileData(respData); |
386 | 385 | if(MemberInfo != null) | |
387 | MemberGroupProfile.MemberTitle = MemberInfo.GroupTitle; | 386 | { |
388 | MemberGroupProfile.PowersMask = MemberInfo.GroupPowers; | 387 | MemberGroupProfile.MemberTitle = MemberInfo.GroupTitle; |
389 | 388 | MemberGroupProfile.PowersMask = MemberInfo.GroupPowers; | |
389 | } | ||
390 | return MemberGroupProfile; | 390 | return MemberGroupProfile; |
391 | } | 391 | } |
392 | 392 | ||
@@ -666,6 +666,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
666 | data.ListInProfile = ((string)membership["ListInProfile"]) == "1"; | 666 | data.ListInProfile = ((string)membership["ListInProfile"]) == "1"; |
667 | data.AgentPowers = ulong.Parse((string)membership["AgentPowers"]); | 667 | data.AgentPowers = ulong.Parse((string)membership["AgentPowers"]); |
668 | data.Title = (string)membership["Title"]; | 668 | data.Title = (string)membership["Title"]; |
669 | if(membership.ContainsKey("OnlineStatus")) | ||
670 | data.OnlineStatus = (string)membership["OnlineStatus"]; | ||
669 | 671 | ||
670 | members.Add(data); | 672 | members.Add(data); |
671 | } | 673 | } |
@@ -803,11 +805,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
803 | { | 805 | { |
804 | if (m_groupsAgentsDroppedFromChatSession.ContainsKey(groupID)) | 806 | if (m_groupsAgentsDroppedFromChatSession.ContainsKey(groupID)) |
805 | { | 807 | { |
808 | if (m_groupsAgentsInvitedToChatSession[groupID].Contains(agentID)) | ||
809 | m_groupsAgentsInvitedToChatSession[groupID].Remove(agentID); | ||
810 | |||
806 | // If not in dropped list, add | 811 | // If not in dropped list, add |
807 | if (!m_groupsAgentsDroppedFromChatSession[groupID].Contains(agentID)) | 812 | if (!m_groupsAgentsDroppedFromChatSession[groupID].Contains(agentID)) |
808 | { | ||
809 | m_groupsAgentsDroppedFromChatSession[groupID].Add(agentID); | 813 | m_groupsAgentsDroppedFromChatSession[groupID].Add(agentID); |
810 | } | ||
811 | } | 814 | } |
812 | } | 815 | } |
813 | 816 | ||
@@ -818,9 +821,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
818 | 821 | ||
819 | // If nessesary, remove from dropped list | 822 | // If nessesary, remove from dropped list |
820 | if (m_groupsAgentsDroppedFromChatSession[groupID].Contains(agentID)) | 823 | if (m_groupsAgentsDroppedFromChatSession[groupID].Contains(agentID)) |
821 | { | ||
822 | m_groupsAgentsDroppedFromChatSession[groupID].Remove(agentID); | 824 | m_groupsAgentsDroppedFromChatSession[groupID].Remove(agentID); |
823 | } | 825 | |
826 | if (!m_groupsAgentsInvitedToChatSession[groupID].Contains(agentID)) | ||
827 | m_groupsAgentsInvitedToChatSession[groupID].Add(agentID); | ||
824 | } | 828 | } |
825 | 829 | ||
826 | private void CreateGroupChatSessionTracking(UUID groupID) | 830 | private void CreateGroupChatSessionTracking(UUID groupID) |
@@ -975,35 +979,42 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
975 | 979 | ||
976 | try | 980 | try |
977 | { | 981 | { |
978 | resp = req.Send(m_groupsServerURI, 10000); | 982 | resp = req.Send(m_groupsServerURI); |
979 | |||
980 | if ((m_cacheTimeout > 0) && (CacheKey != null)) | ||
981 | { | ||
982 | m_memoryCache.AddOrUpdate(CacheKey, resp, TimeSpan.FromSeconds(m_cacheTimeout)); | ||
983 | } | ||
984 | } | 983 | } |
985 | catch (Exception e) | 984 | catch (Exception e) |
986 | { | 985 | { |
987 | m_log.ErrorFormat( | 986 | m_log.ErrorFormat( |
988 | "[XMLRPC-GROUPS-CONNECTOR]: An error has occured while attempting to access the XmlRpcGroups server method {0} at {1}", | 987 | "[XMLRPC-GROUPS-CONNECTOR]: An error has occured while attempting to access the XmlRpcGroups server method {0} at {1}: {2}", |
989 | function, m_groupsServerURI); | 988 | function, m_groupsServerURI, e.Message); |
990 | |||
991 | m_log.ErrorFormat("[XMLRPC-GROUPS-CONNECTOR]: {0}{1}", e.Message, e.StackTrace); | ||
992 | 989 | ||
993 | foreach (string ResponseLine in req.RequestResponse.Split(new string[] { Environment.NewLine }, StringSplitOptions.None)) | 990 | if(m_debugEnabled) |
994 | { | 991 | { |
995 | m_log.ErrorFormat("[XMLRPC-GROUPS-CONNECTOR]: {0} ", ResponseLine); | 992 | m_log.ErrorFormat("[XMLRPC-GROUPS-CONNECTOR]: {0}", e.StackTrace); |
993 | |||
994 | foreach (string ResponseLine in req.RequestResponse.Split(new string[] { Environment.NewLine }, StringSplitOptions.None)) | ||
995 | { | ||
996 | m_log.ErrorFormat("[XMLRPC-GROUPS-CONNECTOR]: {0} ", ResponseLine); | ||
997 | } | ||
998 | |||
999 | foreach (string key in param.Keys) | ||
1000 | { | ||
1001 | m_log.WarnFormat("[XMLRPC-GROUPS-CONNECTOR]: {0} :: {1}", key, param[key].ToString()); | ||
1002 | } | ||
996 | } | 1003 | } |
997 | 1004 | ||
998 | foreach (string key in param.Keys) | 1005 | if ((m_cacheTimeout > 0) && (CacheKey != null)) |
999 | { | 1006 | { |
1000 | m_log.WarnFormat("[XMLRPC-GROUPS-CONNECTOR]: {0} :: {1}", key, param[key].ToString()); | 1007 | m_memoryCache.AddOrUpdate(CacheKey, resp, 10.0); |
1001 | } | 1008 | } |
1002 | |||
1003 | Hashtable respData = new Hashtable(); | 1009 | Hashtable respData = new Hashtable(); |
1004 | respData.Add("error", e.ToString()); | 1010 | respData.Add("error", e.ToString()); |
1005 | return respData; | 1011 | return respData; |
1006 | } | 1012 | } |
1013 | |||
1014 | if ((m_cacheTimeout > 0) && (CacheKey != null)) | ||
1015 | { | ||
1016 | m_memoryCache.AddOrUpdate(CacheKey, resp, 10.0); | ||
1017 | } | ||
1007 | } | 1018 | } |
1008 | 1019 | ||
1009 | if (resp.Value is Hashtable) | 1020 | if (resp.Value is Hashtable) |
@@ -1042,7 +1053,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
1042 | private void LogRespDataToConsoleError(UUID requestingAgentID, string function, Hashtable param, Hashtable respData) | 1053 | private void LogRespDataToConsoleError(UUID requestingAgentID, string function, Hashtable param, Hashtable respData) |
1043 | { | 1054 | { |
1044 | m_log.ErrorFormat( | 1055 | m_log.ErrorFormat( |
1045 | "[XMLRPC-GROUPS-CONNECTOR]: Error when calling {0} for {1} with params {2}. Response params are {3}", | 1056 | "[XMLRPC-GROUPS-CONNECTOR]: Error when calling {0} for {1} with params {2}. Response params are {3}", |
1046 | function, requestingAgentID, Util.PrettyFormatToSingleLine(param), Util.PrettyFormatToSingleLine(respData)); | 1057 | function, requestingAgentID, Util.PrettyFormatToSingleLine(param), Util.PrettyFormatToSingleLine(respData)); |
1047 | } | 1058 | } |
1048 | 1059 | ||
@@ -1134,6 +1145,7 @@ namespace Nwc.XmlRpc | |||
1134 | request.ContentType = "text/xml"; | 1145 | request.ContentType = "text/xml"; |
1135 | request.AllowWriteStreamBuffering = true; | 1146 | request.AllowWriteStreamBuffering = true; |
1136 | request.KeepAlive = !_disableKeepAlive; | 1147 | request.KeepAlive = !_disableKeepAlive; |
1148 | request.Timeout = 30000; | ||
1137 | 1149 | ||
1138 | using (Stream stream = request.GetRequestStream()) | 1150 | using (Stream stream = request.GetRequestStream()) |
1139 | { | 1151 | { |
@@ -1141,7 +1153,7 @@ namespace Nwc.XmlRpc | |||
1141 | { | 1153 | { |
1142 | _serializer.Serialize(xml, this); | 1154 | _serializer.Serialize(xml, this); |
1143 | xml.Flush(); | 1155 | xml.Flush(); |
1144 | } | 1156 | } |
1145 | } | 1157 | } |
1146 | 1158 | ||
1147 | XmlRpcResponse resp; | 1159 | XmlRpcResponse resp; |