aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorUbitUmarov2015-09-27 06:10:12 +0100
committerUbitUmarov2015-09-27 06:10:12 +0100
commitb2691850315efdf8bb4709464ea920239f841d2c (patch)
tree8ca1fe8fa1baf7c816d3af7180ca8f285916f024
parent in xmlrpcGroups send all groups on MakeRoot. this will slow down crossings e... (diff)
downloadopensim-SC_OLD-b2691850315efdf8bb4709464ea920239f841d2c.zip
opensim-SC_OLD-b2691850315efdf8bb4709464ea920239f841d2c.tar.gz
opensim-SC_OLD-b2691850315efdf8bb4709464ea920239f841d2c.tar.bz2
opensim-SC_OLD-b2691850315efdf8bb4709464ea920239f841d2c.tar.xz
several changes to xmlrpcGroups. Packets AgentData and AgentGroupData are private to the requesting agent, etc
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs150
1 files changed, 67 insertions, 83 deletions
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs
index 3137f84..ec5aecd 100644
--- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs
@@ -265,10 +265,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
265 sp.ControllingClient.OnUUIDGroupNameRequest += HandleUUIDGroupNameRequest; 265 sp.ControllingClient.OnUUIDGroupNameRequest += HandleUUIDGroupNameRequest;
266 // Used for Notices and Group Invites/Accept/Reject 266 // Used for Notices and Group Invites/Accept/Reject
267 sp.ControllingClient.OnInstantMessage += OnInstantMessage; 267 sp.ControllingClient.OnInstantMessage += OnInstantMessage;
268 // Send client their groups information. 268
269 SendAgentGroupDataUpdate(sp.ControllingClient, sp.UUID); 269 // we should send a DataUpdate here for compatibility,
270 // only send data viwer will ask rest later 270 // but this is a bad place and a bad thread to do it
271// OnAgentDataUpdateRequest(sp.ControllingClient, sp.UUID, sp.UUID); 271 // also current viewers do ignore it and ask later on a much nicer thread
272 } 272 }
273 273
274 private void OnMakeChild(ScenePresence sp) 274 private void OnMakeChild(ScenePresence sp)
@@ -291,7 +291,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
291 { 291 {
292 if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); 292 if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
293 293
294 //GroupMembershipData[] avatarGroups = m_groupData.GetAgentGroupMemberships(GetRequestingAgentID(remoteClient), avatarID).ToArray();
295 GroupMembershipData[] avatarGroups = GetProfileListedGroupMemberships(remoteClient, avatarID); 294 GroupMembershipData[] avatarGroups = GetProfileListedGroupMemberships(remoteClient, avatarID);
296 remoteClient.SendAvatarGroupsReply(avatarID, avatarGroups); 295 remoteClient.SendAvatarGroupsReply(avatarID, avatarGroups);
297 } 296 }
@@ -332,24 +331,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
332 331
333 private void OnAgentDataUpdateRequest(IClientAPI remoteClient, UUID dataForAgentID, UUID sessionID) 332 private void OnAgentDataUpdateRequest(IClientAPI remoteClient, UUID dataForAgentID, UUID sessionID)
334 { 333 {
335 if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); 334 // this a private message for own agent only
336 335 if (dataForAgentID != GetRequestingAgentID(remoteClient))
337 UUID activeGroupID = UUID.Zero; 336 return;
338 string activeGroupTitle = string.Empty;
339 string activeGroupName = string.Empty;
340 ulong activeGroupPowers = (ulong)GroupPowers.None;
341
342 GroupMembershipData membership = m_groupData.GetAgentActiveMembership(GetRequestingAgentID(remoteClient), dataForAgentID);
343 if (membership != null)
344 {
345 activeGroupID = membership.GroupID;
346 activeGroupTitle = membership.GroupTitle;
347 activeGroupPowers = membership.GroupPowers;
348 }
349
350 SendAgentDataUpdate(remoteClient, dataForAgentID, activeGroupID, activeGroupName, activeGroupPowers, activeGroupTitle);
351 337
352 SendScenePresenceUpdate(dataForAgentID, activeGroupTitle); 338 SendAgentGroupDataUpdate(remoteClient, false);
339 // its a info request not a change, so nothing is sent to others
340 // they do get the group title with the avatar object update on arrivel to a region
353 } 341 }
354 342
355 private void HandleUUIDGroupNameRequest(UUID GroupID, IClientAPI remoteClient) 343 private void HandleUUIDGroupNameRequest(UUID GroupID, IClientAPI remoteClient)
@@ -420,7 +408,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
420 408
421 OutgoingInstantMessage(msg, inviteInfo.AgentID); 409 OutgoingInstantMessage(msg, inviteInfo.AgentID);
422 410
423 UpdateAllClientsWithGroupInfo(inviteInfo.AgentID); 411 IClientAPI client = GetActiveClient(inviteInfo.AgentID);
412 if (client != null)
413 SendDataUpdate(remoteClient, true);
424 414
425 // TODO: If the inviter is still online, they need an agent dataupdate 415 // TODO: If the inviter is still online, they need an agent dataupdate
426 // and maybe group membership updates for the invitee 416 // and maybe group membership updates for the invitee
@@ -673,13 +663,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
673 { 663 {
674 if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); 664 if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
675 665
676 m_groupData.SetAgentActiveGroup(GetRequestingAgentID(remoteClient), GetRequestingAgentID(remoteClient), groupID); 666 UUID agentID = GetRequestingAgentID(remoteClient);
667 m_groupData.SetAgentActiveGroup(agentID, agentID, groupID);
677 668
678 // Changing active group changes title, active powers, all kinds of things 669 // llClientView does this
679 // anyone who is in any region that can see this client, should probably be 670 SendAgentGroupDataUpdate(remoteClient, true);
680 // updated with new group info. At a minimum, they should get ScenePresence
681 // updated with new title.
682 UpdateAllClientsWithGroupInfo(GetRequestingAgentID(remoteClient));
683 } 671 }
684 672
685 /// <summary> 673 /// <summary>
@@ -689,7 +677,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
689 { 677 {
690 if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); 678 if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
691 679
692
693 List<GroupRolesData> agentRoles = m_groupData.GetAgentGroupRoles(GetRequestingAgentID(remoteClient), GetRequestingAgentID(remoteClient), groupID); 680 List<GroupRolesData> agentRoles = m_groupData.GetAgentGroupRoles(GetRequestingAgentID(remoteClient), GetRequestingAgentID(remoteClient), groupID);
694 GroupMembershipData agentMembership = m_groupData.GetAgentGroupMembership(GetRequestingAgentID(remoteClient), GetRequestingAgentID(remoteClient), groupID); 681 GroupMembershipData agentMembership = m_groupData.GetAgentGroupMembership(GetRequestingAgentID(remoteClient), GetRequestingAgentID(remoteClient), groupID);
695 682
@@ -727,7 +714,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
727 } 714 }
728 715
729 return data; 716 return data;
730
731 } 717 }
732 718
733 public List<GroupRolesData> GroupRoleDataRequest(IClientAPI remoteClient, UUID groupID) 719 public List<GroupRolesData> GroupRoleDataRequest(IClientAPI remoteClient, UUID groupID)
@@ -865,7 +851,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
865 remoteClient.SendCreateGroupReply(groupID, true, "Group created successfullly"); 851 remoteClient.SendCreateGroupReply(groupID, true, "Group created successfullly");
866 852
867 // Update the founder with new group information. 853 // Update the founder with new group information.
868 SendAgentGroupDataUpdate(remoteClient, GetRequestingAgentID(remoteClient)); 854 SendAgentGroupDataUpdate(remoteClient, false);
869 855
870 return groupID; 856 return groupID;
871 } 857 }
@@ -906,10 +892,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
906 // TODO: Not sure what all is needed here, but if the active group role change is for the group 892 // TODO: Not sure what all is needed here, but if the active group role change is for the group
907 // the client currently has set active, then we need to do a scene presence update too 893 // the client currently has set active, then we need to do a scene presence update too
908 // if (m_groupData.GetAgentActiveMembership(GetRequestingAgentID(remoteClient)).GroupID == GroupID) 894 // if (m_groupData.GetAgentActiveMembership(GetRequestingAgentID(remoteClient)).GroupID == GroupID)
909
910 UpdateAllClientsWithGroupInfo(GetRequestingAgentID(remoteClient));
911 }
912 895
896 SendDataUpdate(remoteClient, true);
897 }
913 898
914 public void GroupRoleUpdate(IClientAPI remoteClient, UUID groupID, UUID roleID, string name, string description, string title, ulong powers, byte updateType) 899 public void GroupRoleUpdate(IClientAPI remoteClient, UUID groupID, UUID roleID, string name, string description, string title, ulong powers, byte updateType)
915 { 900 {
@@ -946,7 +931,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
946 } 931 }
947 932
948 // TODO: This update really should send out updates for everyone in the role that just got changed. 933 // TODO: This update really should send out updates for everyone in the role that just got changed.
949 SendAgentGroupDataUpdate(remoteClient, GetRequestingAgentID(remoteClient)); 934 SendAgentGroupDataUpdate(remoteClient, false);
950 } 935 }
951 936
952 public void GroupRoleChanges(IClientAPI remoteClient, UUID groupID, UUID roleID, UUID memberID, uint changes) 937 public void GroupRoleChanges(IClientAPI remoteClient, UUID groupID, UUID roleID, UUID memberID, uint changes)
@@ -972,7 +957,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
972 } 957 }
973 958
974 // TODO: This update really should send out updates for everyone in the role that just got changed. 959 // TODO: This update really should send out updates for everyone in the role that just got changed.
975 SendAgentGroupDataUpdate(remoteClient, GetRequestingAgentID(remoteClient)); 960 SendAgentGroupDataUpdate(remoteClient, false);
976 } 961 }
977 962
978 public void GroupNoticeRequest(IClientAPI remoteClient, UUID groupNoticeID) 963 public void GroupNoticeRequest(IClientAPI remoteClient, UUID groupNoticeID)
@@ -1052,14 +1037,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
1052 return msg; 1037 return msg;
1053 } 1038 }
1054 1039
1055 public void SendAgentGroupDataUpdate(IClientAPI remoteClient)
1056 {
1057 if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
1058
1059 // Send agent information about his groups
1060 SendAgentGroupDataUpdate(remoteClient, GetRequestingAgentID(remoteClient));
1061 }
1062
1063 public void JoinGroupRequest(IClientAPI remoteClient, UUID groupID) 1040 public void JoinGroupRequest(IClientAPI remoteClient, UUID groupID)
1064 { 1041 {
1065 if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); 1042 if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
@@ -1069,8 +1046,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
1069 1046
1070 remoteClient.SendJoinGroupReply(groupID, true); 1047 remoteClient.SendJoinGroupReply(groupID, true);
1071 1048
1072 // Should this send updates to everyone in the group? 1049 SendAgentGroupDataUpdate(remoteClient, true);
1073 SendAgentGroupDataUpdate(remoteClient, GetRequestingAgentID(remoteClient));
1074 } 1050 }
1075 1051
1076 public void LeaveGroupRequest(IClientAPI remoteClient, UUID groupID) 1052 public void LeaveGroupRequest(IClientAPI remoteClient, UUID groupID)
@@ -1085,7 +1061,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
1085 1061
1086 // SL sends out notifcations to the group messaging session that the person has left 1062 // SL sends out notifcations to the group messaging session that the person has left
1087 // Should this also update everyone who is in the group? 1063 // Should this also update everyone who is in the group?
1088 SendAgentGroupDataUpdate(remoteClient, GetRequestingAgentID(remoteClient)); 1064 SendAgentGroupDataUpdate(remoteClient, true);
1089 } 1065 }
1090 1066
1091 public void EjectGroupMemberRequest(IClientAPI remoteClient, UUID groupID, UUID ejecteeID) 1067 public void EjectGroupMemberRequest(IClientAPI remoteClient, UUID groupID, UUID ejecteeID)
@@ -1194,10 +1170,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
1194 msg.binaryBucket = new byte[0]; 1170 msg.binaryBucket = new byte[0];
1195 OutgoingInstantMessage(msg, agentID); 1171 OutgoingInstantMessage(msg, agentID);
1196 1172
1197
1198 // SL sends out messages to everyone in the group 1173 // SL sends out messages to everyone in the group
1199 // Who all should receive updates and what should they be updated with? 1174 // Who all should receive updates and what should they be updated with?
1200 UpdateAllClientsWithGroupInfo(ejecteeID); 1175 // just tell this the group change
1176 SendAgentGroupDataUpdate(remoteClient, false);
1177 // TODO fix the rest of sends
1201 } 1178 }
1202 1179
1203 public void InviteGroupRequest(IClientAPI remoteClient, UUID groupID, UUID invitedAgentID, UUID roleID) 1180 public void InviteGroupRequest(IClientAPI remoteClient, UUID groupID, UUID invitedAgentID, UUID roleID)
@@ -1377,8 +1354,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
1377 if (queue != null) 1354 if (queue != null)
1378 { 1355 {
1379 queue.Enqueue(queue.BuildEvent("AgentGroupDataUpdate", llDataStruct), GetRequestingAgentID(remoteClient)); 1356 queue.Enqueue(queue.BuildEvent("AgentGroupDataUpdate", llDataStruct), GetRequestingAgentID(remoteClient));
1380 } 1357 }
1381
1382 } 1358 }
1383 1359
1384 private void SendScenePresenceUpdate(UUID AgentID, string Title) 1360 private void SendScenePresenceUpdate(UUID AgentID, string Title)
@@ -1403,34 +1379,23 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
1403 } 1379 }
1404 } 1380 }
1405 1381
1406 /// <summary> 1382 public void SendAgentGroupDataUpdate(IClientAPI remoteClient)
1407 /// Send updates to all clients who might be interested in groups data for dataForClientID
1408 /// </summary>
1409 private void UpdateAllClientsWithGroupInfo(UUID dataForClientID)
1410 { 1383 {
1411 if (m_debugEnabled) m_log.InfoFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); 1384 SendAgentGroupDataUpdate(remoteClient, true);
1412
1413 // TODO: Probably isn't nessesary to update every client in every scene.
1414 // Need to examine client updates and do only what's nessesary.
1415 lock (m_sceneList)
1416 {
1417 foreach (Scene scene in m_sceneList)
1418 {
1419 scene.ForEachClient(delegate(IClientAPI client) { SendAgentGroupDataUpdate(client, dataForClientID); });
1420 }
1421 }
1422 } 1385 }
1423 1386
1424 /// <summary> 1387 /// <summary>
1425 /// Update remoteClient with group information about dataForAgentID 1388 /// Tell remoteClient about its agent groups, and optionally send title to others
1426 /// </summary> 1389 /// </summary>
1427 private void SendAgentGroupDataUpdate(IClientAPI remoteClient, UUID dataForAgentID) 1390 private void SendAgentGroupDataUpdate(IClientAPI remoteClient, bool tellOthers)
1428 { 1391 {
1429 if (m_debugEnabled) m_log.InfoFormat("[GROUPS]: {0} called for {1}", System.Reflection.MethodBase.GetCurrentMethod().Name, remoteClient.Name); 1392 if (m_debugEnabled) m_log.InfoFormat("[GROUPS]: {0} called for {1}", System.Reflection.MethodBase.GetCurrentMethod().Name, remoteClient.Name);
1430 1393
1431 // TODO: All the client update functions need to be reexamined because most do too much and send too much stuff 1394 // TODO: All the client update functions need to be reexamined because most do too much and send too much stuff
1432 1395
1433 OnAgentDataUpdateRequest(remoteClient, dataForAgentID, UUID.Zero); 1396 UUID agentID = GetRequestingAgentID(remoteClient);
1397
1398 SendDataUpdate(remoteClient, tellOthers);
1434 1399
1435 // Need to send a group membership update to the client 1400 // Need to send a group membership update to the client
1436 // UDP version doesn't seem to behave nicely. But we're going to send it out here 1401 // UDP version doesn't seem to behave nicely. But we're going to send it out here
@@ -1438,13 +1403,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
1438 // to the core Groups Stub 1403 // to the core Groups Stub
1439 remoteClient.SendGroupMembership(new GroupMembershipData[0]); 1404 remoteClient.SendGroupMembership(new GroupMembershipData[0]);
1440 1405
1441 GroupMembershipData[] membershipArray = GetProfileListedGroupMemberships(remoteClient, dataForAgentID); 1406 GroupMembershipData[] membershipArray = GetProfileListedGroupMemberships(remoteClient, agentID);
1442 SendGroupMembershipInfoViaCaps(remoteClient, dataForAgentID, membershipArray); 1407 SendGroupMembershipInfoViaCaps(remoteClient, agentID, membershipArray);
1443 remoteClient.SendAvatarGroupsReply(dataForAgentID, membershipArray);
1444 1408
1445 if (remoteClient.AgentId == dataForAgentID) 1409 remoteClient.RefreshGroupMembership();
1446 remoteClient.RefreshGroupMembership(); 1410 }
1447 }
1448 1411
1449 /// <summary> 1412 /// <summary>
1450 /// Get a list of groups memberships for the agent that are marked "ListInProfile" 1413 /// Get a list of groups memberships for the agent that are marked "ListInProfile"
@@ -1495,13 +1458,27 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
1495 return membershipArray; 1458 return membershipArray;
1496 } 1459 }
1497 1460
1498 1461 //tell remoteClient about its agent group info, and optionally send title to others
1499 private void SendAgentDataUpdate(IClientAPI remoteClient, UUID dataForAgentID, UUID activeGroupID, string activeGroupName, ulong activeGroupPowers, string activeGroupTitle) 1462 private void SendDataUpdate(IClientAPI remoteClient, bool tellOthers)
1500 { 1463 {
1501 if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); 1464 if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
1502 1465
1503 // TODO: All the client update functions need to be reexamined because most do too much and send too much stuff 1466 UUID activeGroupID = UUID.Zero;
1504 UserAccount account = m_sceneList[0].UserAccountService.GetUserAccount(remoteClient.Scene.RegionInfo.ScopeID, dataForAgentID); 1467 string activeGroupTitle = string.Empty;
1468 string activeGroupName = string.Empty;
1469 ulong activeGroupPowers = (ulong)GroupPowers.None;
1470
1471 UUID agentID = GetRequestingAgentID(remoteClient);
1472 GroupMembershipData membership = m_groupData.GetAgentActiveMembership(agentID, agentID);
1473 if (membership != null)
1474 {
1475 activeGroupID = membership.GroupID;
1476 activeGroupTitle = membership.GroupTitle;
1477 activeGroupPowers = membership.GroupPowers;
1478 activeGroupName = membership.GroupName;
1479 }
1480
1481 UserAccount account = m_sceneList[0].UserAccountService.GetUserAccount(remoteClient.Scene.RegionInfo.ScopeID, agentID);
1505 string firstname, lastname; 1482 string firstname, lastname;
1506 if (account != null) 1483 if (account != null)
1507 { 1484 {
@@ -1514,9 +1491,16 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
1514 lastname = "Unknown"; 1491 lastname = "Unknown";
1515 } 1492 }
1516 1493
1517 remoteClient.SendAgentDataUpdate(dataForAgentID, activeGroupID, firstname, 1494 remoteClient.SendAgentDataUpdate(agentID, activeGroupID, firstname,
1518 lastname, activeGroupPowers, activeGroupName, 1495 lastname, activeGroupPowers, activeGroupName,
1519 activeGroupTitle); 1496 activeGroupTitle);
1497
1498 if (tellOthers)
1499 SendScenePresenceUpdate(agentID, activeGroupTitle);
1500
1501 ScenePresence sp = (ScenePresence)remoteClient.SceneAgent;
1502 if (sp != null)
1503 sp.Grouptitle = activeGroupTitle;
1520 } 1504 }
1521 1505
1522 #endregion 1506 #endregion