diff options
Diffstat (limited to 'OpenSim/Addons/Groups/GroupsModule.cs')
-rw-r--r-- | OpenSim/Addons/Groups/GroupsModule.cs | 102 |
1 files changed, 51 insertions, 51 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); |