diff options
author | UbitUmarov | 2015-09-27 16:53:36 +0100 |
---|---|---|
committer | UbitUmarov | 2015-09-27 16:53:36 +0100 |
commit | dcd36d0c9b24afd751265b02f4c5f89befed2a4e (patch) | |
tree | efa160bd836319a25b7f07bcb01ab23b1d932ac6 /OpenSim/Addons | |
parent | let SendAvatarGroupsReply fall back to UDP if no caps and make use of it (diff) | |
download | opensim-SC-dcd36d0c9b24afd751265b02f4c5f89befed2a4e.zip opensim-SC-dcd36d0c9b24afd751265b02f4c5f89befed2a4e.tar.gz opensim-SC-dcd36d0c9b24afd751265b02f4c5f89befed2a4e.tar.bz2 opensim-SC-dcd36d0c9b24afd751265b02f4c5f89befed2a4e.tar.xz |
apply changes to xmlrcp groups to groups V2, compiles but not tested :(
Diffstat (limited to 'OpenSim/Addons')
-rw-r--r-- | OpenSim/Addons/Groups/GroupsModule.cs | 241 |
1 files changed, 77 insertions, 164 deletions
diff --git a/OpenSim/Addons/Groups/GroupsModule.cs b/OpenSim/Addons/Groups/GroupsModule.cs index 2831326..7b337cf 100644 --- a/OpenSim/Addons/Groups/GroupsModule.cs +++ b/OpenSim/Addons/Groups/GroupsModule.cs | |||
@@ -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,13 @@ 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 | // The InstantMessageModule itself doesn't do this, | ||
183 | // so lets see if things explode if we don't do it | ||
184 | // scene.EventManager.OnClientClosed += OnClientClosed; | ||
185 | 185 | ||
186 | } | 186 | } |
187 | 187 | ||
@@ -237,6 +237,7 @@ namespace OpenSim.Groups | |||
237 | client.OnRequestAvatarProperties += OnRequestAvatarProperties; | 237 | client.OnRequestAvatarProperties += OnRequestAvatarProperties; |
238 | } | 238 | } |
239 | 239 | ||
240 | |||
240 | private void OnMakeRoot(ScenePresence sp) | 241 | private void OnMakeRoot(ScenePresence sp) |
241 | { | 242 | { |
242 | if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 243 | if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); |
@@ -245,8 +246,9 @@ namespace OpenSim.Groups | |||
245 | // Used for Notices and Group Invites/Accept/Reject | 246 | // Used for Notices and Group Invites/Accept/Reject |
246 | sp.ControllingClient.OnInstantMessage += OnInstantMessage; | 247 | sp.ControllingClient.OnInstantMessage += OnInstantMessage; |
247 | 248 | ||
248 | // Send client their groups information. | 249 | // we should send a DataUpdate here for compatibility, |
249 | SendAgentGroupDataUpdate(sp.ControllingClient, sp.UUID); | 250 | // but this is a bad place and a bad thread to do it |
251 | // also current viewers do ignore it and ask later on a much nicer thread | ||
250 | } | 252 | } |
251 | 253 | ||
252 | private void OnMakeChild(ScenePresence sp) | 254 | private void OnMakeChild(ScenePresence sp) |
@@ -262,7 +264,6 @@ namespace OpenSim.Groups | |||
262 | { | 264 | { |
263 | if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 265 | if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); |
264 | 266 | ||
265 | //GroupMembershipData[] avatarGroups = m_groupData.GetAgentGroupMemberships(GetRequestingAgentID(remoteClient), avatarID).ToArray(); | ||
266 | GroupMembershipData[] avatarGroups = GetProfileListedGroupMemberships(remoteClient, avatarID); | 267 | GroupMembershipData[] avatarGroups = GetProfileListedGroupMemberships(remoteClient, avatarID); |
267 | remoteClient.SendAvatarGroupsReply(avatarID, avatarGroups); | 268 | remoteClient.SendAvatarGroupsReply(avatarID, avatarGroups); |
268 | } | 269 | } |
@@ -303,24 +304,13 @@ namespace OpenSim.Groups | |||
303 | 304 | ||
304 | private void OnAgentDataUpdateRequest(IClientAPI remoteClient, UUID dataForAgentID, UUID sessionID) | 305 | private void OnAgentDataUpdateRequest(IClientAPI remoteClient, UUID dataForAgentID, UUID sessionID) |
305 | { | 306 | { |
306 | if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 307 | // this a private message for own agent only |
307 | 308 | if (dataForAgentID != GetRequestingAgentID(remoteClient)) | |
308 | UUID activeGroupID = UUID.Zero; | 309 | 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 | |||
321 | SendAgentDataUpdate(remoteClient, dataForAgentID, activeGroupID, activeGroupName, activeGroupPowers, activeGroupTitle); | ||
322 | 310 | ||
323 | SendScenePresenceUpdate(dataForAgentID, activeGroupTitle); | 311 | SendAgentGroupDataUpdate(remoteClient, false); |
312 | // its a info request not a change, so nothing is sent to others | ||
313 | // they do get the group title with the avatar object update on arrivel to a region | ||
324 | } | 314 | } |
325 | 315 | ||
326 | private void HandleUUIDGroupNameRequest(UUID GroupID, IClientAPI remoteClient) | 316 | private void HandleUUIDGroupNameRequest(UUID GroupID, IClientAPI remoteClient) |
@@ -395,11 +385,12 @@ namespace OpenSim.Groups | |||
395 | 385 | ||
396 | OutgoingInstantMessage(msg, invitee); | 386 | OutgoingInstantMessage(msg, invitee); |
397 | 387 | ||
398 | UpdateAllClientsWithGroupInfo(invitee); | 388 | IClientAPI client = GetActiveClient(invitee); |
389 | if (client != null) | ||
390 | SendDataUpdate(remoteClient, true); | ||
399 | } | 391 | } |
400 | 392 | ||
401 | m_groupData.RemoveAgentToGroupInvite(GetRequestingAgentIDStr(remoteClient), inviteID); | 393 | m_groupData.RemoveAgentToGroupInvite(GetRequestingAgentIDStr(remoteClient), inviteID); |
402 | |||
403 | } | 394 | } |
404 | 395 | ||
405 | // Reject | 396 | // Reject |
@@ -462,7 +453,6 @@ namespace OpenSim.Groups | |||
462 | { | 453 | { |
463 | OnNewGroupNotice(GroupID, NoticeID); | 454 | OnNewGroupNotice(GroupID, NoticeID); |
464 | } | 455 | } |
465 | |||
466 | 456 | ||
467 | // Send notice out to everyone that wants notices | 457 | // Send notice out to everyone that wants notices |
468 | foreach (GroupMembersData member in m_groupData.GetGroupMembers(GetRequestingAgentIDStr(remoteClient), GroupID)) | 458 | foreach (GroupMembersData member in m_groupData.GetGroupMembers(GetRequestingAgentIDStr(remoteClient), GroupID)) |
@@ -508,7 +498,6 @@ namespace OpenSim.Groups | |||
508 | 498 | ||
509 | remoteClient.SendInventoryItemCreateUpdate(itemCopy, 0); | 499 | remoteClient.SendInventoryItemCreateUpdate(itemCopy, 0); |
510 | } | 500 | } |
511 | |||
512 | } | 501 | } |
513 | 502 | ||
514 | // Interop, received special 210 code for ejecting a group member | 503 | // Interop, received special 210 code for ejecting a group member |
@@ -583,11 +572,7 @@ namespace OpenSim.Groups | |||
583 | 572 | ||
584 | m_groupData.SetAgentActiveGroup(GetRequestingAgentIDStr(remoteClient), GetRequestingAgentIDStr(remoteClient), groupID); | 573 | m_groupData.SetAgentActiveGroup(GetRequestingAgentIDStr(remoteClient), GetRequestingAgentIDStr(remoteClient), groupID); |
585 | 574 | ||
586 | // Changing active group changes title, active powers, all kinds of things | 575 | SendAgentGroupDataUpdate(remoteClient, true); |
587 | // 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 title. | ||
590 | UpdateAllClientsWithGroupInfo(remoteClient.AgentId); | ||
591 | } | 576 | } |
592 | 577 | ||
593 | /// <summary> | 578 | /// <summary> |
@@ -634,7 +619,6 @@ namespace OpenSim.Groups | |||
634 | } | 619 | } |
635 | 620 | ||
636 | return data; | 621 | return data; |
637 | |||
638 | } | 622 | } |
639 | 623 | ||
640 | public List<GroupRolesData> GroupRoleDataRequest(IClientAPI remoteClient, UUID groupID) | 624 | public List<GroupRolesData> GroupRoleDataRequest(IClientAPI remoteClient, UUID groupID) |
@@ -781,7 +765,7 @@ namespace OpenSim.Groups | |||
781 | remoteClient.SendCreateGroupReply(groupID, true, "Group created successfullly"); | 765 | remoteClient.SendCreateGroupReply(groupID, true, "Group created successfullly"); |
782 | 766 | ||
783 | // Update the founder with new group information. | 767 | // Update the founder with new group information. |
784 | SendAgentGroupDataUpdate(remoteClient, GetRequestingAgentID(remoteClient)); | 768 | SendAgentGroupDataUpdate(remoteClient, false); |
785 | } | 769 | } |
786 | else | 770 | else |
787 | remoteClient.SendCreateGroupReply(groupID, false, reason); | 771 | remoteClient.SendCreateGroupReply(groupID, false, reason); |
@@ -834,7 +818,7 @@ namespace OpenSim.Groups | |||
834 | // the client currently has set active, then we need to do a scene presence update too | 818 | // 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) | 819 | // if (m_groupData.GetAgentActiveMembership(GetRequestingAgentID(remoteClient)).GroupID == GroupID) |
836 | 820 | ||
837 | UpdateAllClientsWithGroupInfo(GetRequestingAgentID(remoteClient)); | 821 | SendDataUpdate(remoteClient, true); |
838 | } | 822 | } |
839 | 823 | ||
840 | 824 | ||
@@ -875,7 +859,7 @@ namespace OpenSim.Groups | |||
875 | } | 859 | } |
876 | 860 | ||
877 | // TODO: This update really should send out updates for everyone in the role that just got changed. | 861 | // TODO: This update really should send out updates for everyone in the role that just got changed. |
878 | SendAgentGroupDataUpdate(remoteClient, GetRequestingAgentID(remoteClient)); | 862 | SendDataUpdate(remoteClient, true); |
879 | } | 863 | } |
880 | 864 | ||
881 | public void GroupRoleChanges(IClientAPI remoteClient, UUID groupID, UUID roleID, UUID memberID, uint changes) | 865 | public void GroupRoleChanges(IClientAPI remoteClient, UUID groupID, UUID roleID, UUID memberID, uint changes) |
@@ -901,7 +885,7 @@ namespace OpenSim.Groups | |||
901 | } | 885 | } |
902 | 886 | ||
903 | // TODO: This update really should send out updates for everyone in the role that just got changed. | 887 | // TODO: This update really should send out updates for everyone in the role that just got changed. |
904 | SendAgentGroupDataUpdate(remoteClient, GetRequestingAgentID(remoteClient)); | 888 | SendDataUpdate(remoteClient, true); |
905 | } | 889 | } |
906 | 890 | ||
907 | public void GroupNoticeRequest(IClientAPI remoteClient, UUID groupNoticeID) | 891 | public void GroupNoticeRequest(IClientAPI remoteClient, UUID groupNoticeID) |
@@ -969,14 +953,6 @@ namespace OpenSim.Groups | |||
969 | return msg; | 953 | return msg; |
970 | } | 954 | } |
971 | 955 | ||
972 | public void SendAgentGroupDataUpdate(IClientAPI remoteClient) | ||
973 | { | ||
974 | if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | ||
975 | |||
976 | // Send agent information about his groups | ||
977 | SendAgentGroupDataUpdate(remoteClient, GetRequestingAgentID(remoteClient)); | ||
978 | } | ||
979 | |||
980 | public void JoinGroupRequest(IClientAPI remoteClient, UUID groupID) | 956 | public void JoinGroupRequest(IClientAPI remoteClient, UUID groupID) |
981 | { | 957 | { |
982 | if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 958 | if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); |
@@ -989,7 +965,7 @@ namespace OpenSim.Groups | |||
989 | remoteClient.SendJoinGroupReply(groupID, true); | 965 | remoteClient.SendJoinGroupReply(groupID, true); |
990 | 966 | ||
991 | // Should this send updates to everyone in the group? | 967 | // Should this send updates to everyone in the group? |
992 | SendAgentGroupDataUpdate(remoteClient, GetRequestingAgentID(remoteClient)); | 968 | SendAgentGroupDataUpdate(remoteClient, true); |
993 | 969 | ||
994 | if (reason != string.Empty) | 970 | if (reason != string.Empty) |
995 | // A warning | 971 | // A warning |
@@ -1011,7 +987,7 @@ namespace OpenSim.Groups | |||
1011 | 987 | ||
1012 | // SL sends out notifcations to the group messaging session that the person has left | 988 | // 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? | 989 | // Should this also update everyone who is in the group? |
1014 | SendAgentGroupDataUpdate(remoteClient, GetRequestingAgentID(remoteClient)); | 990 | SendAgentGroupDataUpdate(remoteClient, true); |
1015 | } | 991 | } |
1016 | 992 | ||
1017 | public void EjectGroupMemberRequest(IClientAPI remoteClient, UUID groupID, UUID ejecteeID) | 993 | public void EjectGroupMemberRequest(IClientAPI remoteClient, UUID groupID, UUID ejecteeID) |
@@ -1123,7 +1099,7 @@ namespace OpenSim.Groups | |||
1123 | 1099 | ||
1124 | // SL sends out messages to everyone in the group | 1100 | // SL sends out messages to everyone in the group |
1125 | // Who all should receive updates and what should they be updated with? | 1101 | // Who all should receive updates and what should they be updated with? |
1126 | UpdateAllClientsWithGroupInfo(ejecteeID); | 1102 | SendAgentGroupDataUpdate(remoteClient, false); |
1127 | } | 1103 | } |
1128 | 1104 | ||
1129 | public void InviteGroupRequest(IClientAPI remoteClient, UUID groupID, UUID invitedAgentID, UUID roleID) | 1105 | public void InviteGroupRequest(IClientAPI remoteClient, UUID groupID, UUID invitedAgentID, UUID roleID) |
@@ -1215,71 +1191,6 @@ namespace OpenSim.Groups | |||
1215 | return child; | 1191 | return child; |
1216 | } | 1192 | } |
1217 | 1193 | ||
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) | 1194 | private void SendScenePresenceUpdate(UUID AgentID, string Title) |
1284 | { | 1195 | { |
1285 | if (m_debugEnabled) m_log.DebugFormat("[Groups]: Updating scene title for {0} with title: {1}", AgentID, Title); | 1196 | if (m_debugEnabled) m_log.DebugFormat("[Groups]: Updating scene title for {0} with title: {1}", AgentID, Title); |
@@ -1302,47 +1213,28 @@ namespace OpenSim.Groups | |||
1302 | } | 1213 | } |
1303 | } | 1214 | } |
1304 | 1215 | ||
1305 | /// <summary> | 1216 | 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 | { | 1217 | { |
1310 | if (m_debugEnabled) m_log.InfoFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 1218 | 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 | } | 1219 | } |
1322 | 1220 | ||
1323 | /// <summary> | 1221 | /// <summary> |
1324 | /// Update remoteClient with group information about dataForAgentID | 1222 | /// Tell remoteClient about its agent groups, and optionally send title to others |
1325 | /// </summary> | 1223 | /// </summary> |
1326 | private void SendAgentGroupDataUpdate(IClientAPI remoteClient, UUID dataForAgentID) | 1224 | private void SendAgentGroupDataUpdate(IClientAPI remoteClient, bool tellOthers) |
1327 | { | 1225 | { |
1328 | if (m_debugEnabled) m_log.InfoFormat("[Groups]: {0} called for {1}", System.Reflection.MethodBase.GetCurrentMethod().Name, remoteClient.Name); | 1226 | if (m_debugEnabled) m_log.InfoFormat("[Groups]: {0} called for {1}", System.Reflection.MethodBase.GetCurrentMethod().Name, remoteClient.Name); |
1329 | 1227 | ||
1330 | // TODO: All the client update functions need to be reexamined because most do too much and send too much stuff | 1228 | // TODO: All the client update functions need to be reexamined because most do too much and send too much stuff |
1331 | 1229 | ||
1332 | OnAgentDataUpdateRequest(remoteClient, dataForAgentID, UUID.Zero); | 1230 | UUID agentID = GetRequestingAgentID(remoteClient); |
1333 | 1231 | ||
1334 | // Need to send a group membership update to the client | 1232 | 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 | 1233 | ||
1340 | GroupMembershipData[] membershipArray = GetProfileListedGroupMemberships(remoteClient, dataForAgentID); | 1234 | GroupMembershipData[] membershipArray = GetProfileListedGroupMemberships(remoteClient, agentID); |
1341 | SendGroupMembershipInfoViaCaps(remoteClient, dataForAgentID, membershipArray); | 1235 | remoteClient.SendAgentGroupDataUpdate(agentID, membershipArray); |
1342 | 1236 | ||
1343 | //remoteClient.SendAvatarGroupsReply(dataForAgentID, membershipArray); | 1237 | remoteClient.RefreshGroupMembership(); |
1344 | if (remoteClient.AgentId == dataForAgentID) | ||
1345 | remoteClient.RefreshGroupMembership(); | ||
1346 | } | 1238 | } |
1347 | 1239 | ||
1348 | /// <summary> | 1240 | /// <summary> |
@@ -1394,27 +1286,49 @@ namespace OpenSim.Groups | |||
1394 | return membershipArray; | 1286 | return membershipArray; |
1395 | } | 1287 | } |
1396 | 1288 | ||
1397 | 1289 | //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) | 1290 | private void SendDataUpdate(IClientAPI remoteClient, bool tellOthers) |
1399 | { | 1291 | { |
1400 | if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 1292 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); |
1401 | 1293 | ||
1402 | // TODO: All the client update functions need to be reexamined because most do too much and send too much stuff | 1294 | UUID activeGroupID = UUID.Zero; |
1403 | string firstname = "Unknown", lastname = "Unknown"; | 1295 | string activeGroupTitle = string.Empty; |
1404 | string name = m_UserManagement.GetUserName(dataForAgentID); | 1296 | string activeGroupName = string.Empty; |
1405 | if (!string.IsNullOrEmpty(name)) | 1297 | ulong activeGroupPowers = (ulong)GroupPowers.None; |
1298 | |||
1299 | UUID agentID = GetRequestingAgentID(remoteClient); | ||
1300 | GroupMembershipData membership = m_groupData.GetAgentActiveMembership(agentID.ToString(), agentID.ToString()); | ||
1301 | if (membership != null) | ||
1406 | { | 1302 | { |
1407 | string[] parts = name.Split(new char[] { ' ' }); | 1303 | activeGroupID = membership.GroupID; |
1408 | if (parts.Length >= 2) | 1304 | activeGroupTitle = membership.GroupTitle; |
1409 | { | 1305 | activeGroupPowers = membership.GroupPowers; |
1410 | firstname = parts[0]; | 1306 | activeGroupName = membership.GroupName; |
1411 | lastname = parts[1]; | ||
1412 | } | ||
1413 | } | 1307 | } |
1414 | 1308 | ||
1415 | remoteClient.SendAgentDataUpdate(dataForAgentID, activeGroupID, firstname, | 1309 | UserAccount account = m_sceneList[0].UserAccountService.GetUserAccount(remoteClient.Scene.RegionInfo.ScopeID, agentID); |
1310 | string firstname, lastname; | ||
1311 | if (account != null) | ||
1312 | { | ||
1313 | firstname = account.FirstName; | ||
1314 | lastname = account.LastName; | ||
1315 | } | ||
1316 | else | ||
1317 | { | ||
1318 | firstname = "Unknown"; | ||
1319 | lastname = "Unknown"; | ||
1320 | } | ||
1321 | |||
1322 | remoteClient.SendAgentDataUpdate(agentID, activeGroupID, firstname, | ||
1416 | lastname, activeGroupPowers, activeGroupName, | 1323 | lastname, activeGroupPowers, activeGroupName, |
1417 | activeGroupTitle); | 1324 | activeGroupTitle); |
1325 | |||
1326 | if (tellOthers) | ||
1327 | SendScenePresenceUpdate(agentID, activeGroupTitle); | ||
1328 | |||
1329 | ScenePresence sp = (ScenePresence)remoteClient.SceneAgent; | ||
1330 | if (sp != null) | ||
1331 | sp.Grouptitle = activeGroupTitle; | ||
1418 | } | 1332 | } |
1419 | 1333 | ||
1420 | #endregion | 1334 | #endregion |
@@ -1463,5 +1377,4 @@ namespace OpenSim.Groups | |||
1463 | } | 1377 | } |
1464 | 1378 | ||
1465 | } | 1379 | } |
1466 | |||
1467 | } | 1380 | } |