aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs
diff options
context:
space:
mode:
authorMelanie2009-09-17 15:38:17 +0100
committerMelanie2009-09-17 15:38:17 +0100
commit69ef95693ae6451e2c754b22190557f3bf15777b (patch)
treea305e90f8839b3b3c058d1d2f5633f399dd92401 /OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs
parentSceneObjectGroup cleanup. Removes the default constructor and unnecessary nul... (diff)
downloadopensim-SC_OLD-69ef95693ae6451e2c754b22190557f3bf15777b.zip
opensim-SC_OLD-69ef95693ae6451e2c754b22190557f3bf15777b.tar.gz
opensim-SC_OLD-69ef95693ae6451e2c754b22190557f3bf15777b.tar.bz2
opensim-SC_OLD-69ef95693ae6451e2c754b22190557f3bf15777b.tar.xz
Thank you, mcortez, for a patch to address showing users in group list
Removed patch 0005, which was unrelated and likely accidental, and further didn't apply.
Diffstat (limited to 'OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs')
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs102
1 files changed, 73 insertions, 29 deletions
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs
index 37e1ed4..d5cbfd4 100644
--- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs
@@ -281,7 +281,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
281 281
282 private void OnRequestAvatarProperties(IClientAPI remoteClient, UUID avatarID) 282 private void OnRequestAvatarProperties(IClientAPI remoteClient, UUID avatarID)
283 { 283 {
284 GroupMembershipData[] avatarGroups = m_groupData.GetAgentGroupMemberships(GetClientGroupRequestID(remoteClient), avatarID).ToArray(); 284 if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
285
286 //GroupMembershipData[] avatarGroups = m_groupData.GetAgentGroupMemberships(GetClientGroupRequestID(remoteClient), avatarID).ToArray();
287 GroupMembershipData[] avatarGroups = GetProfileListedGroupMemberships(remoteClient, avatarID);
285 remoteClient.SendAvatarGroupsReply(avatarID, avatarGroups); 288 remoteClient.SendAvatarGroupsReply(avatarID, avatarGroups);
286 } 289 }
287 290
@@ -485,6 +488,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
485 bucket[18] = 0; //dunno 488 bucket[18] = 0; //dunno
486 } 489 }
487 490
491
488 m_groupData.AddGroupNotice(GetClientGroupRequestID(remoteClient), GroupID, NoticeID, im.fromAgentName, Subject, Message, bucket); 492 m_groupData.AddGroupNotice(GetClientGroupRequestID(remoteClient), GroupID, NoticeID, im.fromAgentName, Subject, Message, bucket);
489 if (OnNewGroupNotice != null) 493 if (OnNewGroupNotice != null)
490 { 494 {
@@ -494,7 +498,20 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
494 // Send notice out to everyone that wants notices 498 // Send notice out to everyone that wants notices
495 foreach (GroupMembersData member in m_groupData.GetGroupMembers(GetClientGroupRequestID(remoteClient), GroupID)) 499 foreach (GroupMembersData member in m_groupData.GetGroupMembers(GetClientGroupRequestID(remoteClient), GroupID))
496 { 500 {
497 if (member.AcceptNotices) 501 if (m_debugEnabled)
502 {
503 UserProfileData targetUserProfile = m_sceneList[0].CommsManager.UserService.GetUserProfile(member.AgentID);
504 if (targetUserProfile != null)
505 {
506 m_log.DebugFormat("[GROUPS]: Prepping group notice {0} for agent: {1} who Accepts Notices ({2})", NoticeID, targetUserProfile.Name, member.AcceptNotices);
507 }
508 else
509 {
510 m_log.DebugFormat("[GROUPS]: Prepping group notice {0} for agent: {1} who Accepts Notices ({2})", NoticeID, member.AgentID, member.AcceptNotices);
511 }
512 }
513
514 if (member.AcceptNotices)
498 { 515 {
499 // Build notice IIM 516 // Build notice IIM
500 GridInstantMessage msg = CreateGroupNoticeIM(UUID.Zero, NoticeID, (byte)OpenMetaverse.InstantMessageDialog.GroupNotice); 517 GridInstantMessage msg = CreateGroupNoticeIM(UUID.Zero, NoticeID, (byte)OpenMetaverse.InstantMessageDialog.GroupNotice);
@@ -614,13 +631,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
614 if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); 631 if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
615 632
616 List<GroupMembersData> data = m_groupData.GetGroupMembers(GetClientGroupRequestID(remoteClient), groupID); 633 List<GroupMembersData> data = m_groupData.GetGroupMembers(GetClientGroupRequestID(remoteClient), groupID);
617 if (m_debugEnabled)
618 {
619 foreach (GroupMembersData member in data)
620 {
621 m_log.DebugFormat("[GROUPS]: {0} {1}", member.AgentID, member.Title);
622 }
623 }
624 634
625 return data; 635 return data;
626 636
@@ -632,14 +642,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
632 642
633 List<GroupRolesData> data = m_groupData.GetGroupRoles(GetClientGroupRequestID(remoteClient), groupID); 643 List<GroupRolesData> data = m_groupData.GetGroupRoles(GetClientGroupRequestID(remoteClient), groupID);
634 644
635 if (m_debugEnabled)
636 {
637 foreach (GroupRolesData member in data)
638 {
639 m_log.DebugFormat("[GROUPS]: {0} {1}", member.Title, member.Members);
640 }
641 }
642
643 return data; 645 return data;
644 646
645 } 647 }
@@ -650,14 +652,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
650 652
651 List<GroupRoleMembersData> data = m_groupData.GetGroupRoleMembers(GetClientGroupRequestID(remoteClient), groupID); 653 List<GroupRoleMembersData> data = m_groupData.GetGroupRoleMembers(GetClientGroupRequestID(remoteClient), groupID);
652 654
653 if (m_debugEnabled)
654 {
655 foreach (GroupRoleMembersData member in data)
656 {
657 m_log.DebugFormat("[GROUPS]: Av: {0} Role: {1}", member.MemberID, member.RoleID);
658 }
659 }
660
661 return data; 655 return data;
662 656
663 657
@@ -808,7 +802,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
808 { 802 {
809 if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); 803 if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
810 804
811 // TODO: Security Checks? 805 // Security Checks are handled in the Groups Service.
812 806
813 GroupRequestID grID = GetClientGroupRequestID(remoteClient); 807 GroupRequestID grID = GetClientGroupRequestID(remoteClient);
814 808
@@ -825,6 +819,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
825 case OpenMetaverse.GroupRoleUpdate.UpdateAll: 819 case OpenMetaverse.GroupRoleUpdate.UpdateAll:
826 case OpenMetaverse.GroupRoleUpdate.UpdateData: 820 case OpenMetaverse.GroupRoleUpdate.UpdateData:
827 case OpenMetaverse.GroupRoleUpdate.UpdatePowers: 821 case OpenMetaverse.GroupRoleUpdate.UpdatePowers:
822 if (m_debugEnabled)
823 {
824 GroupPowers gp = (GroupPowers)powers;
825 m_log.DebugFormat("[GROUPS]: Role ({0}) updated with Powers ({1}) ({2})", name, powers.ToString(), gp.ToString());
826 }
828 m_groupData.UpdateGroupRole(grID, groupID, roleID, name, description, title, powers); 827 m_groupData.UpdateGroupRole(grID, groupID, roleID, name, description, title, powers);
829 break; 828 break;
830 829
@@ -1195,6 +1194,16 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
1195 1194
1196 foreach (GroupMembershipData membership in data) 1195 foreach (GroupMembershipData membership in data)
1197 { 1196 {
1197 if (remoteClient.AgentId != dataForAgentID)
1198 {
1199 if (!membership.ListInProfile)
1200 {
1201 // If we're sending group info to remoteclient about another agent,
1202 // filter out groups the other agent doesn't want to share.
1203 continue;
1204 }
1205 }
1206
1198 OSDMap GroupDataMap = new OSDMap(6); 1207 OSDMap GroupDataMap = new OSDMap(6);
1199 OSDMap NewGroupDataMap = new OSDMap(1); 1208 OSDMap NewGroupDataMap = new OSDMap(1);
1200 1209
@@ -1281,11 +1290,46 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
1281 // to the core Groups Stub 1290 // to the core Groups Stub
1282 remoteClient.SendGroupMembership(new GroupMembershipData[0]); 1291 remoteClient.SendGroupMembership(new GroupMembershipData[0]);
1283 1292
1284 GroupMembershipData[] membershipData = m_groupData.GetAgentGroupMemberships(GetClientGroupRequestID(remoteClient), dataForAgentID).ToArray(); 1293 GroupMembershipData[] membershipArray = GetProfileListedGroupMemberships(remoteClient, dataForAgentID);
1294 SendGroupMembershipInfoViaCaps(remoteClient, dataForAgentID, membershipArray);
1295 remoteClient.SendAvatarGroupsReply(dataForAgentID, membershipArray);
1285 1296
1286 SendGroupMembershipInfoViaCaps(remoteClient, dataForAgentID, membershipData); 1297 }
1287 remoteClient.SendAvatarGroupsReply(dataForAgentID, membershipData); 1298
1299 /// <summary>
1300 /// Get a list of groups memberships for the agent that are marked "ListInProfile"
1301 /// </summary>
1302 /// <param name="dataForAgentID"></param>
1303 /// <returns></returns>
1304 private GroupMembershipData[] GetProfileListedGroupMemberships(IClientAPI requestingClient, UUID dataForAgentID)
1305 {
1306 List<GroupMembershipData> membershipData = m_groupData.GetAgentGroupMemberships(GetClientGroupRequestID(requestingClient), dataForAgentID);
1307 GroupMembershipData[] membershipArray;
1308
1309 if (requestingClient.AgentId != dataForAgentID)
1310 {
1311 Predicate<GroupMembershipData> showInProfile = delegate(GroupMembershipData membership)
1312 {
1313 return membership.ListInProfile;
1314 };
1315
1316 membershipArray = membershipData.FindAll(showInProfile).ToArray();
1317 }
1318 else
1319 {
1320 membershipArray = membershipData.ToArray();
1321 }
1322
1323 if (m_debugEnabled)
1324 {
1325 m_log.InfoFormat("[GROUPS]: Get group membership information for {0} requested by {1}", dataForAgentID, requestingClient.AgentId);
1326 foreach (GroupMembershipData membership in membershipArray)
1327 {
1328 m_log.InfoFormat("[GROUPS]: {0} :: {1} - {2}", dataForAgentID, membership.GroupName, membership.GroupTitle);
1329 }
1330 }
1288 1331
1332 return membershipArray;
1289 } 1333 }
1290 1334
1291 private void SendAgentDataUpdate(IClientAPI remoteClient, UUID dataForAgentID, UUID activeGroupID, string activeGroupName, ulong activeGroupPowers, string activeGroupTitle) 1335 private void SendAgentDataUpdate(IClientAPI remoteClient, UUID dataForAgentID, UUID activeGroupID, string activeGroupName, ulong activeGroupPowers, string activeGroupTitle)