diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs | 236 |
1 files changed, 153 insertions, 83 deletions
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs index 29f9591..a844660 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs | |||
@@ -39,6 +39,7 @@ using OpenSim.Framework.Communications; | |||
39 | using OpenSim.Region.Framework.Interfaces; | 39 | using OpenSim.Region.Framework.Interfaces; |
40 | using OpenSim.Region.Framework.Scenes; | 40 | using OpenSim.Region.Framework.Scenes; |
41 | using OpenSim.Services.Interfaces; | 41 | using OpenSim.Services.Interfaces; |
42 | using System.Text; | ||
42 | using DirFindFlags = OpenMetaverse.DirectoryManager.DirFindFlags; | 43 | using DirFindFlags = OpenMetaverse.DirectoryManager.DirFindFlags; |
43 | 44 | ||
44 | namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | 45 | namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups |
@@ -50,19 +51,19 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
50 | /// ; To use this module, you must specify the following in your OpenSim.ini | 51 | /// ; To use this module, you must specify the following in your OpenSim.ini |
51 | /// [GROUPS] | 52 | /// [GROUPS] |
52 | /// Enabled = true | 53 | /// Enabled = true |
53 | /// | 54 | /// |
54 | /// Module = GroupsModule | 55 | /// Module = GroupsModule |
55 | /// NoticesEnabled = true | 56 | /// NoticesEnabled = true |
56 | /// DebugEnabled = true | 57 | /// DebugEnabled = true |
57 | /// | 58 | /// |
58 | /// GroupsServicesConnectorModule = XmlRpcGroupsServicesConnector | 59 | /// GroupsServicesConnectorModule = XmlRpcGroupsServicesConnector |
59 | /// XmlRpcServiceURL = http://osflotsam.org/xmlrpc.php | 60 | /// XmlRpcServiceURL = http://osflotsam.org/xmlrpc.php |
60 | /// XmlRpcServiceReadKey = 1234 | 61 | /// XmlRpcServiceReadKey = 1234 |
61 | /// XmlRpcServiceWriteKey = 1234 | 62 | /// XmlRpcServiceWriteKey = 1234 |
62 | /// | 63 | /// |
63 | /// MessagingModule = GroupsMessagingModule | 64 | /// MessagingModule = GroupsMessagingModule |
64 | /// MessagingEnabled = true | 65 | /// MessagingEnabled = true |
65 | /// | 66 | /// |
66 | /// ; Disables HTTP Keep-Alive for Groups Module HTTP Requests, work around for | 67 | /// ; Disables HTTP Keep-Alive for Groups Module HTTP Requests, work around for |
67 | /// ; a problem discovered on some Windows based region servers. Only disable | 68 | /// ; a problem discovered on some Windows based region servers. Only disable |
68 | /// ; if you see a large number (dozens) of the following Exceptions: | 69 | /// ; if you see a large number (dozens) of the following Exceptions: |
@@ -77,7 +78,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
77 | private List<Scene> m_sceneList = new List<Scene>(); | 78 | private List<Scene> m_sceneList = new List<Scene>(); |
78 | 79 | ||
79 | private IMessageTransferModule m_msgTransferModule = null; | 80 | private IMessageTransferModule m_msgTransferModule = null; |
80 | 81 | ||
81 | private IGroupsServicesConnector m_groupData = null; | 82 | private IGroupsServicesConnector m_groupData = null; |
82 | 83 | ||
83 | // Configuration settings | 84 | // Configuration settings |
@@ -195,10 +196,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
195 | 196 | ||
196 | scene.EventManager.OnNewClient += OnNewClient; | 197 | scene.EventManager.OnNewClient += OnNewClient; |
197 | scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage; | 198 | scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage; |
198 | // The InstantMessageModule itself doesn't do this, | 199 | // The InstantMessageModule itself doesn't do this, |
199 | // so lets see if things explode if we don't do it | 200 | // so lets see if things explode if we don't do it |
200 | // scene.EventManager.OnClientClosed += OnClientClosed; | 201 | // scene.EventManager.OnClientClosed += OnClientClosed; |
201 | |||
202 | } | 202 | } |
203 | 203 | ||
204 | public void RemoveRegion(Scene scene) | 204 | public void RemoveRegion(Scene scene) |
@@ -222,7 +222,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
222 | if (m_debugEnabled) m_log.Debug("[GROUPS]: Shutting down Groups module."); | 222 | if (m_debugEnabled) m_log.Debug("[GROUPS]: Shutting down Groups module."); |
223 | } | 223 | } |
224 | 224 | ||
225 | public Type ReplaceableInterface | 225 | public Type ReplaceableInterface |
226 | { | 226 | { |
227 | get { return null; } | 227 | get { return null; } |
228 | } | 228 | } |
@@ -274,7 +274,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
274 | * reference to IClientAPI's, one for 0 or 1 root connections, and 0 or more child connections. | 274 | * reference to IClientAPI's, one for 0 or 1 root connections, and 0 or more child connections. |
275 | * The OnClientClosed event does not provide anything to indicate which one of those should be closed | 275 | * The OnClientClosed event does not provide anything to indicate which one of those should be closed |
276 | * nor does it provide what scene it was from so that the specific reference can be looked up. | 276 | * nor does it provide what scene it was from so that the specific reference can be looked up. |
277 | * The InstantMessageModule.cs does not currently worry about unregistering the handles, | 277 | * The InstantMessageModule.cs does not currently worry about unregistering the handles, |
278 | * and it should be an issue, since it's the client that references us not the other way around | 278 | * and it should be an issue, since it's the client that references us not the other way around |
279 | * , so as long as we don't keep a reference to the client laying around, the client can still be GC'ed | 279 | * , so as long as we don't keep a reference to the client laying around, the client can still be GC'ed |
280 | private void OnClientClosed(UUID AgentId) | 280 | private void OnClientClosed(UUID AgentId) |
@@ -297,8 +297,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
297 | { | 297 | { |
298 | if (m_debugEnabled) m_log.WarnFormat("[GROUPS]: Client closed that wasn't registered here."); | 298 | if (m_debugEnabled) m_log.WarnFormat("[GROUPS]: Client closed that wasn't registered here."); |
299 | } | 299 | } |
300 | |||
301 | |||
302 | } | 300 | } |
303 | } | 301 | } |
304 | */ | 302 | */ |
@@ -307,15 +305,15 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
307 | { | 305 | { |
308 | if (((DirFindFlags)queryFlags & DirFindFlags.Groups) == DirFindFlags.Groups) | 306 | if (((DirFindFlags)queryFlags & DirFindFlags.Groups) == DirFindFlags.Groups) |
309 | { | 307 | { |
310 | if (m_debugEnabled) | 308 | if (m_debugEnabled) |
311 | m_log.DebugFormat( | 309 | m_log.DebugFormat( |
312 | "[GROUPS]: {0} called with queryText({1}) queryFlags({2}) queryStart({3})", | 310 | "[GROUPS]: {0} called with queryText({1}) queryFlags({2}) queryStart({3})", |
313 | System.Reflection.MethodBase.GetCurrentMethod().Name, queryText, (DirFindFlags)queryFlags, queryStart); | 311 | System.Reflection.MethodBase.GetCurrentMethod().Name, queryText, (DirFindFlags)queryFlags, queryStart); |
314 | 312 | ||
315 | // TODO: This currently ignores pretty much all the query flags including Mature and sort order | 313 | // TODO: This currently ignores pretty much all the query flags including Mature and sort order |
316 | remoteClient.SendDirGroupsReply(queryID, m_groupData.FindGroups(GetRequestingAgentID(remoteClient), queryText).ToArray()); | 314 | remoteClient.SendDirGroupsReply(queryID, m_groupData.FindGroups(GetRequestingAgentID(remoteClient), queryText).ToArray()); |
317 | } | 315 | } |
318 | 316 | ||
319 | } | 317 | } |
320 | 318 | ||
321 | private void OnAgentDataUpdateRequest(IClientAPI remoteClient, UUID dataForAgentID, UUID sessionID) | 319 | private void OnAgentDataUpdateRequest(IClientAPI remoteClient, UUID dataForAgentID, UUID sessionID) |
@@ -345,7 +343,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
345 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 343 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); |
346 | 344 | ||
347 | string GroupName; | 345 | string GroupName; |
348 | 346 | ||
349 | GroupRecord group = m_groupData.GetGroupRecord(GetRequestingAgentID(remoteClient), GroupID, null); | 347 | GroupRecord group = m_groupData.GetGroupRecord(GetRequestingAgentID(remoteClient), GroupID, null); |
350 | if (group != null) | 348 | if (group != null) |
351 | { | 349 | { |
@@ -407,7 +405,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
407 | 405 | ||
408 | UpdateAllClientsWithGroupInfo(inviteInfo.AgentID); | 406 | UpdateAllClientsWithGroupInfo(inviteInfo.AgentID); |
409 | 407 | ||
410 | // TODO: If the inviter is still online, they need an agent dataupdate | 408 | // TODO: If the inviter is still online, they need an agent dataupdate |
411 | // and maybe group membership updates for the invitee | 409 | // and maybe group membership updates for the invitee |
412 | 410 | ||
413 | m_groupData.RemoveAgentToGroupInvite(GetRequestingAgentID(remoteClient), inviteID); | 411 | m_groupData.RemoveAgentToGroupInvite(GetRequestingAgentID(remoteClient), inviteID); |
@@ -437,44 +435,75 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
437 | string Subject = im.message.Substring(0, im.message.IndexOf('|')); | 435 | string Subject = im.message.Substring(0, im.message.IndexOf('|')); |
438 | string Message = im.message.Substring(Subject.Length + 1); | 436 | string Message = im.message.Substring(Subject.Length + 1); |
439 | 437 | ||
438 | InventoryItemBase item = null; | ||
439 | bool hasAttachment = false; | ||
440 | UUID itemID = UUID.Zero; //Assignment to quiet compiler | ||
441 | UUID ownerID = UUID.Zero; //Assignment to quiet compiler | ||
440 | byte[] bucket; | 442 | byte[] bucket; |
441 | 443 | ||
442 | if ((im.binaryBucket.Length == 1) && (im.binaryBucket[0] == 0)) | 444 | if (im.binaryBucket.Length >= 1 && im.binaryBucket[0] > 0) |
443 | { | ||
444 | bucket = new byte[19]; | ||
445 | bucket[0] = 0; //dunno | ||
446 | bucket[1] = 0; //dunno | ||
447 | GroupID.ToBytes(bucket, 2); | ||
448 | bucket[18] = 0; //dunno | ||
449 | } | ||
450 | else | ||
451 | { | 445 | { |
452 | string binBucket = OpenMetaverse.Utils.BytesToString(im.binaryBucket); | 446 | string binBucket = OpenMetaverse.Utils.BytesToString(im.binaryBucket); |
453 | binBucket = binBucket.Remove(0, 14).Trim(); | 447 | binBucket = binBucket.Remove(0, 14).Trim(); |
454 | if (m_debugEnabled) | 448 | |
449 | OSDMap binBucketOSD = (OSDMap)OSDParser.DeserializeLLSDXml(binBucket); | ||
450 | if (binBucketOSD is OSD) | ||
455 | { | 451 | { |
456 | m_log.WarnFormat("I don't understand a group notice binary bucket of: {0}", binBucket); | 452 | OSDMap binBucketMap = (OSDMap)binBucketOSD; |
453 | |||
454 | itemID = binBucketMap["item_id"].AsUUID(); | ||
455 | ownerID = binBucketMap["owner_id"].AsUUID(); | ||
457 | 456 | ||
458 | OSDMap binBucketOSD = (OSDMap)OSDParser.DeserializeLLSDXml(binBucket); | 457 | //Attempt to get the details of the attached item. |
459 | 458 | //If sender doesn't own the attachment, the item | |
460 | foreach (string key in binBucketOSD.Keys) | 459 | //variable will be set to null and attachment will |
460 | //not be included with the group notice. | ||
461 | Scene scene = (Scene)remoteClient.Scene; | ||
462 | item = new InventoryItemBase(itemID, ownerID); | ||
463 | item = scene.InventoryService.GetItem(item); | ||
464 | |||
465 | if (item != null) | ||
461 | { | 466 | { |
462 | if (binBucketOSD.ContainsKey(key)) | 467 | //Got item details so include the attachment. |
463 | { | 468 | hasAttachment = true; |
464 | m_log.WarnFormat("{0}: {1}", key, binBucketOSD[key].ToString()); | ||
465 | } | ||
466 | } | 469 | } |
467 | } | 470 | } |
468 | 471 | else | |
469 | // treat as if no attachment | 472 | { |
473 | m_log.DebugFormat("[Groups]: Received OSD with unexpected type: {0}", binBucketOSD.GetType()); | ||
474 | } | ||
475 | } | ||
476 | |||
477 | if (hasAttachment) | ||
478 | { | ||
479 | //Bucket contains information about attachment. | ||
480 | // | ||
481 | //Byte offset and description of bucket data: | ||
482 | //0: 1 byte indicating if attachment is present | ||
483 | //1: 1 byte indicating the type of attachment | ||
484 | //2: 16 bytes - Group UUID | ||
485 | //18: 16 bytes - UUID of the attachment owner | ||
486 | //34: 16 bytes - UUID of the attachment | ||
487 | //50: variable - Name of the attachment | ||
488 | //??: NUL byte to terminate the attachment name | ||
489 | byte[] name = Encoding.UTF8.GetBytes(item.Name); | ||
490 | bucket = new byte[51 + name.Length];//3 bytes, 3 UUIDs, and name | ||
491 | bucket[0] = 1; //Has attachment flag | ||
492 | bucket[1] = (byte)item.InvType; //Type of Attachment | ||
493 | GroupID.ToBytes(bucket, 2); | ||
494 | ownerID.ToBytes(bucket, 18); | ||
495 | itemID.ToBytes(bucket, 34); | ||
496 | name.CopyTo(bucket, 50); | ||
497 | } | ||
498 | else | ||
499 | { | ||
470 | bucket = new byte[19]; | 500 | bucket = new byte[19]; |
471 | bucket[0] = 0; //dunno | 501 | bucket[0] = 0; //Has attachment flag |
472 | bucket[1] = 0; //dunno | 502 | bucket[1] = 0; //Type of attachment |
473 | GroupID.ToBytes(bucket, 2); | 503 | GroupID.ToBytes(bucket, 2); |
474 | bucket[18] = 0; //dunno | 504 | bucket[18] = 0; //NUL terminate name of attachment |
475 | } | 505 | } |
476 | 506 | ||
477 | |||
478 | m_groupData.AddGroupNotice(GetRequestingAgentID(remoteClient), GroupID, NoticeID, im.fromAgentName, Subject, Message, bucket); | 507 | m_groupData.AddGroupNotice(GetRequestingAgentID(remoteClient), GroupID, NoticeID, im.fromAgentName, Subject, Message, bucket); |
479 | if (OnNewGroupNotice != null) | 508 | if (OnNewGroupNotice != null) |
480 | { | 509 | { |
@@ -484,22 +513,24 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
484 | // Send notice out to everyone that wants notices | 513 | // Send notice out to everyone that wants notices |
485 | foreach (GroupMembersData member in m_groupData.GetGroupMembers(GetRequestingAgentID(remoteClient), GroupID)) | 514 | foreach (GroupMembersData member in m_groupData.GetGroupMembers(GetRequestingAgentID(remoteClient), GroupID)) |
486 | { | 515 | { |
487 | if (m_debugEnabled) | 516 | if (m_debugEnabled) |
488 | { | 517 | { |
489 | UserAccount targetUser = m_sceneList[0].UserAccountService.GetUserAccount(remoteClient.Scene.RegionInfo.ScopeID, member.AgentID); | 518 | UserAccount targetUser = m_sceneList[0].UserAccountService.GetUserAccount(remoteClient.Scene.RegionInfo.ScopeID, member.AgentID); |
490 | if (targetUser != null) | 519 | if (targetUser != null) |
491 | { | 520 | { |
492 | m_log.DebugFormat("[GROUPS]: Prepping group notice {0} for agent: {1} who Accepts Notices ({2})", NoticeID, targetUser.FirstName + " " + targetUser.LastName, member.AcceptNotices); | 521 | m_log.DebugFormat("[GROUPS]: Prepping group notice {0} for agent: {1} who Accepts Notices ({2})", |
522 | NoticeID, targetUser.FirstName + " " + targetUser.LastName, member.AcceptNotices); | ||
493 | } | 523 | } |
494 | else | 524 | else |
495 | { | 525 | { |
496 | m_log.DebugFormat("[GROUPS]: Prepping group notice {0} for agent: {1} who Accepts Notices ({2})", NoticeID, member.AgentID, member.AcceptNotices); | 526 | m_log.DebugFormat("[GROUPS]: Prepping group notice {0} for agent: {1} who Accepts Notices ({2})", |
527 | NoticeID, member.AgentID, member.AcceptNotices); | ||
497 | } | 528 | } |
498 | } | 529 | } |
499 | 530 | ||
500 | if (member.AcceptNotices) | 531 | if (member.AcceptNotices) |
501 | { | 532 | { |
502 | // Build notice IIM | 533 | // Build notice IM |
503 | GridInstantMessage msg = CreateGroupNoticeIM(UUID.Zero, NoticeID, (byte)OpenMetaverse.InstantMessageDialog.GroupNotice); | 534 | GridInstantMessage msg = CreateGroupNoticeIM(UUID.Zero, NoticeID, (byte)OpenMetaverse.InstantMessageDialog.GroupNotice); |
504 | 535 | ||
505 | msg.toAgentID = member.AgentID.Guid; | 536 | msg.toAgentID = member.AgentID.Guid; |
@@ -508,10 +539,40 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
508 | } | 539 | } |
509 | } | 540 | } |
510 | } | 541 | } |
511 | 542 | ||
543 | if (im.dialog == (byte)InstantMessageDialog.GroupNoticeInventoryAccepted) | ||
544 | { | ||
545 | //Is bucket large enough to hold UUID of the attachment? | ||
546 | if (im.binaryBucket.Length < 16) | ||
547 | return; | ||
548 | |||
549 | UUID noticeID = new UUID(im.imSessionID); | ||
550 | |||
551 | GroupNoticeInfo notice = m_groupData.GetGroupNotice(GetRequestingAgentID(remoteClient), noticeID); | ||
552 | if (notice != null) | ||
553 | { | ||
554 | UUID giver = new UUID(notice.BinaryBucket, 18); | ||
555 | UUID attachmentUUID = new UUID(notice.BinaryBucket, 34); | ||
556 | |||
557 | if (m_debugEnabled) | ||
558 | m_log.DebugFormat("[Groups]: Giving inventory from {0} to {1}", giver, remoteClient.AgentId); | ||
559 | |||
560 | InventoryItemBase itemCopy = ((Scene)(remoteClient.Scene)).GiveInventoryItem(remoteClient.AgentId, | ||
561 | giver, attachmentUUID); | ||
562 | |||
563 | if (itemCopy == null) | ||
564 | { | ||
565 | remoteClient.SendAgentAlertMessage("Can't find item to give. Nothing given.", false); | ||
566 | return; | ||
567 | } | ||
568 | |||
569 | remoteClient.SendInventoryItemCreateUpdate(itemCopy, 0); | ||
570 | } | ||
571 | } | ||
572 | |||
512 | // Interop, received special 210 code for ejecting a group member | 573 | // Interop, received special 210 code for ejecting a group member |
513 | // this only works within the comms servers domain, and won't work hypergrid | 574 | // this only works within the comms servers domain, and won't work hypergrid |
514 | // TODO:FIXME: Use a presense server of some kind to find out where the | 575 | // TODO:FIXME: Use a presense server of some kind to find out where the |
515 | // client actually is, and try contacting that region directly to notify them, | 576 | // client actually is, and try contacting that region directly to notify them, |
516 | // or provide the notification via xmlrpc update queue | 577 | // or provide the notification via xmlrpc update queue |
517 | if ((im.dialog == 210)) | 578 | if ((im.dialog == 210)) |
@@ -574,7 +635,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
574 | { | 635 | { |
575 | return m_groupData.GetGroupRecord(UUID.Zero, UUID.Zero, name); | 636 | return m_groupData.GetGroupRecord(UUID.Zero, UUID.Zero, name); |
576 | } | 637 | } |
577 | 638 | ||
578 | public void ActivateGroup(IClientAPI remoteClient, UUID groupID) | 639 | public void ActivateGroup(IClientAPI remoteClient, UUID groupID) |
579 | { | 640 | { |
580 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 641 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); |
@@ -582,7 +643,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
582 | m_groupData.SetAgentActiveGroup(GetRequestingAgentID(remoteClient), GetRequestingAgentID(remoteClient), groupID); | 643 | m_groupData.SetAgentActiveGroup(GetRequestingAgentID(remoteClient), GetRequestingAgentID(remoteClient), groupID); |
583 | 644 | ||
584 | // Changing active group changes title, active powers, all kinds of things | 645 | // Changing active group changes title, active powers, all kinds of things |
585 | // anyone who is in any region that can see this client, should probably be | 646 | // anyone who is in any region that can see this client, should probably be |
586 | // updated with new group info. At a minimum, they should get ScenePresence | 647 | // updated with new group info. At a minimum, they should get ScenePresence |
587 | // updated with new title. | 648 | // updated with new title. |
588 | UpdateAllClientsWithGroupInfo(GetRequestingAgentID(remoteClient)); | 649 | UpdateAllClientsWithGroupInfo(GetRequestingAgentID(remoteClient)); |
@@ -618,10 +679,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
618 | 679 | ||
619 | public List<GroupMembersData> GroupMembersRequest(IClientAPI remoteClient, UUID groupID) | 680 | public List<GroupMembersData> GroupMembersRequest(IClientAPI remoteClient, UUID groupID) |
620 | { | 681 | { |
621 | if (m_debugEnabled) | 682 | if (m_debugEnabled) |
622 | m_log.DebugFormat( | 683 | m_log.DebugFormat( |
623 | "[GROUPS]: GroupMembersRequest called for {0} from client {1}", groupID, remoteClient.Name); | 684 | "[GROUPS]: GroupMembersRequest called for {0} from client {1}", groupID, remoteClient.Name); |
624 | 685 | ||
625 | List<GroupMembersData> data = m_groupData.GetGroupMembers(GetRequestingAgentID(remoteClient), groupID); | 686 | List<GroupMembersData> data = m_groupData.GetGroupMembers(GetRequestingAgentID(remoteClient), groupID); |
626 | 687 | ||
627 | if (m_debugEnabled) | 688 | if (m_debugEnabled) |
@@ -706,7 +767,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
706 | 767 | ||
707 | public GroupMembershipData GetMembershipData(UUID groupID, UUID agentID) | 768 | public GroupMembershipData GetMembershipData(UUID groupID, UUID agentID) |
708 | { | 769 | { |
709 | if (m_debugEnabled) | 770 | if (m_debugEnabled) |
710 | m_log.DebugFormat( | 771 | m_log.DebugFormat( |
711 | "[GROUPS]: {0} called with groupID={1}, agentID={2}", | 772 | "[GROUPS]: {0} called with groupID={1}, agentID={2}", |
712 | System.Reflection.MethodBase.GetCurrentMethod().Name, groupID, agentID); | 773 | System.Reflection.MethodBase.GetCurrentMethod().Name, groupID, agentID); |
@@ -796,7 +857,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
796 | if (membership != null) | 857 | if (membership != null) |
797 | { | 858 | { |
798 | return membership.GroupTitle; | 859 | return membership.GroupTitle; |
799 | } | 860 | } |
800 | return string.Empty; | 861 | return string.Empty; |
801 | } | 862 | } |
802 | 863 | ||
@@ -812,7 +873,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
812 | // TODO: Not sure what all is needed here, but if the active group role change is for the group | 873 | // TODO: Not sure what all is needed here, but if the active group role change is for the group |
813 | // the client currently has set active, then we need to do a scene presence update too | 874 | // the client currently has set active, then we need to do a scene presence update too |
814 | // if (m_groupData.GetAgentActiveMembership(GetRequestingAgentID(remoteClient)).GroupID == GroupID) | 875 | // if (m_groupData.GetAgentActiveMembership(GetRequestingAgentID(remoteClient)).GroupID == GroupID) |
815 | 876 | ||
816 | UpdateAllClientsWithGroupInfo(GetRequestingAgentID(remoteClient)); | 877 | UpdateAllClientsWithGroupInfo(GetRequestingAgentID(remoteClient)); |
817 | } | 878 | } |
818 | 879 | ||
@@ -870,7 +931,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
870 | case 1: | 931 | case 1: |
871 | // Remove | 932 | // Remove |
872 | m_groupData.RemoveAgentFromGroupRole(GetRequestingAgentID(remoteClient), memberID, groupID, roleID); | 933 | m_groupData.RemoveAgentFromGroupRole(GetRequestingAgentID(remoteClient), memberID, groupID, roleID); |
873 | 934 | ||
874 | break; | 935 | break; |
875 | default: | 936 | default: |
876 | m_log.ErrorFormat("[GROUPS]: {0} does not understand changes == {1}", System.Reflection.MethodBase.GetCurrentMethod().Name, changes); | 937 | m_log.ErrorFormat("[GROUPS]: {0} does not understand changes == {1}", System.Reflection.MethodBase.GetCurrentMethod().Name, changes); |
@@ -889,26 +950,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
889 | 950 | ||
890 | if (data != null) | 951 | if (data != null) |
891 | { | 952 | { |
892 | GroupRecord groupInfo = m_groupData.GetGroupRecord(GetRequestingAgentID(remoteClient), data.GroupID, null); | 953 | GridInstantMessage msg = CreateGroupNoticeIM(remoteClient.AgentId, groupNoticeID, (byte)InstantMessageDialog.GroupNoticeRequested); |
893 | |||
894 | GridInstantMessage msg = new GridInstantMessage(); | ||
895 | msg.imSessionID = UUID.Zero.Guid; | ||
896 | msg.fromAgentID = data.GroupID.Guid; | ||
897 | msg.toAgentID = GetRequestingAgentID(remoteClient).Guid; | ||
898 | msg.timestamp = (uint)Util.UnixTimeSinceEpoch(); | ||
899 | msg.fromAgentName = "Group Notice : " + groupInfo == null ? "Unknown" : groupInfo.GroupName; | ||
900 | msg.message = data.noticeData.Subject + "|" + data.Message; | ||
901 | msg.dialog = (byte)OpenMetaverse.InstantMessageDialog.GroupNoticeRequested; | ||
902 | msg.fromGroup = true; | ||
903 | msg.offline = (byte)0; | ||
904 | msg.ParentEstateID = 0; | ||
905 | msg.Position = Vector3.Zero; | ||
906 | msg.RegionID = UUID.Zero.Guid; | ||
907 | msg.binaryBucket = data.BinaryBucket; | ||
908 | 954 | ||
909 | OutgoingInstantMessage(msg, GetRequestingAgentID(remoteClient)); | 955 | OutgoingInstantMessage(msg, GetRequestingAgentID(remoteClient)); |
910 | } | 956 | } |
911 | |||
912 | } | 957 | } |
913 | 958 | ||
914 | public GridInstantMessage CreateGroupNoticeIM(UUID agentID, UUID groupNoticeID, byte dialog) | 959 | public GridInstantMessage CreateGroupNoticeIM(UUID agentID, UUID groupNoticeID, byte dialog) |
@@ -916,10 +961,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
916 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 961 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); |
917 | 962 | ||
918 | GridInstantMessage msg = new GridInstantMessage(); | 963 | GridInstantMessage msg = new GridInstantMessage(); |
919 | msg.imSessionID = UUID.Zero.Guid; | 964 | byte[] bucket; |
965 | |||
966 | msg.imSessionID = groupNoticeID.Guid; | ||
920 | msg.toAgentID = agentID.Guid; | 967 | msg.toAgentID = agentID.Guid; |
921 | msg.dialog = dialog; | 968 | msg.dialog = dialog; |
922 | // msg.dialog = (byte)OpenMetaverse.InstantMessageDialog.GroupNotice; | ||
923 | msg.fromGroup = true; | 969 | msg.fromGroup = true; |
924 | msg.offline = (byte)0; | 970 | msg.offline = (byte)0; |
925 | msg.ParentEstateID = 0; | 971 | msg.ParentEstateID = 0; |
@@ -933,13 +979,38 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
933 | msg.timestamp = info.noticeData.Timestamp; | 979 | msg.timestamp = info.noticeData.Timestamp; |
934 | msg.fromAgentName = info.noticeData.FromName; | 980 | msg.fromAgentName = info.noticeData.FromName; |
935 | msg.message = info.noticeData.Subject + "|" + info.Message; | 981 | msg.message = info.noticeData.Subject + "|" + info.Message; |
936 | msg.binaryBucket = info.BinaryBucket; | 982 | |
983 | if (info.BinaryBucket[0] > 0) | ||
984 | { | ||
985 | //32 is due to not needing space for two of the UUIDs. | ||
986 | //(Don't need UUID of attachment or its owner in IM) | ||
987 | //50 offset gets us to start of attachment name. | ||
988 | //We are skipping the attachment flag, type, and | ||
989 | //the three UUID fields at the start of the bucket. | ||
990 | bucket = new byte[info.BinaryBucket.Length-32]; | ||
991 | bucket[0] = 1; //Has attachment | ||
992 | bucket[1] = info.BinaryBucket[1]; | ||
993 | Array.Copy(info.BinaryBucket, 50, | ||
994 | bucket, 18, info.BinaryBucket.Length-50); | ||
995 | } | ||
996 | else | ||
997 | { | ||
998 | bucket = new byte[19]; | ||
999 | bucket[0] = 0; //No attachment | ||
1000 | bucket[1] = 0; //Attachment type | ||
1001 | bucket[18] = 0; //NUL terminate name | ||
1002 | } | ||
1003 | |||
1004 | info.GroupID.ToBytes(bucket, 2); | ||
1005 | msg.binaryBucket = bucket; | ||
937 | } | 1006 | } |
938 | else | 1007 | else |
939 | { | 1008 | { |
940 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: Group Notice {0} not found, composing empty message.", groupNoticeID); | 1009 | if (m_debugEnabled) |
1010 | m_log.DebugFormat("[GROUPS]: Group Notice {0} not found, composing empty message.", groupNoticeID); | ||
1011 | |||
941 | msg.fromAgentID = UUID.Zero.Guid; | 1012 | msg.fromAgentID = UUID.Zero.Guid; |
942 | msg.timestamp = (uint)Util.UnixTimeSinceEpoch(); ; | 1013 | msg.timestamp = (uint)Util.UnixTimeSinceEpoch(); |
943 | msg.fromAgentName = string.Empty; | 1014 | msg.fromAgentName = string.Empty; |
944 | msg.message = string.Empty; | 1015 | msg.message = string.Empty; |
945 | msg.binaryBucket = new byte[0]; | 1016 | msg.binaryBucket = new byte[0]; |
@@ -1042,7 +1113,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
1042 | 1113 | ||
1043 | // Send Message to Ejectee | 1114 | // Send Message to Ejectee |
1044 | GridInstantMessage msg = new GridInstantMessage(); | 1115 | GridInstantMessage msg = new GridInstantMessage(); |
1045 | 1116 | ||
1046 | msg.imSessionID = UUID.Zero.Guid; | 1117 | msg.imSessionID = UUID.Zero.Guid; |
1047 | msg.fromAgentID = agentID.Guid; | 1118 | msg.fromAgentID = agentID.Guid; |
1048 | // msg.fromAgentID = info.GroupID; | 1119 | // msg.fromAgentID = info.GroupID; |
@@ -1063,7 +1134,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
1063 | // Message to ejector | 1134 | // Message to ejector |
1064 | // Interop, received special 210 code for ejecting a group member | 1135 | // Interop, received special 210 code for ejecting a group member |
1065 | // this only works within the comms servers domain, and won't work hypergrid | 1136 | // this only works within the comms servers domain, and won't work hypergrid |
1066 | // TODO:FIXME: Use a presense server of some kind to find out where the | 1137 | // TODO:FIXME: Use a presense server of some kind to find out where the |
1067 | // client actually is, and try contacting that region directly to notify them, | 1138 | // client actually is, and try contacting that region directly to notify them, |
1068 | // or provide the notification via xmlrpc update queue | 1139 | // or provide the notification via xmlrpc update queue |
1069 | 1140 | ||
@@ -1232,7 +1303,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
1232 | { | 1303 | { |
1233 | if (!membership.ListInProfile) | 1304 | if (!membership.ListInProfile) |
1234 | { | 1305 | { |
1235 | // If we're sending group info to remoteclient about another agent, | 1306 | // If we're sending group info to remoteclient about another agent, |
1236 | // filter out groups the other agent doesn't want to share. | 1307 | // filter out groups the other agent doesn't want to share. |
1237 | continue; | 1308 | continue; |
1238 | } | 1309 | } |
@@ -1269,7 +1340,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
1269 | { | 1340 | { |
1270 | queue.Enqueue(queue.BuildEvent("AgentGroupDataUpdate", llDataStruct), GetRequestingAgentID(remoteClient)); | 1341 | queue.Enqueue(queue.BuildEvent("AgentGroupDataUpdate", llDataStruct), GetRequestingAgentID(remoteClient)); |
1271 | } | 1342 | } |
1272 | |||
1273 | } | 1343 | } |
1274 | 1344 | ||
1275 | private void SendScenePresenceUpdate(UUID AgentID, string Title) | 1345 | private void SendScenePresenceUpdate(UUID AgentID, string Title) |
@@ -1373,7 +1443,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
1373 | membershipArray = membershipData.ToArray(); | 1443 | membershipArray = membershipData.ToArray(); |
1374 | } | 1444 | } |
1375 | } | 1445 | } |
1376 | 1446 | ||
1377 | if (m_debugEnabled) | 1447 | if (m_debugEnabled) |
1378 | { | 1448 | { |
1379 | m_log.InfoFormat("[GROUPS]: Get group membership information for {0} requested by {1}", dataForAgentID, requestingClient.AgentId); | 1449 | m_log.InfoFormat("[GROUPS]: Get group membership information for {0} requested by {1}", dataForAgentID, requestingClient.AgentId); |
@@ -1386,7 +1456,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
1386 | return membershipArray; | 1456 | return membershipArray; |
1387 | } | 1457 | } |
1388 | 1458 | ||
1389 | 1459 | ||
1390 | private void SendAgentDataUpdate(IClientAPI remoteClient, UUID dataForAgentID, UUID activeGroupID, string activeGroupName, ulong activeGroupPowers, string activeGroupTitle) | 1460 | private void SendAgentDataUpdate(IClientAPI remoteClient, UUID dataForAgentID, UUID activeGroupID, string activeGroupName, ulong activeGroupPowers, string activeGroupTitle) |
1391 | { | 1461 | { |
1392 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 1462 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); |