diff options
author | David Walter Seikel | 2016-11-03 21:44:39 +1000 |
---|---|---|
committer | David Walter Seikel | 2016-11-03 21:44:39 +1000 |
commit | 134f86e8d5c414409631b25b8c6f0ee45fbd8631 (patch) | |
tree | 216b89d3fb89acfb81be1e440c25c41ab09fa96d /OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs | |
parent | More changing to production grid. Double oops. (diff) | |
download | opensim-SC-134f86e8d5c414409631b25b8c6f0ee45fbd8631.zip opensim-SC-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.gz opensim-SC-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.bz2 opensim-SC-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.xz |
Initial update to OpenSim 0.8.2.1 source code.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs | 272 |
1 files changed, 182 insertions, 90 deletions
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs index 29f9591..1565da9 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs | |||
@@ -35,10 +35,10 @@ using Nini.Config; | |||
35 | using OpenMetaverse; | 35 | using OpenMetaverse; |
36 | using OpenMetaverse.StructuredData; | 36 | using OpenMetaverse.StructuredData; |
37 | using OpenSim.Framework; | 37 | using OpenSim.Framework; |
38 | using OpenSim.Framework.Communications; | ||
39 | using OpenSim.Region.Framework.Interfaces; | 38 | using OpenSim.Region.Framework.Interfaces; |
40 | using OpenSim.Region.Framework.Scenes; | 39 | using OpenSim.Region.Framework.Scenes; |
41 | using OpenSim.Services.Interfaces; | 40 | using OpenSim.Services.Interfaces; |
41 | using System.Text; | ||
42 | using DirFindFlags = OpenMetaverse.DirectoryManager.DirFindFlags; | 42 | using DirFindFlags = OpenMetaverse.DirectoryManager.DirFindFlags; |
43 | 43 | ||
44 | namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | 44 | namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups |
@@ -76,9 +76,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
76 | 76 | ||
77 | private List<Scene> m_sceneList = new List<Scene>(); | 77 | private List<Scene> m_sceneList = new List<Scene>(); |
78 | 78 | ||
79 | private IMessageTransferModule m_msgTransferModule = null; | 79 | private IMessageTransferModule m_msgTransferModule; |
80 | |||
81 | private IGroupsMessagingModule m_groupsMessagingModule; | ||
80 | 82 | ||
81 | private IGroupsServicesConnector m_groupData = null; | 83 | private IGroupsServicesConnector m_groupData; |
82 | 84 | ||
83 | // Configuration settings | 85 | // Configuration settings |
84 | private bool m_groupsEnabled = false; | 86 | private bool m_groupsEnabled = false; |
@@ -184,10 +186,19 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
184 | if (m_msgTransferModule == null) | 186 | if (m_msgTransferModule == null) |
185 | { | 187 | { |
186 | m_groupsEnabled = false; | 188 | m_groupsEnabled = false; |
187 | m_log.Warn("[GROUPS]: Could not get MessageTransferModule"); | 189 | m_log.Warn("[GROUPS]: Could not get IMessageTransferModule"); |
188 | } | 190 | } |
189 | } | 191 | } |
190 | 192 | ||
193 | if (m_groupsMessagingModule == null) | ||
194 | { | ||
195 | m_groupsMessagingModule = scene.RequestModuleInterface<IGroupsMessagingModule>(); | ||
196 | |||
197 | // No message transfer module, no notices, group invites, rejects, ejects, etc | ||
198 | if (m_groupsMessagingModule == null) | ||
199 | m_log.Warn("[GROUPS]: Could not get IGroupsMessagingModule"); | ||
200 | } | ||
201 | |||
191 | lock (m_sceneList) | 202 | lock (m_sceneList) |
192 | { | 203 | { |
193 | m_sceneList.Add(scene); | 204 | m_sceneList.Add(scene); |
@@ -250,7 +261,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
250 | 261 | ||
251 | client.OnUUIDGroupNameRequest += HandleUUIDGroupNameRequest; | 262 | client.OnUUIDGroupNameRequest += HandleUUIDGroupNameRequest; |
252 | client.OnAgentDataUpdateRequest += OnAgentDataUpdateRequest; | 263 | client.OnAgentDataUpdateRequest += OnAgentDataUpdateRequest; |
253 | client.OnDirFindQuery += OnDirFindQuery; | ||
254 | client.OnRequestAvatarProperties += OnRequestAvatarProperties; | 264 | client.OnRequestAvatarProperties += OnRequestAvatarProperties; |
255 | 265 | ||
256 | // Used for Notices and Group Invites/Accept/Reject | 266 | // Used for Notices and Group Invites/Accept/Reject |
@@ -303,21 +313,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
303 | } | 313 | } |
304 | */ | 314 | */ |
305 | 315 | ||
306 | void OnDirFindQuery(IClientAPI remoteClient, UUID queryID, string queryText, uint queryFlags, int queryStart) | ||
307 | { | ||
308 | if (((DirFindFlags)queryFlags & DirFindFlags.Groups) == DirFindFlags.Groups) | ||
309 | { | ||
310 | if (m_debugEnabled) | ||
311 | m_log.DebugFormat( | ||
312 | "[GROUPS]: {0} called with queryText({1}) queryFlags({2}) queryStart({3})", | ||
313 | System.Reflection.MethodBase.GetCurrentMethod().Name, queryText, (DirFindFlags)queryFlags, queryStart); | ||
314 | |||
315 | // 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()); | ||
317 | } | ||
318 | |||
319 | } | ||
320 | |||
321 | private void OnAgentDataUpdateRequest(IClientAPI remoteClient, UUID dataForAgentID, UUID sessionID) | 316 | private void OnAgentDataUpdateRequest(IClientAPI remoteClient, UUID dataForAgentID, UUID sessionID) |
322 | { | 317 | { |
323 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 318 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); |
@@ -361,7 +356,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
361 | 356 | ||
362 | private void OnInstantMessage(IClientAPI remoteClient, GridInstantMessage im) | 357 | private void OnInstantMessage(IClientAPI remoteClient, GridInstantMessage im) |
363 | { | 358 | { |
364 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 359 | if (m_debugEnabled) |
360 | m_log.DebugFormat( | ||
361 | "[GROUPS]: {0} called for {1}, message type {2}", | ||
362 | System.Reflection.MethodBase.GetCurrentMethod().Name, remoteClient.Name, (InstantMessageDialog)im.dialog); | ||
365 | 363 | ||
366 | // Group invitations | 364 | // Group invitations |
367 | if ((im.dialog == (byte)InstantMessageDialog.GroupInvitationAccept) || (im.dialog == (byte)InstantMessageDialog.GroupInvitationDecline)) | 365 | if ((im.dialog == (byte)InstantMessageDialog.GroupInvitationAccept) || (im.dialog == (byte)InstantMessageDialog.GroupInvitationDecline)) |
@@ -437,81 +435,160 @@ 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(); | ||
456 | |||
457 | //Attempt to get the details of the attached item. | ||
458 | //If sender doesn't own the attachment, the item | ||
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); | ||
457 | 464 | ||
458 | OSDMap binBucketOSD = (OSDMap)OSDParser.DeserializeLLSDXml(binBucket); | 465 | if (item != null) |
459 | |||
460 | foreach (string key in binBucketOSD.Keys) | ||
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 | { |
481 | OnNewGroupNotice(GroupID, NoticeID); | 510 | OnNewGroupNotice(GroupID, NoticeID); |
482 | } | 511 | } |
483 | 512 | ||
484 | // Send notice out to everyone that wants notices | 513 | if (m_debugEnabled) |
485 | foreach (GroupMembersData member in m_groupData.GetGroupMembers(GetRequestingAgentID(remoteClient), GroupID)) | ||
486 | { | 514 | { |
487 | if (m_debugEnabled) | 515 | foreach (GroupMembersData member in m_groupData.GetGroupMembers(GetRequestingAgentID(remoteClient), GroupID)) |
488 | { | 516 | { |
489 | UserAccount targetUser = m_sceneList[0].UserAccountService.GetUserAccount(remoteClient.Scene.RegionInfo.ScopeID, member.AgentID); | 517 | if (m_debugEnabled) |
490 | if (targetUser != null) | ||
491 | { | 518 | { |
492 | m_log.DebugFormat("[GROUPS]: Prepping group notice {0} for agent: {1} who Accepts Notices ({2})", NoticeID, targetUser.FirstName + " " + targetUser.LastName, member.AcceptNotices); | 519 | UserAccount targetUser |
493 | } | 520 | = m_sceneList[0].UserAccountService.GetUserAccount( |
494 | else | 521 | remoteClient.Scene.RegionInfo.ScopeID, member.AgentID); |
495 | { | 522 | |
496 | m_log.DebugFormat("[GROUPS]: Prepping group notice {0} for agent: {1} who Accepts Notices ({2})", NoticeID, member.AgentID, member.AcceptNotices); | 523 | if (targetUser != null) |
524 | { | ||
525 | m_log.DebugFormat( | ||
526 | "[GROUPS]: Prepping group notice {0} for agent: {1} who Accepts Notices ({2})", | ||
527 | NoticeID, targetUser.FirstName + " " + targetUser.LastName, member.AcceptNotices); | ||
528 | } | ||
529 | else | ||
530 | { | ||
531 | m_log.DebugFormat( | ||
532 | "[GROUPS]: Prepping group notice {0} for agent: {1} who Accepts Notices ({2})", | ||
533 | NoticeID, member.AgentID, member.AcceptNotices); | ||
534 | } | ||
497 | } | 535 | } |
498 | } | 536 | } |
537 | } | ||
499 | 538 | ||
500 | if (member.AcceptNotices) | 539 | GridInstantMessage msg |
501 | { | 540 | = CreateGroupNoticeIM(UUID.Zero, NoticeID, (byte)OpenMetaverse.InstantMessageDialog.GroupNotice); |
502 | // Build notice IIM | ||
503 | GridInstantMessage msg = CreateGroupNoticeIM(UUID.Zero, NoticeID, (byte)OpenMetaverse.InstantMessageDialog.GroupNotice); | ||
504 | 541 | ||
505 | msg.toAgentID = member.AgentID.Guid; | 542 | if (m_groupsMessagingModule != null) |
506 | OutgoingInstantMessage(msg, member.AgentID); | 543 | m_groupsMessagingModule.SendMessageToGroup( |
507 | } | 544 | msg, GroupID, remoteClient.AgentId, gmd => gmd.AcceptNotices); |
545 | } | ||
546 | } | ||
547 | |||
548 | if (im.dialog == (byte)InstantMessageDialog.GroupNoticeInventoryAccepted) | ||
549 | { | ||
550 | //Is bucket large enough to hold UUID of the attachment? | ||
551 | if (im.binaryBucket.Length < 16) | ||
552 | return; | ||
553 | |||
554 | UUID noticeID = new UUID(im.imSessionID); | ||
555 | |||
556 | if (m_debugEnabled) | ||
557 | m_log.DebugFormat("[GROUPS]: Requesting notice {0} for {1}", noticeID, remoteClient.AgentId); | ||
558 | |||
559 | GroupNoticeInfo notice = m_groupData.GetGroupNotice(GetRequestingAgentID(remoteClient), noticeID); | ||
560 | if (notice != null) | ||
561 | { | ||
562 | UUID giver = new UUID(notice.BinaryBucket, 18); | ||
563 | UUID attachmentUUID = new UUID(notice.BinaryBucket, 34); | ||
564 | |||
565 | if (m_debugEnabled) | ||
566 | m_log.DebugFormat("[Groups]: Giving inventory from {0} to {1}", giver, remoteClient.AgentId); | ||
567 | |||
568 | string message; | ||
569 | InventoryItemBase itemCopy = ((Scene)(remoteClient.Scene)).GiveInventoryItem(remoteClient.AgentId, | ||
570 | giver, attachmentUUID, out message); | ||
571 | |||
572 | if (itemCopy == null) | ||
573 | { | ||
574 | remoteClient.SendAgentAlertMessage(message, false); | ||
575 | return; | ||
508 | } | 576 | } |
577 | |||
578 | remoteClient.SendInventoryItemCreateUpdate(itemCopy, 0); | ||
579 | } | ||
580 | else | ||
581 | { | ||
582 | if (m_debugEnabled) | ||
583 | m_log.DebugFormat( | ||
584 | "[GROUPS]: Could not find notice {0} for {1} on GroupNoticeInventoryAccepted.", | ||
585 | noticeID, remoteClient.AgentId); | ||
509 | } | 586 | } |
510 | } | 587 | } |
511 | 588 | ||
512 | // Interop, received special 210 code for ejecting a group member | 589 | // Interop, received special 210 code for ejecting a group member |
513 | // this only works within the comms servers domain, and won't work hypergrid | 590 | // 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 | 591 | // TODO:FIXME: Use a presence server of some kind to find out where the |
515 | // client actually is, and try contacting that region directly to notify them, | 592 | // client actually is, and try contacting that region directly to notify them, |
516 | // or provide the notification via xmlrpc update queue | 593 | // or provide the notification via xmlrpc update queue |
517 | if ((im.dialog == 210)) | 594 | if ((im.dialog == 210)) |
@@ -764,7 +841,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
764 | remoteClient.SendCreateGroupReply(UUID.Zero, false, "You have got insufficient funds to create a group."); | 841 | remoteClient.SendCreateGroupReply(UUID.Zero, false, "You have got insufficient funds to create a group."); |
765 | return UUID.Zero; | 842 | return UUID.Zero; |
766 | } | 843 | } |
767 | money.ApplyCharge(GetRequestingAgentID(remoteClient), money.GroupCreationCharge, "Group Creation"); | 844 | money.ApplyCharge(GetRequestingAgentID(remoteClient), money.GroupCreationCharge, MoneyTransactionType.GroupCreate); |
768 | } | 845 | } |
769 | UUID groupID = m_groupData.CreateGroup(GetRequestingAgentID(remoteClient), name, charter, showInList, insigniaID, membershipFee, openEnrollment, allowPublish, maturePublish, GetRequestingAgentID(remoteClient)); | 846 | UUID groupID = m_groupData.CreateGroup(GetRequestingAgentID(remoteClient), name, charter, showInList, insigniaID, membershipFee, openEnrollment, allowPublish, maturePublish, GetRequestingAgentID(remoteClient)); |
770 | 847 | ||
@@ -889,26 +966,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
889 | 966 | ||
890 | if (data != null) | 967 | if (data != null) |
891 | { | 968 | { |
892 | GroupRecord groupInfo = m_groupData.GetGroupRecord(GetRequestingAgentID(remoteClient), data.GroupID, null); | 969 | 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 | 970 | ||
909 | OutgoingInstantMessage(msg, GetRequestingAgentID(remoteClient)); | 971 | OutgoingInstantMessage(msg, GetRequestingAgentID(remoteClient)); |
910 | } | 972 | } |
911 | |||
912 | } | 973 | } |
913 | 974 | ||
914 | public GridInstantMessage CreateGroupNoticeIM(UUID agentID, UUID groupNoticeID, byte dialog) | 975 | public GridInstantMessage CreateGroupNoticeIM(UUID agentID, UUID groupNoticeID, byte dialog) |
@@ -916,10 +977,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
916 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 977 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); |
917 | 978 | ||
918 | GridInstantMessage msg = new GridInstantMessage(); | 979 | GridInstantMessage msg = new GridInstantMessage(); |
919 | msg.imSessionID = UUID.Zero.Guid; | 980 | byte[] bucket; |
981 | |||
982 | msg.imSessionID = groupNoticeID.Guid; | ||
920 | msg.toAgentID = agentID.Guid; | 983 | msg.toAgentID = agentID.Guid; |
921 | msg.dialog = dialog; | 984 | msg.dialog = dialog; |
922 | // msg.dialog = (byte)OpenMetaverse.InstantMessageDialog.GroupNotice; | ||
923 | msg.fromGroup = true; | 985 | msg.fromGroup = true; |
924 | msg.offline = (byte)0; | 986 | msg.offline = (byte)0; |
925 | msg.ParentEstateID = 0; | 987 | msg.ParentEstateID = 0; |
@@ -933,13 +995,38 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
933 | msg.timestamp = info.noticeData.Timestamp; | 995 | msg.timestamp = info.noticeData.Timestamp; |
934 | msg.fromAgentName = info.noticeData.FromName; | 996 | msg.fromAgentName = info.noticeData.FromName; |
935 | msg.message = info.noticeData.Subject + "|" + info.Message; | 997 | msg.message = info.noticeData.Subject + "|" + info.Message; |
936 | msg.binaryBucket = info.BinaryBucket; | 998 | |
999 | if (info.BinaryBucket[0] > 0) | ||
1000 | { | ||
1001 | //32 is due to not needing space for two of the UUIDs. | ||
1002 | //(Don't need UUID of attachment or its owner in IM) | ||
1003 | //50 offset gets us to start of attachment name. | ||
1004 | //We are skipping the attachment flag, type, and | ||
1005 | //the three UUID fields at the start of the bucket. | ||
1006 | bucket = new byte[info.BinaryBucket.Length-32]; | ||
1007 | bucket[0] = 1; //Has attachment | ||
1008 | bucket[1] = info.BinaryBucket[1]; | ||
1009 | Array.Copy(info.BinaryBucket, 50, | ||
1010 | bucket, 18, info.BinaryBucket.Length-50); | ||
1011 | } | ||
1012 | else | ||
1013 | { | ||
1014 | bucket = new byte[19]; | ||
1015 | bucket[0] = 0; //No attachment | ||
1016 | bucket[1] = 0; //Attachment type | ||
1017 | bucket[18] = 0; //NUL terminate name | ||
1018 | } | ||
1019 | |||
1020 | info.GroupID.ToBytes(bucket, 2); | ||
1021 | msg.binaryBucket = bucket; | ||
937 | } | 1022 | } |
938 | else | 1023 | else |
939 | { | 1024 | { |
940 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: Group Notice {0} not found, composing empty message.", groupNoticeID); | 1025 | if (m_debugEnabled) |
1026 | m_log.DebugFormat("[GROUPS]: Group Notice {0} not found, composing empty message.", groupNoticeID); | ||
1027 | |||
941 | msg.fromAgentID = UUID.Zero.Guid; | 1028 | msg.fromAgentID = UUID.Zero.Guid; |
942 | msg.timestamp = (uint)Util.UnixTimeSinceEpoch(); ; | 1029 | msg.timestamp = (uint)Util.UnixTimeSinceEpoch(); |
943 | msg.fromAgentName = string.Empty; | 1030 | msg.fromAgentName = string.Empty; |
944 | msg.message = string.Empty; | 1031 | msg.message = string.Empty; |
945 | msg.binaryBucket = new byte[0]; | 1032 | msg.binaryBucket = new byte[0]; |
@@ -1063,7 +1150,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
1063 | // Message to ejector | 1150 | // Message to ejector |
1064 | // Interop, received special 210 code for ejecting a group member | 1151 | // Interop, received special 210 code for ejecting a group member |
1065 | // this only works within the comms servers domain, and won't work hypergrid | 1152 | // 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 | 1153 | // TODO:FIXME: Use a presence server of some kind to find out where the |
1067 | // client actually is, and try contacting that region directly to notify them, | 1154 | // client actually is, and try contacting that region directly to notify them, |
1068 | // or provide the notification via xmlrpc update queue | 1155 | // or provide the notification via xmlrpc update queue |
1069 | 1156 | ||
@@ -1178,6 +1265,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
1178 | } | 1265 | } |
1179 | } | 1266 | } |
1180 | 1267 | ||
1268 | public List<DirGroupsReplyData> FindGroups(IClientAPI remoteClient, string query) | ||
1269 | { | ||
1270 | return m_groupData.FindGroups(GetRequestingAgentID(remoteClient), query); | ||
1271 | } | ||
1272 | |||
1273 | |||
1181 | #endregion | 1274 | #endregion |
1182 | 1275 | ||
1183 | #region Client/Update Tools | 1276 | #region Client/Update Tools |
@@ -1222,7 +1315,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
1222 | AgentDataMap.Add("AgentID", OSD.FromUUID(dataForAgentID)); | 1315 | AgentDataMap.Add("AgentID", OSD.FromUUID(dataForAgentID)); |
1223 | AgentData.Add(AgentDataMap); | 1316 | AgentData.Add(AgentDataMap); |
1224 | 1317 | ||
1225 | |||
1226 | OSDArray GroupData = new OSDArray(data.Length); | 1318 | OSDArray GroupData = new OSDArray(data.Length); |
1227 | OSDArray NewGroupData = new OSDArray(data.Length); | 1319 | OSDArray NewGroupData = new OSDArray(data.Length); |
1228 | 1320 | ||
@@ -1288,7 +1380,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
1288 | presence.Grouptitle = Title; | 1380 | presence.Grouptitle = Title; |
1289 | 1381 | ||
1290 | if (! presence.IsChildAgent) | 1382 | if (! presence.IsChildAgent) |
1291 | presence.SendAvatarDataToAllAgents(); | 1383 | presence.SendAvatarDataToAllClients(); |
1292 | } | 1384 | } |
1293 | } | 1385 | } |
1294 | } | 1386 | } |