aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/OptionalModules
diff options
context:
space:
mode:
authorUbitUmarov2016-07-01 16:10:45 +0100
committerUbitUmarov2016-07-01 16:10:45 +0100
commit9358a6ad2979929655d0e25d404596772607f75b (patch)
tree4a4b8638a89258cb5c51092cbc472a78f3a2e8cb /OpenSim/Region/OptionalModules
parentchange ubOde module, hopefully for better handling of multiple scenes on same... (diff)
downloadopensim-SC_OLD-9358a6ad2979929655d0e25d404596772607f75b.zip
opensim-SC_OLD-9358a6ad2979929655d0e25d404596772607f75b.tar.gz
opensim-SC_OLD-9358a6ad2979929655d0e25d404596772607f75b.tar.bz2
opensim-SC_OLD-9358a6ad2979929655d0e25d404596772607f75b.tar.xz
revert several changes to groups modules (agentGroupData is private). change interregions invite/eject messages, etc
Diffstat (limited to 'OpenSim/Region/OptionalModules')
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs109
1 files changed, 59 insertions, 50 deletions
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);