aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Communications/OGS1
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Communications/OGS1')
-rw-r--r--OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs4
-rw-r--r--OpenSim/Region/Communications/OGS1/OGS1GridServices.cs80
-rw-r--r--OpenSim/Region/Communications/OGS1/OGS1UserServices.cs60
3 files changed, 141 insertions, 3 deletions
diff --git a/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs b/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs
index d76f076..7f6fbc8 100644
--- a/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs
+++ b/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs
@@ -56,7 +56,9 @@ namespace OpenSim.Region.Communications.OGS1
56 m_defaultInventoryHost = invService.Host; 56 m_defaultInventoryHost = invService.Host;
57 } 57 }
58 58
59 m_userService = new OGS1UserServices(this); 59 OGS1UserServices userServices = new OGS1UserServices(this);
60 m_userService = userServices;
61 m_messageService = userServices;
60 m_avatarService = (IAvatarService)m_userService; 62 m_avatarService = (IAvatarService)m_userService;
61 } 63 }
62 64
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}
diff --git a/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs b/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs
index 28177d0..595c4a9 100644
--- a/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs
+++ b/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs
@@ -39,7 +39,7 @@ using OpenSim.Framework.Communications;
39 39
40namespace OpenSim.Region.Communications.OGS1 40namespace OpenSim.Region.Communications.OGS1
41{ 41{
42 public class OGS1UserServices : IUserService, IAvatarService 42 public class OGS1UserServices : IUserService, IAvatarService, IMessagingService
43 { 43 {
44 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 44 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
45 45
@@ -722,6 +722,64 @@ namespace OpenSim.Region.Communications.OGS1
722 return buddylist; 722 return buddylist;
723 } 723 }
724 724
725 public Dictionary<UUID, FriendRegionInfo> GetFriendRegionInfos (List<UUID> uuids)
726 {
727 Dictionary<UUID, FriendRegionInfo> result = new Dictionary<UUID, FriendRegionInfo>();
728
729 // ask MessageServer about the current on-/offline status and regions the friends are in
730 ArrayList parameters = new ArrayList();
731 Hashtable map = new Hashtable();
732
733 ArrayList list = new ArrayList();
734 foreach (UUID uuid in uuids)
735 {
736 list.Add(uuid.ToString());
737 list.Add(uuid.ToString());
738 }
739 map["uuids"] = list;
740
741 map["recv_key"] = m_parent.NetworkServersInfo.UserRecvKey;
742 map["send_key"] = m_parent.NetworkServersInfo.UserRecvKey;
743
744 parameters.Add(map);
745
746 try {
747 XmlRpcRequest req = new XmlRpcRequest("get_presence_info_bulk", parameters);
748 XmlRpcResponse resp = req.Send(m_parent.NetworkServersInfo.MessagingURL, 8000);
749 Hashtable respData = (Hashtable) resp.Value;
750
751 if (respData.ContainsKey("faultMessage"))
752 {
753 m_log.WarnFormat("[OGS1 USER SERVICES]: Contacting MessageServer about user-regions resulted in error: {0}",
754 respData["faultMessage"]);
755 }
756 else
757 {
758 int count = (int)respData["count"];
759 m_log.DebugFormat("[OGS1 USER SERVICES]: Request returned {0} results.", count);
760 for (int i = 0; i < count; ++i)
761 {
762 UUID uuid;
763 if (UUID.TryParse((string)respData["uuid_" + i], out uuid))
764 {
765 FriendRegionInfo info = new FriendRegionInfo();
766 info.isOnline = (bool)respData["isOnline_" + i];
767 if (info.isOnline) info.regionHandle = Convert.ToUInt64(respData["regionHandle_" + i]);
768
769 result.Add(uuid, info);
770 }
771 }
772 }
773 }
774 catch (WebException e)
775 {
776 m_log.ErrorFormat("[OGS1 USER SERVICES]: Network problems when trying to fetch friend infos: {0}", e.Message);
777 }
778
779 m_log.DebugFormat("[OGS1 USER SERVICES]: Returning {0} entries", result.Count);
780 return result;
781 }
782
725 #endregion 783 #endregion
726 784
727 /// Appearance 785 /// Appearance