diff options
author | UbitUmarov | 2016-07-01 16:10:45 +0100 |
---|---|---|
committer | UbitUmarov | 2016-07-01 16:10:45 +0100 |
commit | 9358a6ad2979929655d0e25d404596772607f75b (patch) | |
tree | 4a4b8638a89258cb5c51092cbc472a78f3a2e8cb /OpenSim | |
parent | change ubOde module, hopefully for better handling of multiple scenes on same... (diff) | |
download | opensim-SC-9358a6ad2979929655d0e25d404596772607f75b.zip opensim-SC-9358a6ad2979929655d0e25d404596772607f75b.tar.gz opensim-SC-9358a6ad2979929655d0e25d404596772607f75b.tar.bz2 opensim-SC-9358a6ad2979929655d0e25d404596772607f75b.tar.xz |
revert several changes to groups modules (agentGroupData is private). change interregions invite/eject messages, etc
Diffstat (limited to 'OpenSim')
6 files changed, 115 insertions, 116 deletions
diff --git a/OpenSim/Addons/Groups/GroupsModule.cs b/OpenSim/Addons/Groups/GroupsModule.cs index 3336e94..13b7123 100644 --- a/OpenSim/Addons/Groups/GroupsModule.cs +++ b/OpenSim/Addons/Groups/GroupsModule.cs | |||
@@ -393,9 +393,11 @@ namespace OpenSim.Groups | |||
393 | msg.binaryBucket = new byte[0]; | 393 | msg.binaryBucket = new byte[0]; |
394 | 394 | ||
395 | OutgoingInstantMessage(msg, invitee); | 395 | OutgoingInstantMessage(msg, invitee); |
396 | 396 | IClientAPI inviteeClient = GetActiveRootClient(invitee); | |
397 | UpdateAllClientsWithGroupInfo(invitee); | 397 | if(inviteeClient !=null) |
398 | 398 | { | |
399 | SendAgentGroupDataUpdate(inviteeClient,true); | ||
400 | } | ||
399 | } | 401 | } |
400 | 402 | ||
401 | m_groupData.RemoveAgentToGroupInvite(GetRequestingAgentIDStr(remoteClient), inviteID); | 403 | m_groupData.RemoveAgentToGroupInvite(GetRequestingAgentIDStr(remoteClient), inviteID); |
@@ -521,14 +523,16 @@ namespace OpenSim.Groups | |||
521 | 523 | ||
522 | UUID ejecteeID = new UUID(im.toAgentID); | 524 | UUID ejecteeID = new UUID(im.toAgentID); |
523 | 525 | ||
526 | im.imSessionID = UUID.Zero.Guid; | ||
524 | im.dialog = (byte)InstantMessageDialog.MessageFromAgent; | 527 | im.dialog = (byte)InstantMessageDialog.MessageFromAgent; |
525 | OutgoingInstantMessage(im, ejecteeID); | 528 | OutgoingInstantMessage(im, ejecteeID); |
526 | 529 | ||
527 | IClientAPI ejectee = GetActiveClient(ejecteeID); | 530 | IClientAPI ejectee = GetActiveRootClient(ejecteeID); |
528 | if (ejectee != null) | 531 | if (ejectee != null) |
529 | { | 532 | { |
530 | UUID groupID = new UUID(im.imSessionID); | 533 | UUID groupID = new UUID(im.imSessionID); |
531 | ejectee.SendAgentDropGroup(groupID); | 534 | ejectee.SendAgentDropGroup(groupID); |
535 | SendAgentGroupDataUpdate(ejectee,true); | ||
532 | } | 536 | } |
533 | } | 537 | } |
534 | } | 538 | } |
@@ -548,7 +552,7 @@ namespace OpenSim.Groups | |||
548 | case (byte)InstantMessageDialog.GroupInvitation: | 552 | case (byte)InstantMessageDialog.GroupInvitation: |
549 | case (byte)InstantMessageDialog.GroupNotice: | 553 | case (byte)InstantMessageDialog.GroupNotice: |
550 | UUID toAgentID = new UUID(msg.toAgentID); | 554 | UUID toAgentID = new UUID(msg.toAgentID); |
551 | IClientAPI localClient = GetActiveClient(toAgentID); | 555 | IClientAPI localClient = GetActiveRootClient(toAgentID); |
552 | if (localClient != null) | 556 | if (localClient != null) |
553 | { | 557 | { |
554 | localClient.SendInstantMessage(msg); | 558 | localClient.SendInstantMessage(msg); |
@@ -1058,10 +1062,31 @@ namespace OpenSim.Groups | |||
1058 | return; | 1062 | return; |
1059 | } | 1063 | } |
1060 | 1064 | ||
1065 | IClientAPI ejecteeClient = GetActiveRootClient(ejecteeID); | ||
1066 | |||
1061 | // Send Message to Ejectee | 1067 | // Send Message to Ejectee |
1062 | GridInstantMessage msg = new GridInstantMessage(); | 1068 | GridInstantMessage msg = new GridInstantMessage(); |
1063 | 1069 | ||
1064 | msg.imSessionID = UUID.Zero.Guid; | 1070 | // if local send a normal message |
1071 | if(ejecteeClient != null) | ||
1072 | { | ||
1073 | msg.imSessionID = UUID.Zero.Guid; | ||
1074 | msg.dialog = (byte)OpenMetaverse.InstantMessageDialog.MessageFromAgent; | ||
1075 | // also execute and send update | ||
1076 | ejecteeClient.SendAgentDropGroup(groupID); | ||
1077 | SendAgentGroupDataUpdate(ejecteeClient,true); | ||
1078 | } | ||
1079 | else // send | ||
1080 | { | ||
1081 | // Interop, received special 210 code for ejecting a group member | ||
1082 | // this only works within the comms servers domain, and won't work hypergrid | ||
1083 | // TODO:FIXME: Use a presence server of some kind to find out where the | ||
1084 | // client actually is, and try contacting that region directly to notify them, | ||
1085 | // or provide the notification via xmlrpc update queue | ||
1086 | |||
1087 | msg.imSessionID = groupInfo.GroupID.Guid; | ||
1088 | msg.dialog = (byte)210; //interop | ||
1089 | } | ||
1065 | msg.fromAgentID = agentID.Guid; | 1090 | msg.fromAgentID = agentID.Guid; |
1066 | // msg.fromAgentID = info.GroupID; | 1091 | // msg.fromAgentID = info.GroupID; |
1067 | msg.toAgentID = ejecteeID.Guid; | 1092 | msg.toAgentID = ejecteeID.Guid; |
@@ -1069,7 +1094,7 @@ namespace OpenSim.Groups | |||
1069 | msg.timestamp = 0; | 1094 | msg.timestamp = 0; |
1070 | msg.fromAgentName = agentName; | 1095 | msg.fromAgentName = agentName; |
1071 | msg.message = string.Format("You have been ejected from '{1}' by {0}.", agentName, groupInfo.GroupName); | 1096 | msg.message = string.Format("You have been ejected from '{1}' by {0}.", agentName, groupInfo.GroupName); |
1072 | msg.dialog = (byte)OpenMetaverse.InstantMessageDialog.MessageFromAgent; | 1097 | |
1073 | msg.fromGroup = false; | 1098 | msg.fromGroup = false; |
1074 | msg.offline = (byte)0; | 1099 | msg.offline = (byte)0; |
1075 | msg.ParentEstateID = 0; | 1100 | msg.ParentEstateID = 0; |
@@ -1079,11 +1104,7 @@ namespace OpenSim.Groups | |||
1079 | OutgoingInstantMessage(msg, ejecteeID); | 1104 | OutgoingInstantMessage(msg, ejecteeID); |
1080 | 1105 | ||
1081 | // Message to ejector | 1106 | // Message to ejector |
1082 | // Interop, received special 210 code for ejecting a group member | 1107 | |
1083 | // this only works within the comms servers domain, and won't work hypergrid | ||
1084 | // TODO:FIXME: Use a presense server of some kind to find out where the | ||
1085 | // client actually is, and try contacting that region directly to notify them, | ||
1086 | // or provide the notification via xmlrpc update queue | ||
1087 | 1108 | ||
1088 | msg = new GridInstantMessage(); | 1109 | msg = new GridInstantMessage(); |
1089 | msg.imSessionID = UUID.Zero.Guid; | 1110 | msg.imSessionID = UUID.Zero.Guid; |
@@ -1099,7 +1120,7 @@ namespace OpenSim.Groups | |||
1099 | { | 1120 | { |
1100 | msg.message = string.Format("{2} has been ejected from '{1}' by {0}.", agentName, groupInfo.GroupName, "Unknown member"); | 1121 | msg.message = string.Format("{2} has been ejected from '{1}' by {0}.", agentName, groupInfo.GroupName, "Unknown member"); |
1101 | } | 1122 | } |
1102 | msg.dialog = (byte)210; //interop | 1123 | msg.dialog = (byte)OpenMetaverse.InstantMessageDialog.MessageFromAgent; |
1103 | msg.fromGroup = false; | 1124 | msg.fromGroup = false; |
1104 | msg.offline = (byte)0; | 1125 | msg.offline = (byte)0; |
1105 | msg.ParentEstateID = 0; | 1126 | msg.ParentEstateID = 0; |
@@ -1107,11 +1128,6 @@ namespace OpenSim.Groups | |||
1107 | msg.RegionID = regionInfo.RegionID.Guid; | 1128 | msg.RegionID = regionInfo.RegionID.Guid; |
1108 | msg.binaryBucket = new byte[0]; | 1129 | msg.binaryBucket = new byte[0]; |
1109 | OutgoingInstantMessage(msg, agentID); | 1130 | OutgoingInstantMessage(msg, agentID); |
1110 | |||
1111 | |||
1112 | // SL sends out messages to everyone in the group | ||
1113 | // Who all should receive updates and what should they be updated with? | ||
1114 | UpdateAllClientsWithGroupInfo(ejecteeID); | ||
1115 | } | 1131 | } |
1116 | 1132 | ||
1117 | public void InviteGroupRequest(IClientAPI remoteClient, UUID groupID, UUID invitedAgentID, UUID roleID) | 1133 | public void InviteGroupRequest(IClientAPI remoteClient, UUID groupID, UUID invitedAgentID, UUID roleID) |
@@ -1174,6 +1190,18 @@ namespace OpenSim.Groups | |||
1174 | #endregion | 1190 | #endregion |
1175 | 1191 | ||
1176 | #region Client/Update Tools | 1192 | #region Client/Update Tools |
1193 | private IClientAPI GetActiveRootClient(UUID agentID) | ||
1194 | { | ||
1195 | foreach (Scene scene in m_sceneList) | ||
1196 | { | ||
1197 | ScenePresence sp = scene.GetScenePresence(agentID); | ||
1198 | if (sp != null && !sp.IsChildAgent && !sp.IsDeleted) | ||
1199 | { | ||
1200 | return sp.ControllingClient; | ||
1201 | } | ||
1202 | } | ||
1203 | return null; | ||
1204 | } | ||
1177 | 1205 | ||
1178 | /// <summary> | 1206 | /// <summary> |
1179 | /// Try to find an active IClientAPI reference for agentID giving preference to root connections | 1207 | /// Try to find an active IClientAPI reference for agentID giving preference to root connections |
@@ -1186,7 +1214,7 @@ namespace OpenSim.Groups | |||
1186 | foreach (Scene scene in m_sceneList) | 1214 | foreach (Scene scene in m_sceneList) |
1187 | { | 1215 | { |
1188 | ScenePresence sp = scene.GetScenePresence(agentID); | 1216 | ScenePresence sp = scene.GetScenePresence(agentID); |
1189 | if (sp != null) | 1217 | if (sp != null&& !sp.IsDeleted) |
1190 | { | 1218 | { |
1191 | if (!sp.IsChildAgent) | 1219 | if (!sp.IsChildAgent) |
1192 | { | 1220 | { |
@@ -1225,43 +1253,15 @@ namespace OpenSim.Groups | |||
1225 | } | 1253 | } |
1226 | } | 1254 | } |
1227 | 1255 | ||
1228 | /// <summary> | ||
1229 | /// Send updates to all clients who might be interested in groups data for dataForClientID | ||
1230 | /// </summary> | ||
1231 | private void UpdateAllClientsWithGroupInfo(UUID dataForClientID) | ||
1232 | { | ||
1233 | if (m_debugEnabled) m_log.InfoFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | ||
1234 | |||
1235 | // TODO: Probably isn't nessesary to update every client in every scene. | ||
1236 | // Need to examine client updates and do only what's nessesary. | ||
1237 | lock (m_sceneList) | ||
1238 | { | ||
1239 | foreach (Scene scene in m_sceneList) | ||
1240 | { | ||
1241 | scene.ForEachClient(delegate (IClientAPI client) { SendAgentGroupDataUpdate(client, dataForClientID); }); | ||
1242 | } | ||
1243 | } | ||
1244 | } | ||
1245 | |||
1246 | public void SendAgentGroupDataUpdate(IClientAPI remoteClient) | 1256 | public void SendAgentGroupDataUpdate(IClientAPI remoteClient) |
1247 | { | 1257 | { |
1248 | SendAgentGroupDataUpdate(remoteClient, GetRequestingAgentID(remoteClient), true); | 1258 | SendAgentGroupDataUpdate(remoteClient, true); |
1249 | } | ||
1250 | |||
1251 | public void SendAgentGroupDataUpdate(IClientAPI remoteClient, UUID dataForClientID) | ||
1252 | { | ||
1253 | SendAgentGroupDataUpdate(remoteClient, dataForClientID, true); | ||
1254 | } | ||
1255 | |||
1256 | private void SendAgentGroupDataUpdate(IClientAPI remoteClient, bool tellOthers) | ||
1257 | { | ||
1258 | SendAgentGroupDataUpdate(remoteClient, GetRequestingAgentID(remoteClient), tellOthers); | ||
1259 | } | 1259 | } |
1260 | 1260 | ||
1261 | /// <summary> | 1261 | /// <summary> |
1262 | /// Tell remoteClient about its agent groups, and optionally send title to others | 1262 | /// Tell remoteClient about its agent groups, and optionally send title to others |
1263 | /// </summary> | 1263 | /// </summary> |
1264 | private void SendAgentGroupDataUpdate(IClientAPI remoteClient, UUID dataForClientID, bool tellOthers) | 1264 | private void SendAgentGroupDataUpdate(IClientAPI remoteClient, bool tellOthers) |
1265 | { | 1265 | { |
1266 | if (m_debugEnabled) m_log.InfoFormat("[Groups]: {0} called for {1}", System.Reflection.MethodBase.GetCurrentMethod().Name, remoteClient.Name); | 1266 | if (m_debugEnabled) m_log.InfoFormat("[Groups]: {0} called for {1}", System.Reflection.MethodBase.GetCurrentMethod().Name, remoteClient.Name); |
1267 | 1267 | ||
@@ -1279,7 +1279,7 @@ namespace OpenSim.Groups | |||
1279 | GroupMembershipData[] membershipArray = GetProfileListedGroupMemberships(remoteClient, agentID); | 1279 | GroupMembershipData[] membershipArray = GetProfileListedGroupMemberships(remoteClient, agentID); |
1280 | IEventQueue eq = remoteClient.Scene.RequestModuleInterface<IEventQueue>(); | 1280 | IEventQueue eq = remoteClient.Scene.RequestModuleInterface<IEventQueue>(); |
1281 | if (eq != null) | 1281 | if (eq != null) |
1282 | eq.GroupMembershipData(GetRequestingAgentID(remoteClient), dataForClientID, membershipArray); | 1282 | eq.GroupMembershipData(agentID, membershipArray); |
1283 | else | 1283 | else |
1284 | remoteClient.SendGroupMembership(membershipArray); | 1284 | remoteClient.SendGroupMembership(membershipArray); |
1285 | 1285 | ||
@@ -1388,7 +1388,7 @@ namespace OpenSim.Groups | |||
1388 | { | 1388 | { |
1389 | if (m_debugEnabled) m_log.InfoFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 1389 | if (m_debugEnabled) m_log.InfoFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); |
1390 | 1390 | ||
1391 | IClientAPI localClient = GetActiveClient(msgTo); | 1391 | IClientAPI localClient = GetActiveRootClient(msgTo); |
1392 | if (localClient != null) | 1392 | if (localClient != null) |
1393 | { | 1393 | { |
1394 | if (m_debugEnabled) m_log.InfoFormat("[Groups]: MsgTo ({0}) is local, delivering directly", localClient.Name); | 1394 | if (m_debugEnabled) m_log.InfoFormat("[Groups]: MsgTo ({0}) is local, delivering directly", localClient.Name); |
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs index d628cfc..9a1cef4 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs | |||
@@ -585,9 +585,9 @@ namespace OpenSim.Region.ClientStack.Linden | |||
585 | Enqueue(item, avatarID); | 585 | Enqueue(item, avatarID); |
586 | } | 586 | } |
587 | 587 | ||
588 | public void GroupMembershipData(UUID receiverAgent, UUID dataForClientID, GroupMembershipData[] data) | 588 | public void GroupMembershipData(UUID receiverAgent, GroupMembershipData[] data) |
589 | { | 589 | { |
590 | OSD item = EventQueueHelper.GroupMembershipData(receiverAgent, dataForClientID, data); | 590 | OSD item = EventQueueHelper.GroupMembershipData(receiverAgent, data); |
591 | Enqueue(item, receiverAgent); | 591 | Enqueue(item, receiverAgent); |
592 | } | 592 | } |
593 | 593 | ||
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs index 7c8f441..29d8b85 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs | |||
@@ -367,7 +367,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
367 | return groupUpdate; | 367 | return groupUpdate; |
368 | } | 368 | } |
369 | 369 | ||
370 | public static OSD GroupMembershipData(UUID receiverAgent, UUID dataForAgentID, GroupMembershipData[] data) | 370 | public static OSD GroupMembershipData(UUID receiverAgent, GroupMembershipData[] data) |
371 | { | 371 | { |
372 | OSDArray AgentData = new OSDArray(1); | 372 | OSDArray AgentData = new OSDArray(1); |
373 | OSDMap AgentDataMap = new OSDMap(1); | 373 | OSDMap AgentDataMap = new OSDMap(1); |
@@ -379,16 +379,6 @@ namespace OpenSim.Region.ClientStack.Linden | |||
379 | 379 | ||
380 | foreach (GroupMembershipData membership in data) | 380 | foreach (GroupMembershipData membership in data) |
381 | { | 381 | { |
382 | if (receiverAgent != dataForAgentID) | ||
383 | { | ||
384 | if (!membership.ListInProfile) | ||
385 | { | ||
386 | // If we're sending group info to remoteclient about another agent, | ||
387 | // filter out groups the other agent doesn't want to share. | ||
388 | continue; | ||
389 | } | ||
390 | } | ||
391 | |||
392 | OSDMap GroupDataMap = new OSDMap(6); | 382 | OSDMap GroupDataMap = new OSDMap(6); |
393 | OSDMap NewGroupDataMap = new OSDMap(1); | 383 | OSDMap NewGroupDataMap = new OSDMap(1); |
394 | 384 | ||
diff --git a/OpenSim/Region/Framework/Interfaces/IEventQueue.cs b/OpenSim/Region/Framework/Interfaces/IEventQueue.cs index 1f29f7b..f4014db 100644 --- a/OpenSim/Region/Framework/Interfaces/IEventQueue.cs +++ b/OpenSim/Region/Framework/Interfaces/IEventQueue.cs | |||
@@ -59,7 +59,7 @@ namespace OpenSim.Region.Framework.Interfaces | |||
59 | bool isModerator, bool textMute); | 59 | bool isModerator, bool textMute); |
60 | void ParcelProperties(ParcelPropertiesMessage parcelPropertiesMessage, UUID avatarID); | 60 | void ParcelProperties(ParcelPropertiesMessage parcelPropertiesMessage, UUID avatarID); |
61 | void GroupMembership(AgentGroupDataUpdatePacket groupUpdate, UUID avatarID); | 61 | void GroupMembership(AgentGroupDataUpdatePacket groupUpdate, UUID avatarID); |
62 | void GroupMembershipData(UUID receiverAgent, UUID dataForClientID, GroupMembershipData[] data); | 62 | void GroupMembershipData(UUID receiverAgent, GroupMembershipData[] data); |
63 | OSD ScriptRunningEvent(UUID objectID, UUID itemID, bool running, bool mono); | 63 | OSD ScriptRunningEvent(UUID objectID, UUID itemID, bool running, bool mono); |
64 | OSD BuildEvent(string eventName, OSD eventBody); | 64 | OSD BuildEvent(string eventName, OSD eventBody); |
65 | void partPhysicsProperties(uint localID, byte physhapetype, float density, float friction, float bounce, float gravmod, UUID avatarID); | 65 | void partPhysicsProperties(uint localID, byte physhapetype, float density, float friction, float bounce, float gravmod, UUID avatarID); |
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs index 62f863b..2617723 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs | |||
@@ -217,6 +217,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
217 | if (!m_groupsEnabled) | 217 | if (!m_groupsEnabled) |
218 | return; | 218 | return; |
219 | 219 | ||
220 | if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | ||
221 | |||
222 | scene.EventManager.OnNewClient -= OnNewClient; | ||
223 | scene.EventManager.OnMakeRootAgent -= OnMakeRoot; | ||
224 | scene.EventManager.OnMakeChildAgent -= OnMakeChild; | ||
225 | scene.EventManager.OnIncomingInstantMessage -= OnGridInstantMessage; | ||
226 | scene.EventManager.OnClientClosed -= OnClientClosed; | ||
220 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 227 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); |
221 | 228 | ||
222 | lock (m_sceneList) | 229 | lock (m_sceneList) |
@@ -442,8 +449,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
442 | 449 | ||
443 | OutgoingInstantMessage(msg, inviteInfo.AgentID); | 450 | OutgoingInstantMessage(msg, inviteInfo.AgentID); |
444 | 451 | ||
445 | UpdateAllClientsWithGroupInfo(inviteInfo.AgentID); | 452 | IClientAPI inviteeClient = GetActiveRootClient(inviteInfo.AgentID); |
446 | 453 | if(inviteeClient !=null) | |
454 | { | ||
455 | SendAgentGroupDataUpdate(inviteeClient,true); | ||
456 | } | ||
447 | m_groupData.RemoveAgentToGroupInvite(GetRequestingAgentID(remoteClient), inviteID); | 457 | m_groupData.RemoveAgentToGroupInvite(GetRequestingAgentID(remoteClient), inviteID); |
448 | } | 458 | } |
449 | 459 | ||
@@ -634,15 +644,16 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
634 | // so we need to send local updates to the agent. | 644 | // so we need to send local updates to the agent. |
635 | 645 | ||
636 | UUID ejecteeID = new UUID(im.toAgentID); | 646 | UUID ejecteeID = new UUID(im.toAgentID); |
637 | 647 | im.imSessionID = UUID.Zero.Guid; | |
638 | im.dialog = (byte)InstantMessageDialog.MessageFromAgent; | 648 | im.dialog = (byte)InstantMessageDialog.MessageFromAgent; |
639 | OutgoingInstantMessage(im, ejecteeID); | 649 | OutgoingInstantMessage(im, ejecteeID); |
640 | 650 | ||
641 | IClientAPI ejectee = GetActiveClient(ejecteeID); | 651 | IClientAPI ejectee = GetActiveRootClient(ejecteeID); |
642 | if (ejectee != null) | 652 | if (ejectee != null) |
643 | { | 653 | { |
644 | UUID groupID = new UUID(im.imSessionID); | 654 | UUID groupID = new UUID(im.imSessionID); |
645 | ejectee.SendAgentDropGroup(groupID); | 655 | ejectee.SendAgentDropGroup(groupID); |
656 | SendAgentGroupDataUpdate(ejectee,true); | ||
646 | } | 657 | } |
647 | } | 658 | } |
648 | } | 659 | } |
@@ -662,7 +673,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
662 | case (byte)InstantMessageDialog.GroupInvitation: | 673 | case (byte)InstantMessageDialog.GroupInvitation: |
663 | case (byte)InstantMessageDialog.GroupNotice: | 674 | case (byte)InstantMessageDialog.GroupNotice: |
664 | UUID toAgentID = new UUID(msg.toAgentID); | 675 | UUID toAgentID = new UUID(msg.toAgentID); |
665 | IClientAPI localClient = GetActiveClient(toAgentID); | 676 | IClientAPI localClient = GetActiveRootClient(toAgentID); |
666 | if (localClient != null) | 677 | if (localClient != null) |
667 | { | 678 | { |
668 | localClient.SendInstantMessage(msg); | 679 | localClient.SendInstantMessage(msg); |
@@ -1149,10 +1160,32 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
1149 | return; | 1160 | return; |
1150 | } | 1161 | } |
1151 | 1162 | ||
1163 | IClientAPI ejecteeClient = GetActiveRootClient(ejecteeID); | ||
1164 | |||
1152 | // Send Message to Ejectee | 1165 | // Send Message to Ejectee |
1153 | GridInstantMessage msg = new GridInstantMessage(); | 1166 | GridInstantMessage msg = new GridInstantMessage(); |
1154 | 1167 | ||
1155 | msg.imSessionID = UUID.Zero.Guid; | 1168 | // if local send a normal message |
1169 | if(ejecteeClient != null) | ||
1170 | { | ||
1171 | msg.imSessionID = UUID.Zero.Guid; | ||
1172 | msg.dialog = (byte)OpenMetaverse.InstantMessageDialog.MessageFromAgent; | ||
1173 | // also execute and send update | ||
1174 | ejecteeClient.SendAgentDropGroup(groupID); | ||
1175 | SendAgentGroupDataUpdate(ejecteeClient,true); | ||
1176 | } | ||
1177 | else // send | ||
1178 | { | ||
1179 | // Interop, received special 210 code for ejecting a group member | ||
1180 | // this only works within the comms servers domain, and won't work hypergrid | ||
1181 | // TODO:FIXME: Use a presence server of some kind to find out where the | ||
1182 | // client actually is, and try contacting that region directly to notify them, | ||
1183 | // or provide the notification via xmlrpc update queue | ||
1184 | |||
1185 | msg.imSessionID = groupInfo.GroupID.Guid; | ||
1186 | msg.dialog = (byte)210; //interop | ||
1187 | } | ||
1188 | |||
1156 | msg.fromAgentID = agentID.Guid; | 1189 | msg.fromAgentID = agentID.Guid; |
1157 | // msg.fromAgentID = info.GroupID; | 1190 | // msg.fromAgentID = info.GroupID; |
1158 | msg.toAgentID = ejecteeID.Guid; | 1191 | msg.toAgentID = ejecteeID.Guid; |
@@ -1160,7 +1193,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
1160 | msg.timestamp = 0; | 1193 | msg.timestamp = 0; |
1161 | msg.fromAgentName = agentName; | 1194 | msg.fromAgentName = agentName; |
1162 | msg.message = string.Format("You have been ejected from '{1}' by {0}.", agentName, groupInfo.GroupName); | 1195 | msg.message = string.Format("You have been ejected from '{1}' by {0}.", agentName, groupInfo.GroupName); |
1163 | msg.dialog = (byte)OpenMetaverse.InstantMessageDialog.MessageFromAgent; | 1196 | // |
1164 | msg.fromGroup = false; | 1197 | msg.fromGroup = false; |
1165 | msg.offline = (byte)0; | 1198 | msg.offline = (byte)0; |
1166 | msg.ParentEstateID = 0; | 1199 | msg.ParentEstateID = 0; |
@@ -1170,11 +1203,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
1170 | OutgoingInstantMessage(msg, ejecteeID); | 1203 | OutgoingInstantMessage(msg, ejecteeID); |
1171 | 1204 | ||
1172 | // Message to ejector | 1205 | // Message to ejector |
1173 | // Interop, received special 210 code for ejecting a group member | ||
1174 | // this only works within the comms servers domain, and won't work hypergrid | ||
1175 | // TODO:FIXME: Use a presence server of some kind to find out where the | ||
1176 | // client actually is, and try contacting that region directly to notify them, | ||
1177 | // or provide the notification via xmlrpc update queue | ||
1178 | 1206 | ||
1179 | msg = new GridInstantMessage(); | 1207 | msg = new GridInstantMessage(); |
1180 | msg.imSessionID = UUID.Zero.Guid; | 1208 | msg.imSessionID = UUID.Zero.Guid; |
@@ -1190,7 +1218,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
1190 | { | 1218 | { |
1191 | msg.message = string.Format("{2} has been ejected from '{1}' by {0}.", agentName, groupInfo.GroupName, "Unknown member"); | 1219 | msg.message = string.Format("{2} has been ejected from '{1}' by {0}.", agentName, groupInfo.GroupName, "Unknown member"); |
1192 | } | 1220 | } |
1193 | msg.dialog = (byte)210; //interop | 1221 | // msg.dialog = (byte)210; //interop |
1222 | msg.dialog = (byte)OpenMetaverse.InstantMessageDialog.MessageFromAgent; | ||
1194 | msg.fromGroup = false; | 1223 | msg.fromGroup = false; |
1195 | msg.offline = (byte)0; | 1224 | msg.offline = (byte)0; |
1196 | msg.ParentEstateID = 0; | 1225 | msg.ParentEstateID = 0; |
@@ -1198,11 +1227,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
1198 | msg.RegionID = regionInfo.RegionID.Guid; | 1227 | msg.RegionID = regionInfo.RegionID.Guid; |
1199 | msg.binaryBucket = new byte[0]; | 1228 | msg.binaryBucket = new byte[0]; |
1200 | OutgoingInstantMessage(msg, agentID); | 1229 | OutgoingInstantMessage(msg, agentID); |
1201 | |||
1202 | // SL sends out messages to everyone in the group | ||
1203 | // Who all should receive updates and what should they be updated with? | ||
1204 | // just tell this the group change | ||
1205 | UpdateAllClientsWithGroupInfo(ejecteeID); | ||
1206 | } | 1230 | } |
1207 | 1231 | ||
1208 | public void InviteGroupRequest(IClientAPI remoteClient, UUID groupID, UUID invitedAgentID, UUID roleID) | 1232 | public void InviteGroupRequest(IClientAPI remoteClient, UUID groupID, UUID invitedAgentID, UUID roleID) |
@@ -1297,6 +1321,19 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
1297 | 1321 | ||
1298 | #region Client/Update Tools | 1322 | #region Client/Update Tools |
1299 | 1323 | ||
1324 | private IClientAPI GetActiveRootClient(UUID agentID) | ||
1325 | { | ||
1326 | foreach (Scene scene in m_sceneList) | ||
1327 | { | ||
1328 | ScenePresence sp = scene.GetScenePresence(agentID); | ||
1329 | if (sp != null && !sp.IsChildAgent && !sp.IsDeleted) | ||
1330 | { | ||
1331 | return sp.ControllingClient; | ||
1332 | } | ||
1333 | } | ||
1334 | return null; | ||
1335 | } | ||
1336 | |||
1300 | /// <summary> | 1337 | /// <summary> |
1301 | /// Try to find an active IClientAPI reference for agentID giving preference to root connections | 1338 | /// Try to find an active IClientAPI reference for agentID giving preference to root connections |
1302 | /// </summary> | 1339 | /// </summary> |
@@ -1308,7 +1345,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
1308 | foreach (Scene scene in m_sceneList) | 1345 | foreach (Scene scene in m_sceneList) |
1309 | { | 1346 | { |
1310 | ScenePresence sp = scene.GetScenePresence(agentID); | 1347 | ScenePresence sp = scene.GetScenePresence(agentID); |
1311 | if (sp != null) | 1348 | if (sp != null && !sp.IsDeleted) |
1312 | { | 1349 | { |
1313 | if (!sp.IsChildAgent) | 1350 | if (!sp.IsChildAgent) |
1314 | { | 1351 | { |
@@ -1347,43 +1384,15 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
1347 | } | 1384 | } |
1348 | } | 1385 | } |
1349 | 1386 | ||
1350 | /// <summary> | ||
1351 | /// Send updates to all clients who might be interested in groups data for dataForClientID | ||
1352 | /// </summary> | ||
1353 | private void UpdateAllClientsWithGroupInfo(UUID dataForClientID) | ||
1354 | { | ||
1355 | if (m_debugEnabled) m_log.InfoFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | ||
1356 | |||
1357 | // TODO: Probably isn't nessesary to update every client in every scene. | ||
1358 | // Need to examine client updates and do only what's nessesary. | ||
1359 | lock (m_sceneList) | ||
1360 | { | ||
1361 | foreach (Scene scene in m_sceneList) | ||
1362 | { | ||
1363 | scene.ForEachClient(delegate (IClientAPI client) { SendAgentGroupDataUpdate(client, dataForClientID); }); | ||
1364 | } | ||
1365 | } | ||
1366 | } | ||
1367 | |||
1368 | public void SendAgentGroupDataUpdate(IClientAPI remoteClient) | 1387 | public void SendAgentGroupDataUpdate(IClientAPI remoteClient) |
1369 | { | 1388 | { |
1370 | SendAgentGroupDataUpdate(remoteClient, true); | 1389 | SendAgentGroupDataUpdate(remoteClient, true); |
1371 | } | 1390 | } |
1372 | 1391 | ||
1373 | public void SendAgentGroupDataUpdate(IClientAPI remoteClient, UUID dataForClientID) | ||
1374 | { | ||
1375 | SendAgentGroupDataUpdate(remoteClient, dataForClientID, true); | ||
1376 | } | ||
1377 | |||
1378 | private void SendAgentGroupDataUpdate(IClientAPI remoteClient, bool tellOthers) | ||
1379 | { | ||
1380 | SendAgentGroupDataUpdate(remoteClient, GetRequestingAgentID(remoteClient), tellOthers); | ||
1381 | } | ||
1382 | |||
1383 | /// <summary> | 1392 | /// <summary> |
1384 | /// Tell remoteClient about its agent groups, and optionally send title to others | 1393 | /// Tell remoteClient about its agent groups, and optionally send title to others |
1385 | /// </summary> | 1394 | /// </summary> |
1386 | private void SendAgentGroupDataUpdate(IClientAPI remoteClient, UUID dataForClientID, bool tellOthers) | 1395 | private void SendAgentGroupDataUpdate(IClientAPI remoteClient, bool tellOthers) |
1387 | { | 1396 | { |
1388 | if (m_debugEnabled) m_log.InfoFormat("[GROUPS]: {0} called for {1}", System.Reflection.MethodBase.GetCurrentMethod().Name, remoteClient.Name); | 1397 | if (m_debugEnabled) m_log.InfoFormat("[GROUPS]: {0} called for {1}", System.Reflection.MethodBase.GetCurrentMethod().Name, remoteClient.Name); |
1389 | 1398 | ||
@@ -1401,7 +1410,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
1401 | GroupMembershipData[] membershipArray = GetProfileListedGroupMemberships(remoteClient, agentID); | 1410 | GroupMembershipData[] membershipArray = GetProfileListedGroupMemberships(remoteClient, agentID); |
1402 | IEventQueue eq = remoteClient.Scene.RequestModuleInterface<IEventQueue>(); | 1411 | IEventQueue eq = remoteClient.Scene.RequestModuleInterface<IEventQueue>(); |
1403 | if (eq != null) | 1412 | if (eq != null) |
1404 | eq.GroupMembershipData(GetRequestingAgentID(remoteClient), dataForClientID, membershipArray); | 1413 | eq.GroupMembershipData(agentID, membershipArray); |
1405 | else | 1414 | else |
1406 | remoteClient.SendGroupMembership(membershipArray); | 1415 | remoteClient.SendGroupMembership(membershipArray); |
1407 | 1416 | ||
@@ -1510,7 +1519,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
1510 | { | 1519 | { |
1511 | if (m_debugEnabled) m_log.InfoFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 1520 | if (m_debugEnabled) m_log.InfoFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); |
1512 | 1521 | ||
1513 | IClientAPI localClient = GetActiveClient(msgTo); | 1522 | IClientAPI localClient = GetActiveRootClient(msgTo); |
1514 | if (localClient != null) | 1523 | if (localClient != null) |
1515 | { | 1524 | { |
1516 | if (m_debugEnabled) m_log.InfoFormat("[GROUPS]: MsgTo ({0}) is local, delivering directly", localClient.Name); | 1525 | if (m_debugEnabled) m_log.InfoFormat("[GROUPS]: MsgTo ({0}) is local, delivering directly", localClient.Name); |
diff --git a/OpenSim/Tests/Common/Mock/TestEventQueueGetModule.cs b/OpenSim/Tests/Common/Mock/TestEventQueueGetModule.cs index 192f84f..332d59c 100644 --- a/OpenSim/Tests/Common/Mock/TestEventQueueGetModule.cs +++ b/OpenSim/Tests/Common/Mock/TestEventQueueGetModule.cs | |||
@@ -162,7 +162,7 @@ namespace OpenSim.Tests.Common | |||
162 | AddEvent(avatarID, "GroupMembership", groupUpdate); | 162 | AddEvent(avatarID, "GroupMembership", groupUpdate); |
163 | } | 163 | } |
164 | 164 | ||
165 | public void GroupMembershipData(UUID receiverAgent, UUID dataForClientID, GroupMembershipData[] data) | 165 | public void GroupMembershipData(UUID receiverAgent, GroupMembershipData[] data) |
166 | { | 166 | { |
167 | AddEvent(receiverAgent, "AgentGroupDataUpdate", data); | 167 | AddEvent(receiverAgent, "AgentGroupDataUpdate", data); |
168 | } | 168 | } |