diff options
Diffstat (limited to 'OpenSim/Region/Communications/OGS1/OGS1GridServices.cs')
-rw-r--r-- | OpenSim/Region/Communications/OGS1/OGS1GridServices.cs | 80 |
1 files changed, 79 insertions, 1 deletions
diff --git a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs index 32628f8..d9e0370 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs | |||
@@ -1785,5 +1785,83 @@ namespace OpenSim.Region.Communications.OGS1 | |||
1785 | return null; | 1785 | return null; |
1786 | } | 1786 | } |
1787 | } | 1787 | } |
1788 | |||
1789 | public List<UUID> InformFriendsInOtherRegion(UUID agentId, ulong destRegionHandle, List<UUID> friends, bool online) | ||
1790 | { | ||
1791 | List<UUID> tpdAway = new List<UUID>(); | ||
1792 | |||
1793 | // destRegionHandle is a region on another server | ||
1794 | RegionInfo info = RequestNeighbourInfo(destRegionHandle); | ||
1795 | if (info != null) | ||
1796 | { | ||
1797 | string httpServer = "http://" + info.ExternalEndPoint.Address + ":" + info.HttpPort + "/presence_update_bulk"; | ||
1798 | |||
1799 | Hashtable reqParams = new Hashtable(); | ||
1800 | reqParams["agentID"] = agentId.ToString(); | ||
1801 | reqParams["agentOnline"] = online; | ||
1802 | int count = 0; | ||
1803 | foreach (UUID uuid in friends) | ||
1804 | { | ||
1805 | reqParams["friendID_" + count++] = uuid.ToString(); | ||
1806 | } | ||
1807 | reqParams["friendCount"] = count; | ||
1808 | |||
1809 | IList parameters = new ArrayList(); | ||
1810 | parameters.Add(reqParams); | ||
1811 | try | ||
1812 | { | ||
1813 | XmlRpcRequest request = new XmlRpcRequest("presence_update_bulk", parameters); | ||
1814 | XmlRpcResponse response = request.Send(httpServer, 5000); | ||
1815 | Hashtable respData = (Hashtable)response.Value; | ||
1816 | |||
1817 | count = (int)respData["friendCount"]; | ||
1818 | for (int i = 0; i < count; ++i) | ||
1819 | { | ||
1820 | UUID uuid; | ||
1821 | if(UUID.TryParse((string)respData["friendID_" + i], out uuid)) tpdAway.Add(uuid); | ||
1822 | } | ||
1823 | } | ||
1824 | catch(Exception e) | ||
1825 | { | ||
1826 | m_log.Error("[OGS1 GRID SERVICES]: InformFriendsInOtherRegion XMLRPC failure: ", e); | ||
1827 | } | ||
1828 | } | ||
1829 | else m_log.WarnFormat("[OGS1 GRID SERVICES]: Couldn't find region {0}???", destRegionHandle); | ||
1830 | |||
1831 | return tpdAway; | ||
1832 | } | ||
1833 | |||
1834 | public bool TriggerTerminateFriend(ulong destRegionHandle, UUID agentID, UUID exFriendID) | ||
1835 | { | ||
1836 | // destRegionHandle is a region on another server | ||
1837 | RegionInfo info = RequestNeighbourInfo(destRegionHandle); | ||
1838 | if (info == null) | ||
1839 | { | ||
1840 | m_log.WarnFormat("[OGS1 GRID SERVICES]: Couldn't find region {0}", destRegionHandle); | ||
1841 | return false; // region not found??? | ||
1842 | } | ||
1843 | |||
1844 | string httpServer = "http://" + info.ExternalEndPoint.Address + ":" + info.HttpPort + "/presence_update_bulk"; | ||
1845 | |||
1846 | Hashtable reqParams = new Hashtable(); | ||
1847 | reqParams["agentID"] = agentID.ToString(); | ||
1848 | reqParams["friendID"] = exFriendID.ToString(); | ||
1849 | |||
1850 | IList parameters = new ArrayList(); | ||
1851 | parameters.Add(reqParams); | ||
1852 | try | ||
1853 | { | ||
1854 | XmlRpcRequest request = new XmlRpcRequest("terminate_friend", parameters); | ||
1855 | XmlRpcResponse response = request.Send(httpServer, 5000); | ||
1856 | Hashtable respData = (Hashtable)response.Value; | ||
1857 | |||
1858 | return (bool)respData["success"]; | ||
1859 | } | ||
1860 | catch(Exception e) | ||
1861 | { | ||
1862 | m_log.Error("[OGS1 GRID SERVICES]: InformFriendsInOtherRegion XMLRPC failure: ", e); | ||
1863 | return false; | ||
1864 | } | ||
1865 | } | ||
1788 | } | 1866 | } |
1789 | } \ No newline at end of file | 1867 | } |