aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Addons/Groups/GroupsModule.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Addons/Groups/GroupsModule.cs404
1 files changed, 193 insertions, 211 deletions
diff --git a/OpenSim/Addons/Groups/GroupsModule.cs b/OpenSim/Addons/Groups/GroupsModule.cs
index d121d1a..5b76e0a 100644
--- a/OpenSim/Addons/Groups/GroupsModule.cs
+++ b/OpenSim/Addons/Groups/GroupsModule.cs
@@ -51,7 +51,7 @@ namespace OpenSim.Groups
51 private List<Scene> m_sceneList = new List<Scene>(); 51 private List<Scene> m_sceneList = new List<Scene>();
52 52
53 private IMessageTransferModule m_msgTransferModule = null; 53 private IMessageTransferModule m_msgTransferModule = null;
54 54
55 private IGroupsServicesConnector m_groupData = null; 55 private IGroupsServicesConnector m_groupData = null;
56 private IUserManagement m_UserManagement; 56 private IUserManagement m_UserManagement;
57 57
@@ -137,13 +137,6 @@ namespace OpenSim.Groups
137 137
138 if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); 138 if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
139 139
140 scene.EventManager.OnNewClient += OnNewClient;
141 scene.EventManager.OnMakeRootAgent += OnMakeRoot;
142 scene.EventManager.OnMakeChildAgent += OnMakeChild;
143 scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage;
144 // The InstantMessageModule itself doesn't do this,
145 // so lets see if things explode if we don't do it
146 // scene.EventManager.OnClientClosed += OnClientClosed;
147 140
148 if (m_groupData == null) 141 if (m_groupData == null)
149 { 142 {
@@ -182,6 +175,11 @@ namespace OpenSim.Groups
182 m_sceneList.Add(scene); 175 m_sceneList.Add(scene);
183 } 176 }
184 177
178 scene.EventManager.OnNewClient += OnNewClient;
179 scene.EventManager.OnMakeRootAgent += OnMakeRoot;
180 scene.EventManager.OnMakeChildAgent += OnMakeChild;
181 scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage;
182 scene.EventManager.OnClientClosed += OnClientClosed;
185 183
186 } 184 }
187 185
@@ -196,6 +194,7 @@ namespace OpenSim.Groups
196 scene.EventManager.OnMakeRootAgent -= OnMakeRoot; 194 scene.EventManager.OnMakeRootAgent -= OnMakeRoot;
197 scene.EventManager.OnMakeChildAgent -= OnMakeChild; 195 scene.EventManager.OnMakeChildAgent -= OnMakeChild;
198 scene.EventManager.OnIncomingInstantMessage -= OnGridInstantMessage; 196 scene.EventManager.OnIncomingInstantMessage -= OnGridInstantMessage;
197 scene.EventManager.OnClientClosed -= OnClientClosed;
199 198
200 lock (m_sceneList) 199 lock (m_sceneList)
201 { 200 {
@@ -211,7 +210,7 @@ namespace OpenSim.Groups
211 if (m_debugEnabled) m_log.Debug("[Groups]: Shutting down Groups module."); 210 if (m_debugEnabled) m_log.Debug("[Groups]: Shutting down Groups module.");
212 } 211 }
213 212
214 public Type ReplaceableInterface 213 public Type ReplaceableInterface
215 { 214 {
216 get { return null; } 215 get { return null; }
217 } 216 }
@@ -237,6 +236,7 @@ namespace OpenSim.Groups
237 client.OnRequestAvatarProperties += OnRequestAvatarProperties; 236 client.OnRequestAvatarProperties += OnRequestAvatarProperties;
238 } 237 }
239 238
239
240 private void OnMakeRoot(ScenePresence sp) 240 private void OnMakeRoot(ScenePresence sp)
241 { 241 {
242 if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); 242 if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
@@ -245,8 +245,12 @@ namespace OpenSim.Groups
245 // Used for Notices and Group Invites/Accept/Reject 245 // Used for Notices and Group Invites/Accept/Reject
246 sp.ControllingClient.OnInstantMessage += OnInstantMessage; 246 sp.ControllingClient.OnInstantMessage += OnInstantMessage;
247 247
248 // Send client their groups information. 248 // Send out group data update for compatibility.
249 SendAgentGroupDataUpdate(sp.ControllingClient, sp.UUID); 249 // There might be some problem with the thread we're generating this on but not
250 // doing the update at this time causes problems (Mantis #7920 and #7915)
251 // TODO: move sending this update to a later time in the rootification of the client.
252 if(!sp.haveGroupInformation)
253 SendAgentGroupDataUpdate(sp.ControllingClient, false);
250 } 254 }
251 255
252 private void OnMakeChild(ScenePresence sp) 256 private void OnMakeChild(ScenePresence sp)
@@ -262,23 +266,28 @@ namespace OpenSim.Groups
262 { 266 {
263 if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); 267 if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
264 268
265 //GroupMembershipData[] avatarGroups = m_groupData.GetAgentGroupMemberships(GetRequestingAgentID(remoteClient), avatarID).ToArray();
266 GroupMembershipData[] avatarGroups = GetProfileListedGroupMemberships(remoteClient, avatarID); 269 GroupMembershipData[] avatarGroups = GetProfileListedGroupMemberships(remoteClient, avatarID);
267 remoteClient.SendAvatarGroupsReply(avatarID, avatarGroups); 270 remoteClient.SendAvatarGroupsReply(avatarID, avatarGroups);
268 } 271 }
269 272
270 /* 273 private void OnClientClosed(UUID AgentId, Scene scene)
271 * This becomes very problematic in a shared module. In a shared module you may have more then one
272 * reference to IClientAPI's, one for 0 or 1 root connections, and 0 or more child connections.
273 * The OnClientClosed event does not provide anything to indicate which one of those should be closed
274 * nor does it provide what scene it was from so that the specific reference can be looked up.
275 * The InstantMessageModule.cs does not currently worry about unregistering the handles,
276 * and it should be an issue, since it's the client that references us not the other way around
277 * , so as long as we don't keep a reference to the client laying around, the client can still be GC'ed
278 private void OnClientClosed(UUID AgentId)
279 { 274 {
280 if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); 275 if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
276 if (scene == null)
277 return;
278
279 ScenePresence sp = scene.GetScenePresence(AgentId);
280 IClientAPI client = sp.ControllingClient;
281 if (client != null)
282 {
283 client.OnAgentDataUpdateRequest -= OnAgentDataUpdateRequest;
284 client.OnRequestAvatarProperties -= OnRequestAvatarProperties;
285 // make child possible not called?
286 client.OnUUIDGroupNameRequest -= HandleUUIDGroupNameRequest;
287 client.OnInstantMessage -= OnInstantMessage;
288 }
281 289
290 /*
282 lock (m_ActiveClients) 291 lock (m_ActiveClients)
283 { 292 {
284 if (m_ActiveClients.ContainsKey(AgentId)) 293 if (m_ActiveClients.ContainsKey(AgentId))
@@ -296,31 +305,22 @@ namespace OpenSim.Groups
296 if (m_debugEnabled) m_log.WarnFormat("[Groups]: Client closed that wasn't registered here."); 305 if (m_debugEnabled) m_log.WarnFormat("[Groups]: Client closed that wasn't registered here.");
297 } 306 }
298 307
299
300 }
301 } 308 }
302 */ 309 */
303 310
311 }
312
304 private void OnAgentDataUpdateRequest(IClientAPI remoteClient, UUID dataForAgentID, UUID sessionID) 313 private void OnAgentDataUpdateRequest(IClientAPI remoteClient, UUID dataForAgentID, UUID sessionID)
305 { 314 {
306 if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); 315 // this a private message for own agent only
307 316 if (dataForAgentID != GetRequestingAgentID(remoteClient))
308 UUID activeGroupID = UUID.Zero; 317 return;
309 string activeGroupTitle = string.Empty;
310 string activeGroupName = string.Empty;
311 ulong activeGroupPowers = (ulong)GroupPowers.None;
312
313 GroupMembershipData membership = m_groupData.GetAgentActiveMembership(GetRequestingAgentIDStr(remoteClient), dataForAgentID.ToString());
314 if (membership != null)
315 {
316 activeGroupID = membership.GroupID;
317 activeGroupTitle = membership.GroupTitle;
318 activeGroupPowers = membership.GroupPowers;
319 }
320 318
321 SendAgentDataUpdate(remoteClient, dataForAgentID, activeGroupID, activeGroupName, activeGroupPowers, activeGroupTitle); 319 SendAgentGroupDataUpdate(remoteClient, false);
322 320
323 SendScenePresenceUpdate(dataForAgentID, activeGroupTitle); 321 // also current viewers do ignore it and ask later on a much nicer thread
322 // its a info request not a change, so nothing is sent to others
323 // they do get the group title with the avatar object update on arrivel to a region
324 } 324 }
325 325
326 private void HandleUUIDGroupNameRequest(UUID GroupID, IClientAPI remoteClient) 326 private void HandleUUIDGroupNameRequest(UUID GroupID, IClientAPI remoteClient)
@@ -394,12 +394,14 @@ namespace OpenSim.Groups
394 msg.binaryBucket = new byte[0]; 394 msg.binaryBucket = new byte[0];
395 395
396 OutgoingInstantMessage(msg, invitee); 396 OutgoingInstantMessage(msg, invitee);
397 397 IClientAPI inviteeClient = GetActiveRootClient(invitee);
398 UpdateAllClientsWithGroupInfo(invitee); 398 if(inviteeClient !=null)
399 {
400 SendAgentGroupDataUpdate(inviteeClient,true);
401 }
399 } 402 }
400 403
401 m_groupData.RemoveAgentToGroupInvite(GetRequestingAgentIDStr(remoteClient), inviteID); 404 m_groupData.RemoveAgentToGroupInvite(GetRequestingAgentIDStr(remoteClient), inviteID);
402
403 } 405 }
404 406
405 // Reject 407 // Reject
@@ -444,17 +446,16 @@ namespace OpenSim.Groups
444 446
445 UUID itemID = binBucketMap["item_id"].AsUUID(); 447 UUID itemID = binBucketMap["item_id"].AsUUID();
446 UUID ownerID = binBucketMap["owner_id"].AsUUID(); 448 UUID ownerID = binBucketMap["owner_id"].AsUUID();
447 item = new InventoryItemBase(itemID, ownerID); 449 item = m_sceneList[0].InventoryService.GetItem(ownerID, itemID);
448 item = m_sceneList[0].InventoryService.GetItem(item);
449 } 450 }
450 else 451 else
451 m_log.DebugFormat("[Groups]: Received OSD with unexpected type: {0}", binBucketOSD.GetType()); 452 m_log.DebugFormat("[Groups]: Received OSD with unexpected type: {0}", binBucketOSD.GetType());
452 } 453 }
453 454
454 if (m_groupData.AddGroupNotice(GetRequestingAgentIDStr(remoteClient), GroupID, NoticeID, im.fromAgentName, Subject, Message, 455 if (m_groupData.AddGroupNotice(GetRequestingAgentIDStr(remoteClient), GroupID, NoticeID, im.fromAgentName, Subject, Message,
455 hasAttachment, 456 hasAttachment,
456 (byte)(item == null ? 0 : item.AssetType), 457 (byte)(item == null ? 0 : item.AssetType),
457 item == null ? null : item.Name, 458 item == null ? null : item.Name,
458 item == null ? UUID.Zero : item.ID, 459 item == null ? UUID.Zero : item.ID,
459 item == null ? UUID.Zero.ToString() : item.Owner.ToString())) 460 item == null ? UUID.Zero.ToString() : item.Owner.ToString()))
460 { 461 {
@@ -463,7 +464,6 @@ namespace OpenSim.Groups
463 OnNewGroupNotice(GroupID, NoticeID); 464 OnNewGroupNotice(GroupID, NoticeID);
464 } 465 }
465 466
466
467 // Send notice out to everyone that wants notices 467 // Send notice out to everyone that wants notices
468 foreach (GroupMembersData member in m_groupData.GetGroupMembers(GetRequestingAgentIDStr(remoteClient), GroupID)) 468 foreach (GroupMembersData member in m_groupData.GetGroupMembers(GetRequestingAgentIDStr(remoteClient), GroupID))
469 { 469 {
@@ -497,7 +497,7 @@ namespace OpenSim.Groups
497 497
498 m_log.DebugFormat("[Groups]: Giving inventory from {0} to {1}", giver, remoteClient.AgentId); 498 m_log.DebugFormat("[Groups]: Giving inventory from {0} to {1}", giver, remoteClient.AgentId);
499 string message; 499 string message;
500 InventoryItemBase itemCopy = ((Scene)(remoteClient.Scene)).GiveInventoryItem(remoteClient.AgentId, 500 InventoryItemBase itemCopy = ((Scene)(remoteClient.Scene)).GiveInventoryItem(remoteClient.AgentId,
501 giver, notice.noticeData.AttachmentItemID, out message); 501 giver, notice.noticeData.AttachmentItemID, out message);
502 502
503 if (itemCopy == null) 503 if (itemCopy == null)
@@ -508,12 +508,11 @@ namespace OpenSim.Groups
508 508
509 remoteClient.SendInventoryItemCreateUpdate(itemCopy, 0); 509 remoteClient.SendInventoryItemCreateUpdate(itemCopy, 0);
510 } 510 }
511
512 } 511 }
513 512
514 // Interop, received special 210 code for ejecting a group member 513 // Interop, received special 210 code for ejecting a group member
515 // this only works within the comms servers domain, and won't work hypergrid 514 // this only works within the comms servers domain, and won't work hypergrid
516 // TODO:FIXME: Use a presense server of some kind to find out where the 515 // TODO:FIXME: Use a presense server of some kind to find out where the
517 // client actually is, and try contacting that region directly to notify them, 516 // client actually is, and try contacting that region directly to notify them,
518 // or provide the notification via xmlrpc update queue 517 // or provide the notification via xmlrpc update queue
519 if ((im.dialog == 210)) 518 if ((im.dialog == 210))
@@ -524,14 +523,16 @@ namespace OpenSim.Groups
524 523
525 UUID ejecteeID = new UUID(im.toAgentID); 524 UUID ejecteeID = new UUID(im.toAgentID);
526 525
526 im.imSessionID = UUID.Zero.Guid;
527 im.dialog = (byte)InstantMessageDialog.MessageFromAgent; 527 im.dialog = (byte)InstantMessageDialog.MessageFromAgent;
528 OutgoingInstantMessage(im, ejecteeID); 528 OutgoingInstantMessage(im, ejecteeID);
529 529
530 IClientAPI ejectee = GetActiveClient(ejecteeID); 530 IClientAPI ejectee = GetActiveRootClient(ejecteeID);
531 if (ejectee != null) 531 if (ejectee != null)
532 { 532 {
533 UUID groupID = new UUID(im.imSessionID); 533 UUID groupID = new UUID(im.imSessionID);
534 ejectee.SendAgentDropGroup(groupID); 534 ejectee.SendAgentDropGroup(groupID);
535 SendAgentGroupDataUpdate(ejectee,true);
535 } 536 }
536 } 537 }
537 } 538 }
@@ -551,7 +552,7 @@ namespace OpenSim.Groups
551 case (byte)InstantMessageDialog.GroupInvitation: 552 case (byte)InstantMessageDialog.GroupInvitation:
552 case (byte)InstantMessageDialog.GroupNotice: 553 case (byte)InstantMessageDialog.GroupNotice:
553 UUID toAgentID = new UUID(msg.toAgentID); 554 UUID toAgentID = new UUID(msg.toAgentID);
554 IClientAPI localClient = GetActiveClient(toAgentID); 555 IClientAPI localClient = GetActiveRootClient(toAgentID);
555 if (localClient != null) 556 if (localClient != null)
556 { 557 {
557 localClient.SendInstantMessage(msg); 558 localClient.SendInstantMessage(msg);
@@ -576,7 +577,7 @@ namespace OpenSim.Groups
576 { 577 {
577 return m_groupData.GetGroupRecord(UUID.Zero.ToString(), UUID.Zero, name); 578 return m_groupData.GetGroupRecord(UUID.Zero.ToString(), UUID.Zero, name);
578 } 579 }
579 580
580 public void ActivateGroup(IClientAPI remoteClient, UUID groupID) 581 public void ActivateGroup(IClientAPI remoteClient, UUID groupID)
581 { 582 {
582 if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); 583 if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
@@ -584,10 +585,10 @@ namespace OpenSim.Groups
584 m_groupData.SetAgentActiveGroup(GetRequestingAgentIDStr(remoteClient), GetRequestingAgentIDStr(remoteClient), groupID); 585 m_groupData.SetAgentActiveGroup(GetRequestingAgentIDStr(remoteClient), GetRequestingAgentIDStr(remoteClient), groupID);
585 586
586 // Changing active group changes title, active powers, all kinds of things 587 // Changing active group changes title, active powers, all kinds of things
587 // anyone who is in any region that can see this client, should probably be 588 // anyone who is in any region that can see this client, should probably be
588 // updated with new group info. At a minimum, they should get ScenePresence 589 // updated with new group info. At a minimum, they should get ScenePresence
589 // updated with new title. 590 // updated with new title.
590 UpdateAllClientsWithGroupInfo(remoteClient.AgentId); 591 SendAgentGroupDataUpdate(remoteClient, true);
591 } 592 }
592 593
593 /// <summary> 594 /// <summary>
@@ -619,10 +620,10 @@ namespace OpenSim.Groups
619 620
620 public List<GroupMembersData> GroupMembersRequest(IClientAPI remoteClient, UUID groupID) 621 public List<GroupMembersData> GroupMembersRequest(IClientAPI remoteClient, UUID groupID)
621 { 622 {
622 if (m_debugEnabled) 623 if (m_debugEnabled)
623 m_log.DebugFormat( 624 m_log.DebugFormat(
624 "[Groups]: GroupMembersRequest called for {0} from client {1}", groupID, remoteClient.Name); 625 "[Groups]: GroupMembersRequest called for {0} from client {1}", groupID, remoteClient.Name);
625 626
626 List<GroupMembersData> data = m_groupData.GetGroupMembers(GetRequestingAgentIDStr(remoteClient), groupID); 627 List<GroupMembersData> data = m_groupData.GetGroupMembers(GetRequestingAgentIDStr(remoteClient), groupID);
627 628
628 if (m_debugEnabled) 629 if (m_debugEnabled)
@@ -634,7 +635,6 @@ namespace OpenSim.Groups
634 } 635 }
635 636
636 return data; 637 return data;
637
638 } 638 }
639 639
640 public List<GroupRolesData> GroupRoleDataRequest(IClientAPI remoteClient, UUID groupID) 640 public List<GroupRolesData> GroupRoleDataRequest(IClientAPI remoteClient, UUID groupID)
@@ -706,7 +706,7 @@ namespace OpenSim.Groups
706 706
707 public GroupMembershipData GetMembershipData(UUID groupID, UUID agentID) 707 public GroupMembershipData GetMembershipData(UUID groupID, UUID agentID)
708 { 708 {
709 if (m_debugEnabled) 709 if (m_debugEnabled)
710 m_log.DebugFormat( 710 m_log.DebugFormat(
711 "[Groups]: {0} called with groupID={1}, agentID={2}", 711 "[Groups]: {0} called with groupID={1}, agentID={2}",
712 System.Reflection.MethodBase.GetCurrentMethod().Name, groupID, agentID); 712 System.Reflection.MethodBase.GetCurrentMethod().Name, groupID, agentID);
@@ -714,6 +714,12 @@ namespace OpenSim.Groups
714 return m_groupData.GetAgentGroupMembership(UUID.Zero.ToString(), agentID.ToString(), groupID); 714 return m_groupData.GetAgentGroupMembership(UUID.Zero.ToString(), agentID.ToString(), groupID);
715 } 715 }
716 716
717 public GroupMembershipData GetActiveMembershipData(UUID agentID)
718 {
719 string agentIDstr = agentID.ToString();
720 return m_groupData.GetAgentActiveMembership(agentIDstr, agentIDstr);
721 }
722
717 public void UpdateGroupInfo(IClientAPI remoteClient, UUID groupID, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, bool allowPublish, bool maturePublish) 723 public void UpdateGroupInfo(IClientAPI remoteClient, UUID groupID, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, bool allowPublish, bool maturePublish)
718 { 724 {
719 if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); 725 if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
@@ -750,7 +756,7 @@ namespace OpenSim.Groups
750 756
751 if (avatar != null) 757 if (avatar != null)
752 { 758 {
753 if (avatar.UserLevel < m_levelGroupCreate) 759 if (avatar.GodController.UserLevel < m_levelGroupCreate)
754 { 760 {
755 remoteClient.SendCreateGroupReply(UUID.Zero, false, String.Format("Insufficient permissions to create a group. Requires level {0}", m_levelGroupCreate)); 761 remoteClient.SendCreateGroupReply(UUID.Zero, false, String.Format("Insufficient permissions to create a group. Requires level {0}", m_levelGroupCreate));
756 return UUID.Zero; 762 return UUID.Zero;
@@ -758,7 +764,7 @@ namespace OpenSim.Groups
758 } 764 }
759 765
760 // check funds 766 // check funds
761 // is there is a money module present ? 767 // is there a money module present ?
762 IMoneyModule money = scene.RequestModuleInterface<IMoneyModule>(); 768 IMoneyModule money = scene.RequestModuleInterface<IMoneyModule>();
763 if (money != null) 769 if (money != null)
764 { 770 {
@@ -770,18 +776,18 @@ namespace OpenSim.Groups
770 } 776 }
771 777
772 string reason = string.Empty; 778 string reason = string.Empty;
773 UUID groupID = m_groupData.CreateGroup(remoteClient.AgentId, name, charter, showInList, insigniaID, membershipFee, openEnrollment, 779 UUID groupID = m_groupData.CreateGroup(remoteClient.AgentId, name, charter, showInList, insigniaID, membershipFee, openEnrollment,
774 allowPublish, maturePublish, remoteClient.AgentId, out reason); 780 allowPublish, maturePublish, remoteClient.AgentId, out reason);
775 781
776 if (groupID != UUID.Zero) 782 if (groupID != UUID.Zero)
777 { 783 {
778 if (money != null) 784 if (money != null && money.GroupCreationCharge > 0)
779 money.ApplyCharge(remoteClient.AgentId, money.GroupCreationCharge, MoneyTransactionType.GroupCreate); 785 money.ApplyCharge(remoteClient.AgentId, money.GroupCreationCharge, MoneyTransactionType.GroupCreate, name);
780 786
781 remoteClient.SendCreateGroupReply(groupID, true, "Group created successfullly"); 787 remoteClient.SendCreateGroupReply(groupID, true, "Group created successfully");
782 788
783 // Update the founder with new group information. 789 // Update the founder with new group information.
784 SendAgentGroupDataUpdate(remoteClient, GetRequestingAgentID(remoteClient)); 790 SendAgentGroupDataUpdate(remoteClient, true);
785 } 791 }
786 else 792 else
787 remoteClient.SendCreateGroupReply(groupID, false, reason); 793 remoteClient.SendCreateGroupReply(groupID, false, reason);
@@ -817,7 +823,7 @@ namespace OpenSim.Groups
817 if (membership != null) 823 if (membership != null)
818 { 824 {
819 return membership.GroupTitle; 825 return membership.GroupTitle;
820 } 826 }
821 return string.Empty; 827 return string.Empty;
822 } 828 }
823 829
@@ -833,8 +839,8 @@ namespace OpenSim.Groups
833 // TODO: Not sure what all is needed here, but if the active group role change is for the group 839 // TODO: Not sure what all is needed here, but if the active group role change is for the group
834 // the client currently has set active, then we need to do a scene presence update too 840 // the client currently has set active, then we need to do a scene presence update too
835 // if (m_groupData.GetAgentActiveMembership(GetRequestingAgentID(remoteClient)).GroupID == GroupID) 841 // if (m_groupData.GetAgentActiveMembership(GetRequestingAgentID(remoteClient)).GroupID == GroupID)
836 842
837 UpdateAllClientsWithGroupInfo(GetRequestingAgentID(remoteClient)); 843 SendDataUpdate(remoteClient, true);
838 } 844 }
839 845
840 846
@@ -875,7 +881,7 @@ namespace OpenSim.Groups
875 } 881 }
876 882
877 // TODO: This update really should send out updates for everyone in the role that just got changed. 883 // TODO: This update really should send out updates for everyone in the role that just got changed.
878 SendAgentGroupDataUpdate(remoteClient, GetRequestingAgentID(remoteClient)); 884 SendDataUpdate(remoteClient, true);
879 } 885 }
880 886
881 public void GroupRoleChanges(IClientAPI remoteClient, UUID groupID, UUID roleID, UUID memberID, uint changes) 887 public void GroupRoleChanges(IClientAPI remoteClient, UUID groupID, UUID roleID, UUID memberID, uint changes)
@@ -893,7 +899,7 @@ namespace OpenSim.Groups
893 case 1: 899 case 1:
894 // Remove 900 // Remove
895 m_groupData.RemoveAgentFromGroupRole(GetRequestingAgentIDStr(remoteClient), memberID.ToString(), groupID, roleID); 901 m_groupData.RemoveAgentFromGroupRole(GetRequestingAgentIDStr(remoteClient), memberID.ToString(), groupID, roleID);
896 902
897 break; 903 break;
898 default: 904 default:
899 m_log.ErrorFormat("[Groups]: {0} does not understand changes == {1}", System.Reflection.MethodBase.GetCurrentMethod().Name, changes); 905 m_log.ErrorFormat("[Groups]: {0} does not understand changes == {1}", System.Reflection.MethodBase.GetCurrentMethod().Name, changes);
@@ -901,7 +907,7 @@ namespace OpenSim.Groups
901 } 907 }
902 908
903 // TODO: This update really should send out updates for everyone in the role that just got changed. 909 // TODO: This update really should send out updates for everyone in the role that just got changed.
904 SendAgentGroupDataUpdate(remoteClient, GetRequestingAgentID(remoteClient)); 910 SendDataUpdate(remoteClient, true);
905 } 911 }
906 912
907 public void GroupNoticeRequest(IClientAPI remoteClient, UUID groupNoticeID) 913 public void GroupNoticeRequest(IClientAPI remoteClient, UUID groupNoticeID)
@@ -969,27 +975,37 @@ namespace OpenSim.Groups
969 return msg; 975 return msg;
970 } 976 }
971 977
972 public void SendAgentGroupDataUpdate(IClientAPI remoteClient) 978 public void JoinGroupRequest(IClientAPI remoteClient, UUID groupID)
973 { 979 {
974 if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); 980 if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
975 981
976 // Send agent information about his groups 982 GroupRecord groupRecord = GetGroupRecord(groupID);
977 SendAgentGroupDataUpdate(remoteClient, GetRequestingAgentID(remoteClient)); 983 IMoneyModule money = remoteClient.Scene.RequestModuleInterface<IMoneyModule>();
978 }
979 984
980 public void JoinGroupRequest(IClientAPI remoteClient, UUID groupID) 985 // Should check to see if there's an outstanding invitation
981 { 986
982 if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); 987 if (money != null && groupRecord.MembershipFee > 0)
988 {
989 // Does the agent have the funds to cover the group join fee?
990 if (!money.AmountCovered(remoteClient.AgentId, groupRecord.MembershipFee))
991 {
992 remoteClient.SendAlertMessage("Insufficient funds to join the group.");
993 remoteClient.SendJoinGroupReply(groupID, false);
994 return;
995 }
996 }
983 997
984 string reason = string.Empty; 998 string reason = string.Empty;
985 // Should check to see if OpenEnrollment, or if there's an outstanding invitation 999
986 if (m_groupData.AddAgentToGroup(GetRequestingAgentIDStr(remoteClient), GetRequestingAgentIDStr(remoteClient), groupID, UUID.Zero, string.Empty, out reason)) 1000 if (m_groupData.AddAgentToGroup(GetRequestingAgentIDStr(remoteClient), GetRequestingAgentIDStr(remoteClient), groupID, UUID.Zero, string.Empty, out reason))
987 { 1001 {
1002 if (money != null && groupRecord.MembershipFee > 0)
1003 money.ApplyCharge(remoteClient.AgentId, groupRecord.MembershipFee, MoneyTransactionType.GroupJoin, groupRecord.GroupName);
988 1004
989 remoteClient.SendJoinGroupReply(groupID, true); 1005 remoteClient.SendJoinGroupReply(groupID, true);
990 1006
991 // Should this send updates to everyone in the group? 1007 // Should this send updates to everyone in the group?
992 SendAgentGroupDataUpdate(remoteClient, GetRequestingAgentID(remoteClient)); 1008 SendAgentGroupDataUpdate(remoteClient, true);
993 1009
994 if (reason != string.Empty) 1010 if (reason != string.Empty)
995 // A warning 1011 // A warning
@@ -1011,7 +1027,7 @@ namespace OpenSim.Groups
1011 1027
1012 // SL sends out notifcations to the group messaging session that the person has left 1028 // SL sends out notifcations to the group messaging session that the person has left
1013 // Should this also update everyone who is in the group? 1029 // Should this also update everyone who is in the group?
1014 SendAgentGroupDataUpdate(remoteClient, GetRequestingAgentID(remoteClient)); 1030 SendAgentGroupDataUpdate(remoteClient, true);
1015 } 1031 }
1016 1032
1017 public void EjectGroupMemberRequest(IClientAPI remoteClient, UUID groupID, UUID ejecteeID) 1033 public void EjectGroupMemberRequest(IClientAPI remoteClient, UUID groupID, UUID ejecteeID)
@@ -1070,10 +1086,31 @@ namespace OpenSim.Groups
1070 return; 1086 return;
1071 } 1087 }
1072 1088
1089 IClientAPI ejecteeClient = GetActiveRootClient(ejecteeID);
1090
1073 // Send Message to Ejectee 1091 // Send Message to Ejectee
1074 GridInstantMessage msg = new GridInstantMessage(); 1092 GridInstantMessage msg = new GridInstantMessage();
1075 1093
1076 msg.imSessionID = UUID.Zero.Guid; 1094 // if local send a normal message
1095 if(ejecteeClient != null)
1096 {
1097 msg.imSessionID = UUID.Zero.Guid;
1098 msg.dialog = (byte)OpenMetaverse.InstantMessageDialog.MessageFromAgent;
1099 // also execute and send update
1100 ejecteeClient.SendAgentDropGroup(groupID);
1101 SendAgentGroupDataUpdate(ejecteeClient,true);
1102 }
1103 else // send
1104 {
1105 // Interop, received special 210 code for ejecting a group member
1106 // this only works within the comms servers domain, and won't work hypergrid
1107 // TODO:FIXME: Use a presence server of some kind to find out where the
1108 // client actually is, and try contacting that region directly to notify them,
1109 // or provide the notification via xmlrpc update queue
1110
1111 msg.imSessionID = groupInfo.GroupID.Guid;
1112 msg.dialog = (byte)210; //interop
1113 }
1077 msg.fromAgentID = agentID.Guid; 1114 msg.fromAgentID = agentID.Guid;
1078 // msg.fromAgentID = info.GroupID; 1115 // msg.fromAgentID = info.GroupID;
1079 msg.toAgentID = ejecteeID.Guid; 1116 msg.toAgentID = ejecteeID.Guid;
@@ -1081,7 +1118,7 @@ namespace OpenSim.Groups
1081 msg.timestamp = 0; 1118 msg.timestamp = 0;
1082 msg.fromAgentName = agentName; 1119 msg.fromAgentName = agentName;
1083 msg.message = string.Format("You have been ejected from '{1}' by {0}.", agentName, groupInfo.GroupName); 1120 msg.message = string.Format("You have been ejected from '{1}' by {0}.", agentName, groupInfo.GroupName);
1084 msg.dialog = (byte)OpenMetaverse.InstantMessageDialog.MessageFromAgent; 1121
1085 msg.fromGroup = false; 1122 msg.fromGroup = false;
1086 msg.offline = (byte)0; 1123 msg.offline = (byte)0;
1087 msg.ParentEstateID = 0; 1124 msg.ParentEstateID = 0;
@@ -1091,11 +1128,7 @@ namespace OpenSim.Groups
1091 OutgoingInstantMessage(msg, ejecteeID); 1128 OutgoingInstantMessage(msg, ejecteeID);
1092 1129
1093 // Message to ejector 1130 // Message to ejector
1094 // Interop, received special 210 code for ejecting a group member 1131
1095 // this only works within the comms servers domain, and won't work hypergrid
1096 // TODO:FIXME: Use a presense server of some kind to find out where the
1097 // client actually is, and try contacting that region directly to notify them,
1098 // or provide the notification via xmlrpc update queue
1099 1132
1100 msg = new GridInstantMessage(); 1133 msg = new GridInstantMessage();
1101 msg.imSessionID = UUID.Zero.Guid; 1134 msg.imSessionID = UUID.Zero.Guid;
@@ -1111,7 +1144,7 @@ namespace OpenSim.Groups
1111 { 1144 {
1112 msg.message = string.Format("{2} has been ejected from '{1}' by {0}.", agentName, groupInfo.GroupName, "Unknown member"); 1145 msg.message = string.Format("{2} has been ejected from '{1}' by {0}.", agentName, groupInfo.GroupName, "Unknown member");
1113 } 1146 }
1114 msg.dialog = (byte)210; //interop 1147 msg.dialog = (byte)OpenMetaverse.InstantMessageDialog.MessageFromAgent;
1115 msg.fromGroup = false; 1148 msg.fromGroup = false;
1116 msg.offline = (byte)0; 1149 msg.offline = (byte)0;
1117 msg.ParentEstateID = 0; 1150 msg.ParentEstateID = 0;
@@ -1119,11 +1152,6 @@ namespace OpenSim.Groups
1119 msg.RegionID = regionInfo.RegionID.Guid; 1152 msg.RegionID = regionInfo.RegionID.Guid;
1120 msg.binaryBucket = new byte[0]; 1153 msg.binaryBucket = new byte[0];
1121 OutgoingInstantMessage(msg, agentID); 1154 OutgoingInstantMessage(msg, agentID);
1122
1123
1124 // SL sends out messages to everyone in the group
1125 // Who all should receive updates and what should they be updated with?
1126 UpdateAllClientsWithGroupInfo(ejecteeID);
1127 } 1155 }
1128 1156
1129 public void InviteGroupRequest(IClientAPI remoteClient, UUID groupID, UUID invitedAgentID, UUID roleID) 1157 public void InviteGroupRequest(IClientAPI remoteClient, UUID groupID, UUID invitedAgentID, UUID roleID)
@@ -1186,6 +1214,18 @@ namespace OpenSim.Groups
1186 #endregion 1214 #endregion
1187 1215
1188 #region Client/Update Tools 1216 #region Client/Update Tools
1217 private IClientAPI GetActiveRootClient(UUID agentID)
1218 {
1219 foreach (Scene scene in m_sceneList)
1220 {
1221 ScenePresence sp = scene.GetScenePresence(agentID);
1222 if (sp != null && !sp.IsChildAgent && !sp.IsDeleted)
1223 {
1224 return sp.ControllingClient;
1225 }
1226 }
1227 return null;
1228 }
1189 1229
1190 /// <summary> 1230 /// <summary>
1191 /// Try to find an active IClientAPI reference for agentID giving preference to root connections 1231 /// Try to find an active IClientAPI reference for agentID giving preference to root connections
@@ -1198,7 +1238,7 @@ namespace OpenSim.Groups
1198 foreach (Scene scene in m_sceneList) 1238 foreach (Scene scene in m_sceneList)
1199 { 1239 {
1200 ScenePresence sp = scene.GetScenePresence(agentID); 1240 ScenePresence sp = scene.GetScenePresence(agentID);
1201 if (sp != null) 1241 if (sp != null&& !sp.IsDeleted)
1202 { 1242 {
1203 if (!sp.IsChildAgent) 1243 if (!sp.IsChildAgent)
1204 { 1244 {
@@ -1215,71 +1255,6 @@ namespace OpenSim.Groups
1215 return child; 1255 return child;
1216 } 1256 }
1217 1257
1218 /// <summary>
1219 /// Send 'remoteClient' the group membership 'data' for agent 'dataForAgentID'.
1220 /// </summary>
1221 private void SendGroupMembershipInfoViaCaps(IClientAPI remoteClient, UUID dataForAgentID, GroupMembershipData[] data)
1222 {
1223 if (m_debugEnabled) m_log.InfoFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
1224
1225 // NPCs currently don't have a CAPs structure or event queues. There is a strong argument for conveying this information
1226 // to them anyway since it makes writing server-side bots a lot easier, but for now we don't do anything.
1227 if (remoteClient.SceneAgent.PresenceType == PresenceType.Npc)
1228 return;
1229
1230 OSDArray AgentData = new OSDArray(1);
1231 OSDMap AgentDataMap = new OSDMap(1);
1232 AgentDataMap.Add("AgentID", OSD.FromUUID(dataForAgentID));
1233 AgentData.Add(AgentDataMap);
1234
1235 OSDArray GroupData = new OSDArray(data.Length);
1236 OSDArray NewGroupData = new OSDArray(data.Length);
1237
1238 foreach (GroupMembershipData membership in data)
1239 {
1240 if (GetRequestingAgentID(remoteClient) != dataForAgentID)
1241 {
1242 if (!membership.ListInProfile)
1243 {
1244 // If we're sending group info to remoteclient about another agent,
1245 // filter out groups the other agent doesn't want to share.
1246 continue;
1247 }
1248 }
1249
1250 OSDMap GroupDataMap = new OSDMap(6);
1251 OSDMap NewGroupDataMap = new OSDMap(1);
1252
1253 GroupDataMap.Add("GroupID", OSD.FromUUID(membership.GroupID));
1254 GroupDataMap.Add("GroupPowers", OSD.FromULong(membership.GroupPowers));
1255 GroupDataMap.Add("AcceptNotices", OSD.FromBoolean(membership.AcceptNotices));
1256 GroupDataMap.Add("GroupInsigniaID", OSD.FromUUID(membership.GroupPicture));
1257 GroupDataMap.Add("Contribution", OSD.FromInteger(membership.Contribution));
1258 GroupDataMap.Add("GroupName", OSD.FromString(membership.GroupName));
1259 NewGroupDataMap.Add("ListInProfile", OSD.FromBoolean(membership.ListInProfile));
1260
1261 GroupData.Add(GroupDataMap);
1262 NewGroupData.Add(NewGroupDataMap);
1263 }
1264
1265 OSDMap llDataStruct = new OSDMap(3);
1266 llDataStruct.Add("AgentData", AgentData);
1267 llDataStruct.Add("GroupData", GroupData);
1268 llDataStruct.Add("NewGroupData", NewGroupData);
1269
1270 if (m_debugEnabled)
1271 {
1272 m_log.InfoFormat("[Groups]: {0}", OSDParser.SerializeJsonString(llDataStruct));
1273 }
1274
1275 IEventQueue queue = remoteClient.Scene.RequestModuleInterface<IEventQueue>();
1276
1277 if (queue != null)
1278 {
1279 queue.Enqueue(queue.BuildEvent("AgentGroupDataUpdate", llDataStruct), GetRequestingAgentID(remoteClient));
1280 }
1281 }
1282
1283 private void SendScenePresenceUpdate(UUID AgentID, string Title) 1258 private void SendScenePresenceUpdate(UUID AgentID, string Title)
1284 { 1259 {
1285 if (m_debugEnabled) m_log.DebugFormat("[Groups]: Updating scene title for {0} with title: {1}", AgentID, Title); 1260 if (m_debugEnabled) m_log.DebugFormat("[Groups]: Updating scene title for {0} with title: {1}", AgentID, Title);
@@ -1296,53 +1271,39 @@ namespace OpenSim.Groups
1296 presence.Grouptitle = Title; 1271 presence.Grouptitle = Title;
1297 1272
1298 if (! presence.IsChildAgent) 1273 if (! presence.IsChildAgent)
1299 presence.SendAvatarDataToAllClients(); 1274 presence.SendAvatarDataToAllAgents();
1300 } 1275 }
1301 } 1276 }
1302 } 1277 }
1303 } 1278 }
1304 1279
1305 /// <summary> 1280 public void SendAgentGroupDataUpdate(IClientAPI remoteClient)
1306 /// Send updates to all clients who might be interested in groups data for dataForClientID
1307 /// </summary>
1308 private void UpdateAllClientsWithGroupInfo(UUID dataForClientID)
1309 { 1281 {
1310 if (m_debugEnabled) m_log.InfoFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); 1282 SendAgentGroupDataUpdate(remoteClient, true);
1311
1312 // TODO: Probably isn't nessesary to update every client in every scene.
1313 // Need to examine client updates and do only what's nessesary.
1314 lock (m_sceneList)
1315 {
1316 foreach (Scene scene in m_sceneList)
1317 {
1318 scene.ForEachClient(delegate(IClientAPI client) { SendAgentGroupDataUpdate(client, dataForClientID); });
1319 }
1320 }
1321 } 1283 }
1322 1284
1323 /// <summary> 1285 /// <summary>
1324 /// Update remoteClient with group information about dataForAgentID 1286 /// Tell remoteClient about its agent groups, and optionally send title to others
1325 /// </summary> 1287 /// </summary>
1326 private void SendAgentGroupDataUpdate(IClientAPI remoteClient, UUID dataForAgentID) 1288 private void SendAgentGroupDataUpdate(IClientAPI remoteClient, bool tellOthers)
1327 { 1289 {
1328 if (m_debugEnabled) m_log.InfoFormat("[Groups]: {0} called for {1}", System.Reflection.MethodBase.GetCurrentMethod().Name, remoteClient.Name); 1290 if (m_debugEnabled) m_log.InfoFormat("[Groups]: {0} called for {1}", System.Reflection.MethodBase.GetCurrentMethod().Name, remoteClient.Name);
1329 1291
1292 // NPCs currently don't have a CAPs structure or event queues. There is a strong argument for conveying this information
1293 // to them anyway since it makes writing server-side bots a lot easier, but for now we don't do anything.
1294 if (remoteClient.SceneAgent.PresenceType == PresenceType.Npc)
1295 return;
1296
1330 // TODO: All the client update functions need to be reexamined because most do too much and send too much stuff 1297 // TODO: All the client update functions need to be reexamined because most do too much and send too much stuff
1331 1298
1332 OnAgentDataUpdateRequest(remoteClient, dataForAgentID, UUID.Zero); 1299 UUID agentID = GetRequestingAgentID(remoteClient);
1333 1300
1334 // Need to send a group membership update to the client 1301 SendDataUpdate(remoteClient, tellOthers);
1335 // UDP version doesn't seem to behave nicely. But we're going to send it out here
1336 // with an empty group membership to hopefully remove groups being displayed due
1337 // to the core Groups Stub
1338 //remoteClient.SendGroupMembership(new GroupMembershipData[0]);
1339 1302
1340 GroupMembershipData[] membershipArray = GetProfileListedGroupMemberships(remoteClient, dataForAgentID); 1303 GroupMembershipData[] membershipArray = GetProfileListedGroupMemberships(remoteClient, agentID);
1341 SendGroupMembershipInfoViaCaps(remoteClient, dataForAgentID, membershipArray);
1342 1304
1343 //remoteClient.SendAvatarGroupsReply(dataForAgentID, membershipArray); 1305 remoteClient.UpdateGroupMembership(membershipArray);
1344 if (remoteClient.AgentId == dataForAgentID) 1306 remoteClient.SendAgentGroupDataUpdate(agentID, membershipArray);
1345 remoteClient.RefreshGroupMembership();
1346 } 1307 }
1347 1308
1348 /// <summary> 1309 /// <summary>
@@ -1381,7 +1342,7 @@ namespace OpenSim.Groups
1381 membershipArray = membershipData.ToArray(); 1342 membershipArray = membershipData.ToArray();
1382 } 1343 }
1383 } 1344 }
1384 1345
1385 if (m_debugEnabled) 1346 if (m_debugEnabled)
1386 { 1347 {
1387 m_log.InfoFormat("[Groups]: Get group membership information for {0} requested by {1}", dataForAgentID, requestingClient.AgentId); 1348 m_log.InfoFormat("[Groups]: Get group membership information for {0} requested by {1}", dataForAgentID, requestingClient.AgentId);
@@ -1394,27 +1355,49 @@ namespace OpenSim.Groups
1394 return membershipArray; 1355 return membershipArray;
1395 } 1356 }
1396 1357
1397 1358 //tell remoteClient about its agent group info, and optionally send title to others
1398 private void SendAgentDataUpdate(IClientAPI remoteClient, UUID dataForAgentID, UUID activeGroupID, string activeGroupName, ulong activeGroupPowers, string activeGroupTitle) 1359 private void SendDataUpdate(IClientAPI remoteClient, bool tellOthers)
1399 { 1360 {
1400 if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); 1361 if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
1401 1362
1402 // TODO: All the client update functions need to be reexamined because most do too much and send too much stuff 1363 UUID activeGroupID = UUID.Zero;
1403 string firstname = "Unknown", lastname = "Unknown"; 1364 string activeGroupTitle = string.Empty;
1404 string name = m_UserManagement.GetUserName(dataForAgentID); 1365 string activeGroupName = string.Empty;
1405 if (!string.IsNullOrEmpty(name)) 1366 ulong activeGroupPowers = (ulong)GroupPowers.None;
1367
1368 UUID agentID = GetRequestingAgentID(remoteClient);
1369 GroupMembershipData membership = m_groupData.GetAgentActiveMembership(agentID.ToString(), agentID.ToString());
1370 if (membership != null)
1406 { 1371 {
1407 string[] parts = name.Split(new char[] { ' ' }); 1372 activeGroupID = membership.GroupID;
1408 if (parts.Length >= 2) 1373 activeGroupTitle = membership.GroupTitle;
1409 { 1374 activeGroupPowers = membership.GroupPowers;
1410 firstname = parts[0]; 1375 activeGroupName = membership.GroupName;
1411 lastname = parts[1];
1412 }
1413 } 1376 }
1414 1377
1415 remoteClient.SendAgentDataUpdate(dataForAgentID, activeGroupID, firstname, 1378 UserAccount account = m_sceneList[0].UserAccountService.GetUserAccount(remoteClient.Scene.RegionInfo.ScopeID, agentID);
1379 string firstname, lastname;
1380 if (account != null)
1381 {
1382 firstname = account.FirstName;
1383 lastname = account.LastName;
1384 }
1385 else
1386 {
1387 firstname = "Unknown";
1388 lastname = "Unknown";
1389 }
1390
1391 remoteClient.SendAgentDataUpdate(agentID, activeGroupID, firstname,
1416 lastname, activeGroupPowers, activeGroupName, 1392 lastname, activeGroupPowers, activeGroupName,
1417 activeGroupTitle); 1393 activeGroupTitle);
1394
1395 if (tellOthers)
1396 SendScenePresenceUpdate(agentID, activeGroupTitle);
1397
1398 ScenePresence sp = (ScenePresence)remoteClient.SceneAgent;
1399 if (sp != null)
1400 sp.Grouptitle = activeGroupTitle;
1418 } 1401 }
1419 1402
1420 #endregion 1403 #endregion
@@ -1425,7 +1408,7 @@ namespace OpenSim.Groups
1425 { 1408 {
1426 if (m_debugEnabled) m_log.InfoFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); 1409 if (m_debugEnabled) m_log.InfoFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
1427 1410
1428 IClientAPI localClient = GetActiveClient(msgTo); 1411 IClientAPI localClient = GetActiveRootClient(msgTo);
1429 if (localClient != null) 1412 if (localClient != null)
1430 { 1413 {
1431 if (m_debugEnabled) m_log.InfoFormat("[Groups]: MsgTo ({0}) is local, delivering directly", localClient.Name); 1414 if (m_debugEnabled) m_log.InfoFormat("[Groups]: MsgTo ({0}) is local, delivering directly", localClient.Name);
@@ -1463,5 +1446,4 @@ namespace OpenSim.Groups
1463 } 1446 }
1464 1447
1465 } 1448 }
1466
1467} 1449}