diff options
Diffstat (limited to '')
5 files changed, 94 insertions, 136 deletions
diff --git a/OpenSim/Framework/Communications/CommunicationsManager.cs b/OpenSim/Framework/Communications/CommunicationsManager.cs index 936e583..e0e07b2 100644 --- a/OpenSim/Framework/Communications/CommunicationsManager.cs +++ b/OpenSim/Framework/Communications/CommunicationsManager.cs | |||
@@ -324,16 +324,6 @@ namespace OpenSim.Framework.Communications | |||
324 | return m_messageService.GetFriendRegionInfos(uuids); | 324 | return m_messageService.GetFriendRegionInfos(uuids); |
325 | } | 325 | } |
326 | 326 | ||
327 | public List<UUID> InformFriendsInOtherRegion(UUID agentId, ulong destRegionHandle, List<UUID> friends, bool online) | ||
328 | { | ||
329 | return m_interRegion.InformFriendsInOtherRegion(agentId, destRegionHandle, friends, online); | ||
330 | } | ||
331 | |||
332 | public bool TriggerTerminateFriend(ulong regionHandle, UUID agentID, UUID exFriendID) | ||
333 | { | ||
334 | return m_interRegion.TriggerTerminateFriend(regionHandle, agentID, exFriendID); | ||
335 | } | ||
336 | |||
337 | #endregion | 327 | #endregion |
338 | 328 | ||
339 | #region Packet Handlers | 329 | #region Packet Handlers |
diff --git a/OpenSim/Framework/Communications/IInterRegionCommunications.cs b/OpenSim/Framework/Communications/IInterRegionCommunications.cs index 6b589b9..2d4eb53 100644 --- a/OpenSim/Framework/Communications/IInterRegionCommunications.cs +++ b/OpenSim/Framework/Communications/IInterRegionCommunications.cs | |||
@@ -48,41 +48,5 @@ namespace OpenSim.Framework.Communications | |||
48 | 48 | ||
49 | bool TellRegionToCloseChildConnection(ulong regionHandle, UUID agentID); | 49 | bool TellRegionToCloseChildConnection(ulong regionHandle, UUID agentID); |
50 | 50 | ||
51 | /// <summary> | ||
52 | /// Try to inform friends in the given region about online status of agent. | ||
53 | /// </summary> | ||
54 | /// <param name="agentId"> | ||
55 | /// The <see cref="UUID"/> of the agent. | ||
56 | /// </param> | ||
57 | /// <param name="destRegionHandle"> | ||
58 | /// The regionHandle of the region. | ||
59 | /// </param> | ||
60 | /// <param name="friends"> | ||
61 | /// A List of <see cref="UUID"/>s of friends to inform in the given region. | ||
62 | /// </param> | ||
63 | /// <param name="online"> | ||
64 | /// Is the agent online or offline | ||
65 | /// </param> | ||
66 | /// <returns> | ||
67 | /// A list of friends that couldn't be reached on this region. | ||
68 | /// </returns> | ||
69 | List<UUID> InformFriendsInOtherRegion(UUID agentId, ulong destRegionHandle, List<UUID> friends, bool online); | ||
70 | |||
71 | /// <summary> | ||
72 | /// Send TerminateFriend of exFriendID to agent agentID in region regionHandle. | ||
73 | /// </summary> | ||
74 | /// <param name="regionHandle"> | ||
75 | /// The handle of the region agentID is in (hopefully). | ||
76 | /// </param> | ||
77 | /// <param name="agentID"> | ||
78 | /// The agent to send the packet to. | ||
79 | /// </param> | ||
80 | /// <param name="exFriendID"> | ||
81 | /// The ex-friends ID. | ||
82 | /// </param> | ||
83 | /// <returns> | ||
84 | /// Whether the packet could be sent. False if the agent couldn't be found in the region. | ||
85 | /// </returns> | ||
86 | bool TriggerTerminateFriend(ulong regionHandle, UUID agentID, UUID exFriendID); | ||
87 | } | 51 | } |
88 | } | 52 | } |
diff --git a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs index 1da7621..660e684 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs | |||
@@ -1810,83 +1810,5 @@ namespace OpenSim.Region.Communications.OGS1 | |||
1810 | return null; | 1810 | return null; |
1811 | } | 1811 | } |
1812 | } | 1812 | } |
1813 | |||
1814 | public List<UUID> InformFriendsInOtherRegion(UUID agentId, ulong destRegionHandle, List<UUID> friends, bool online) | ||
1815 | { | ||
1816 | List<UUID> tpdAway = new List<UUID>(); | ||
1817 | |||
1818 | // destRegionHandle is a region on another server | ||
1819 | RegionInfo info = RequestNeighbourInfo(destRegionHandle); | ||
1820 | if (info != null) | ||
1821 | { | ||
1822 | string httpServer = "http://" + info.ExternalEndPoint.Address + ":" + info.HttpPort + "/presence_update_bulk"; | ||
1823 | |||
1824 | Hashtable reqParams = new Hashtable(); | ||
1825 | reqParams["agentID"] = agentId.ToString(); | ||
1826 | reqParams["agentOnline"] = online; | ||
1827 | int count = 0; | ||
1828 | foreach (UUID uuid in friends) | ||
1829 | { | ||
1830 | reqParams["friendID_" + count++] = uuid.ToString(); | ||
1831 | } | ||
1832 | reqParams["friendCount"] = count; | ||
1833 | |||
1834 | IList parameters = new ArrayList(); | ||
1835 | parameters.Add(reqParams); | ||
1836 | try | ||
1837 | { | ||
1838 | XmlRpcRequest request = new XmlRpcRequest("presence_update_bulk", parameters); | ||
1839 | XmlRpcResponse response = request.Send(httpServer, 5000); | ||
1840 | Hashtable respData = (Hashtable)response.Value; | ||
1841 | |||
1842 | count = (int)respData["friendCount"]; | ||
1843 | for (int i = 0; i < count; ++i) | ||
1844 | { | ||
1845 | UUID uuid; | ||
1846 | if (UUID.TryParse((string)respData["friendID_" + i], out uuid)) tpdAway.Add(uuid); | ||
1847 | } | ||
1848 | } | ||
1849 | catch (Exception e) | ||
1850 | { | ||
1851 | m_log.Error("[OGS1 GRID SERVICES]: InformFriendsInOtherRegion XMLRPC failure: ", e); | ||
1852 | } | ||
1853 | } | ||
1854 | else m_log.WarnFormat("[OGS1 GRID SERVICES]: Couldn't find region {0}???", destRegionHandle); | ||
1855 | |||
1856 | return tpdAway; | ||
1857 | } | ||
1858 | |||
1859 | public bool TriggerTerminateFriend(ulong destRegionHandle, UUID agentID, UUID exFriendID) | ||
1860 | { | ||
1861 | // destRegionHandle is a region on another server | ||
1862 | RegionInfo info = RequestNeighbourInfo(destRegionHandle); | ||
1863 | if (info == null) | ||
1864 | { | ||
1865 | m_log.WarnFormat("[OGS1 GRID SERVICES]: Couldn't find region {0}", destRegionHandle); | ||
1866 | return false; // region not found??? | ||
1867 | } | ||
1868 | |||
1869 | string httpServer = "http://" + info.ExternalEndPoint.Address + ":" + info.HttpPort + "/presence_update_bulk"; | ||
1870 | |||
1871 | Hashtable reqParams = new Hashtable(); | ||
1872 | reqParams["agentID"] = agentID.ToString(); | ||
1873 | reqParams["friendID"] = exFriendID.ToString(); | ||
1874 | |||
1875 | IList parameters = new ArrayList(); | ||
1876 | parameters.Add(reqParams); | ||
1877 | try | ||
1878 | { | ||
1879 | XmlRpcRequest request = new XmlRpcRequest("terminate_friend", parameters); | ||
1880 | XmlRpcResponse response = request.Send(httpServer, 5000); | ||
1881 | Hashtable respData = (Hashtable)response.Value; | ||
1882 | |||
1883 | return (bool)respData["success"]; | ||
1884 | } | ||
1885 | catch (Exception e) | ||
1886 | { | ||
1887 | m_log.Error("[OGS1 GRID SERVICES]: InformFriendsInOtherRegion XMLRPC failure: ", e); | ||
1888 | return false; | ||
1889 | } | ||
1890 | } | ||
1891 | } | 1813 | } |
1892 | } | 1814 | } |
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs index f23f4e0..d91e10d 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs | |||
@@ -34,6 +34,7 @@ using Nini.Config; | |||
34 | using Nwc.XmlRpc; | 34 | using Nwc.XmlRpc; |
35 | using OpenMetaverse; | 35 | using OpenMetaverse; |
36 | using OpenSim.Framework; | 36 | using OpenSim.Framework; |
37 | using OpenSim.Framework.Communications; | ||
37 | using OpenSim.Framework.Communications.Cache; | 38 | using OpenSim.Framework.Communications.Cache; |
38 | using OpenSim.Region.Framework.Interfaces; | 39 | using OpenSim.Region.Framework.Interfaces; |
39 | using OpenSim.Region.Framework.Scenes; | 40 | using OpenSim.Region.Framework.Scenes; |
@@ -105,6 +106,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
105 | private Dictionary<ulong, Scene> m_scenes = new Dictionary<ulong,Scene>(); | 106 | private Dictionary<ulong, Scene> m_scenes = new Dictionary<ulong,Scene>(); |
106 | private IMessageTransferModule m_TransferModule = null; | 107 | private IMessageTransferModule m_TransferModule = null; |
107 | 108 | ||
109 | private IGridServices m_gridServices = null; | ||
110 | |||
108 | #region IRegionModule Members | 111 | #region IRegionModule Members |
109 | 112 | ||
110 | public void Initialise(Scene scene, IConfigSource config) | 113 | public void Initialise(Scene scene, IConfigSource config) |
@@ -137,6 +140,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
137 | if (m_scenes.Count > 0) | 140 | if (m_scenes.Count > 0) |
138 | { | 141 | { |
139 | m_TransferModule = m_initialScene.RequestModuleInterface<IMessageTransferModule>(); | 142 | m_TransferModule = m_initialScene.RequestModuleInterface<IMessageTransferModule>(); |
143 | m_gridServices = m_initialScene.CommsManager.GridService; | ||
140 | } | 144 | } |
141 | if (m_TransferModule == null) | 145 | if (m_TransferModule == null) |
142 | m_log.Error("[FRIENDS]: Unable to find a message transfer module, friendship offers will not work"); | 146 | m_log.Error("[FRIENDS]: Unable to find a message transfer module, friendship offers will not work"); |
@@ -158,6 +162,89 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
158 | 162 | ||
159 | #endregion | 163 | #endregion |
160 | 164 | ||
165 | #region IInterregionFriendsComms | ||
166 | |||
167 | public List<UUID> InformFriendsInOtherRegion(UUID agentId, ulong destRegionHandle, List<UUID> friends, bool online) | ||
168 | { | ||
169 | List<UUID> tpdAway = new List<UUID>(); | ||
170 | |||
171 | // destRegionHandle is a region on another server | ||
172 | RegionInfo info = m_gridServices.RequestNeighbourInfo(destRegionHandle); | ||
173 | if (info != null) | ||
174 | { | ||
175 | string httpServer = "http://" + info.ExternalEndPoint.Address + ":" + info.HttpPort + "/presence_update_bulk"; | ||
176 | |||
177 | Hashtable reqParams = new Hashtable(); | ||
178 | reqParams["agentID"] = agentId.ToString(); | ||
179 | reqParams["agentOnline"] = online; | ||
180 | int count = 0; | ||
181 | foreach (UUID uuid in friends) | ||
182 | { | ||
183 | reqParams["friendID_" + count++] = uuid.ToString(); | ||
184 | } | ||
185 | reqParams["friendCount"] = count; | ||
186 | |||
187 | IList parameters = new ArrayList(); | ||
188 | parameters.Add(reqParams); | ||
189 | try | ||
190 | { | ||
191 | XmlRpcRequest request = new XmlRpcRequest("presence_update_bulk", parameters); | ||
192 | XmlRpcResponse response = request.Send(httpServer, 5000); | ||
193 | Hashtable respData = (Hashtable)response.Value; | ||
194 | |||
195 | count = (int)respData["friendCount"]; | ||
196 | for (int i = 0; i < count; ++i) | ||
197 | { | ||
198 | UUID uuid; | ||
199 | if (UUID.TryParse((string)respData["friendID_" + i], out uuid)) tpdAway.Add(uuid); | ||
200 | } | ||
201 | } | ||
202 | catch (Exception e) | ||
203 | { | ||
204 | m_log.Error("[OGS1 GRID SERVICES]: InformFriendsInOtherRegion XMLRPC failure: ", e); | ||
205 | } | ||
206 | } | ||
207 | else m_log.WarnFormat("[OGS1 GRID SERVICES]: Couldn't find region {0}???", destRegionHandle); | ||
208 | |||
209 | return tpdAway; | ||
210 | } | ||
211 | |||
212 | public bool TriggerTerminateFriend(ulong destRegionHandle, UUID agentID, UUID exFriendID) | ||
213 | { | ||
214 | // destRegionHandle is a region on another server | ||
215 | RegionInfo info = m_gridServices.RequestNeighbourInfo(destRegionHandle); | ||
216 | if (info == null) | ||
217 | { | ||
218 | m_log.WarnFormat("[OGS1 GRID SERVICES]: Couldn't find region {0}", destRegionHandle); | ||
219 | return false; // region not found??? | ||
220 | } | ||
221 | |||
222 | string httpServer = "http://" + info.ExternalEndPoint.Address + ":" + info.HttpPort + "/presence_update_bulk"; | ||
223 | |||
224 | Hashtable reqParams = new Hashtable(); | ||
225 | reqParams["agentID"] = agentID.ToString(); | ||
226 | reqParams["friendID"] = exFriendID.ToString(); | ||
227 | |||
228 | IList parameters = new ArrayList(); | ||
229 | parameters.Add(reqParams); | ||
230 | try | ||
231 | { | ||
232 | XmlRpcRequest request = new XmlRpcRequest("terminate_friend", parameters); | ||
233 | XmlRpcResponse response = request.Send(httpServer, 5000); | ||
234 | Hashtable respData = (Hashtable)response.Value; | ||
235 | |||
236 | return (bool)respData["success"]; | ||
237 | } | ||
238 | catch (Exception e) | ||
239 | { | ||
240 | m_log.Error("[OGS1 GRID SERVICES]: InformFriendsInOtherRegion XMLRPC failure: ", e); | ||
241 | return false; | ||
242 | } | ||
243 | } | ||
244 | |||
245 | #endregion | ||
246 | |||
247 | #region Incoming XMLRPC messages | ||
161 | /// <summary> | 248 | /// <summary> |
162 | /// Receive presence information changes about clients in other regions. | 249 | /// Receive presence information changes about clients in other regions. |
163 | /// </summary> | 250 | /// </summary> |
@@ -264,6 +351,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
264 | return response; | 351 | return response; |
265 | } | 352 | } |
266 | 353 | ||
354 | #endregion | ||
355 | |||
356 | #region Scene events | ||
357 | |||
267 | private void OnNewClient(IClientAPI client) | 358 | private void OnNewClient(IClientAPI client) |
268 | { | 359 | { |
269 | // All friends establishment protocol goes over instant message | 360 | // All friends establishment protocol goes over instant message |
@@ -331,6 +422,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
331 | } | 422 | } |
332 | } | 423 | } |
333 | } | 424 | } |
425 | #endregion | ||
334 | 426 | ||
335 | private ScenePresence GetRootPresenceFromAgentID(UUID AgentID) | 427 | private ScenePresence GetRootPresenceFromAgentID(UUID AgentID) |
336 | { | 428 | { |
@@ -681,7 +773,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
681 | agentID, exfriendID, data.Handle); | 773 | agentID, exfriendID, data.Handle); |
682 | 774 | ||
683 | // try to send to foreign region, retry if it fails (friend TPed away, for example) | 775 | // try to send to foreign region, retry if it fails (friend TPed away, for example) |
684 | if (m_initialScene.TriggerTerminateFriend(data.Handle, exfriendID, agentID)) break; | 776 | if (TriggerTerminateFriend(data.Handle, exfriendID, agentID)) break; |
685 | } | 777 | } |
686 | } | 778 | } |
687 | 779 | ||
@@ -942,7 +1034,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
942 | //m_log.DebugFormat("[FRIEND]: Inform {0} friends in region {1} that user {2} is {3}line", | 1034 | //m_log.DebugFormat("[FRIEND]: Inform {0} friends in region {1} that user {2} is {3}line", |
943 | // pair.Value.Count, pair.Key, client.Name, iAmOnline ? "on" : "off"); | 1035 | // pair.Value.Count, pair.Key, client.Name, iAmOnline ? "on" : "off"); |
944 | 1036 | ||
945 | friendIDsToSendTo.AddRange(m_initialScene.InformFriendsInOtherRegion(client.AgentId, pair.Key, pair.Value, iAmOnline)); | 1037 | friendIDsToSendTo.AddRange(InformFriendsInOtherRegion(client.AgentId, pair.Key, pair.Value, iAmOnline)); |
946 | } | 1038 | } |
947 | } | 1039 | } |
948 | // now we have in friendIDsToSendTo only the agents left that TPed away while we tried to contact them. | 1040 | // now we have in friendIDsToSendTo only the agents left that TPed away while we tried to contact them. |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 23c4478..1f6d647 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -2743,16 +2743,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2743 | return CommsManager.GetFriendRegionInfos(uuids); | 2743 | return CommsManager.GetFriendRegionInfos(uuids); |
2744 | } | 2744 | } |
2745 | 2745 | ||
2746 | public List<UUID> InformFriendsInOtherRegion(UUID agentId, ulong destRegionHandle, List<UUID> friends, bool online) | ||
2747 | { | ||
2748 | return CommsManager.InformFriendsInOtherRegion(agentId, destRegionHandle, friends, online); | ||
2749 | } | ||
2750 | |||
2751 | public bool TriggerTerminateFriend(ulong regionHandle, UUID agentID, UUID exFriendID) | ||
2752 | { | ||
2753 | return CommsManager.TriggerTerminateFriend(regionHandle, agentID, exFriendID); | ||
2754 | } | ||
2755 | |||
2756 | public virtual void StoreAddFriendship(UUID ownerID, UUID friendID, uint perms) | 2746 | public virtual void StoreAddFriendship(UUID ownerID, UUID friendID, uint perms) |
2757 | { | 2747 | { |
2758 | m_sceneGridService.AddNewUserFriend(ownerID, friendID, perms); | 2748 | m_sceneGridService.AddNewUserFriend(ownerID, friendID, perms); |