aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Communications
diff options
context:
space:
mode:
authorHomer Horwitz2008-11-01 22:09:48 +0000
committerHomer Horwitz2008-11-01 22:09:48 +0000
commit38e8853e5761d09a7e8f580dd277d9b99b834696 (patch)
tree653fe4c9075a03c05a4b5782f7309afa83062e5c /OpenSim/Region/Communications
parent* minor: Remove mono compiler warning (diff)
downloadopensim-SC-38e8853e5761d09a7e8f580dd277d9b99b834696.zip
opensim-SC-38e8853e5761d09a7e8f580dd277d9b99b834696.tar.gz
opensim-SC-38e8853e5761d09a7e8f580dd277d9b99b834696.tar.bz2
opensim-SC-38e8853e5761d09a7e8f580dd277d9b99b834696.tar.xz
Megapatch that fixes/adds: friend offer/deny/accept, friendship termination,
on-/offline updates, calling cards for friends. This adds methods in the DB layer and changes the MessagingServer, so a full update (incl. UGAIM) is necessary to get it working. Older regions shouldn't break, nor should older UGAIM break newer regions, but friends/presence will only work with all concerned parts (UGAIM, source region and destination region) at this revision (or later). I added the DB code for MSSQL, too, but couldn't test that. BEWARE: May contain bugs.
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Communications/Local/CommunicationsLocal.cs4
-rw-r--r--OpenSim/Region/Communications/Local/LocalBackEndServices.cs24
-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
5 files changed, 164 insertions, 8 deletions
diff --git a/OpenSim/Region/Communications/Local/CommunicationsLocal.cs b/OpenSim/Region/Communications/Local/CommunicationsLocal.cs
index 71c44e5..48a635a 100644
--- a/OpenSim/Region/Communications/Local/CommunicationsLocal.cs
+++ b/OpenSim/Region/Communications/Local/CommunicationsLocal.cs
@@ -42,7 +42,8 @@ namespace OpenSim.Region.Communications.Local
42 IUserServiceAdmin userServiceAdmin, 42 IUserServiceAdmin userServiceAdmin,
43 LocalInventoryService inventoryService, 43 LocalInventoryService inventoryService,
44 IInterRegionCommunications interRegionService, 44 IInterRegionCommunications interRegionService,
45 IGridServices gridService, LibraryRootFolder libraryRootFolder, bool dumpAssetsToFile) 45 IGridServices gridService, IMessagingService messageService,
46 LibraryRootFolder libraryRootFolder, bool dumpAssetsToFile)
46 : base(serversInfo, httpServer, assetCache, dumpAssetsToFile, libraryRootFolder) 47 : base(serversInfo, httpServer, assetCache, dumpAssetsToFile, libraryRootFolder)
47 { 48 {
48 AddInventoryService(inventoryService); 49 AddInventoryService(inventoryService);
@@ -53,6 +54,7 @@ namespace OpenSim.Region.Communications.Local
53 m_avatarService = (IAvatarService)userService; 54 m_avatarService = (IAvatarService)userService;
54 m_gridService = gridService; 55 m_gridService = gridService;
55 m_interRegion = interRegionService; 56 m_interRegion = interRegionService;
57 m_messageService = messageService;
56 } 58 }
57 } 59 }
58} 60}
diff --git a/OpenSim/Region/Communications/Local/LocalBackEndServices.cs b/OpenSim/Region/Communications/Local/LocalBackEndServices.cs
index 9034e49..4980378 100644
--- a/OpenSim/Region/Communications/Local/LocalBackEndServices.cs
+++ b/OpenSim/Region/Communications/Local/LocalBackEndServices.cs
@@ -39,7 +39,7 @@ namespace OpenSim.Region.Communications.Local
39 public class LocalBackEndServices : IGridServices, IInterRegionCommunications 39 public class LocalBackEndServices : IGridServices, IInterRegionCommunications
40 { 40 {
41 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 41 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
42 42
43 protected Dictionary<ulong, RegionInfo> m_regions = new Dictionary<ulong, RegionInfo>(); 43 protected Dictionary<ulong, RegionInfo> m_regions = new Dictionary<ulong, RegionInfo>();
44 44
45 protected Dictionary<ulong, RegionCommsListener> m_regionListeners = 45 protected Dictionary<ulong, RegionCommsListener> m_regionListeners =
@@ -50,7 +50,7 @@ namespace OpenSim.Region.Communications.Local
50 private Dictionary<string, string> m_queuedGridSettings = new Dictionary<string, string>(); 50 private Dictionary<string, string> m_queuedGridSettings = new Dictionary<string, string>();
51 51
52 public string _gdebugRegionName = String.Empty; 52 public string _gdebugRegionName = String.Empty;
53 53
54 public bool RegionLoginsEnabled 54 public bool RegionLoginsEnabled
55 { 55 {
56 get { return m_regionLoginsEnabled; } 56 get { return m_regionLoginsEnabled; }
@@ -523,11 +523,27 @@ namespace OpenSim.Region.Communications.Local
523 if (info.RegionName.StartsWith(name)) 523 if (info.RegionName.StartsWith(name))
524 { 524 {
525 regions.Add(info); 525 regions.Add(info);
526 if (regions.Count >= maxNumber) break; 526 if (regions.Count >= maxNumber) break;
527 } 527 }
528 } 528 }
529 529
530 return regions; 530 return regions;
531 } 531 }
532
533 public List<UUID> InformFriendsInOtherRegion(UUID agentId, ulong destRegionHandle, List<UUID> friends, bool online)
534 {
535 // if we get to here, something is wrong: We are in standalone mode, but have users that are not on our server?
536 m_log.WarnFormat("[INTERREGION STANDALONE] Did find {0} users on a region not on our server: {1} ???",
537 friends.Count, destRegionHandle);
538 return new List<UUID>();
539 }
540
541 public bool TriggerTerminateFriend (ulong regionHandle, UUID agentID, UUID exFriendID)
542 {
543 // if we get to here, something is wrong: We are in standalone mode, but have users that are not on our server?
544 m_log.WarnFormat("[INTERREGION STANDALONE] Did find user {0} on a region not on our server: {1} ???",
545 agentID, regionHandle);
546 return true;
547 }
532 } 548 }
533} 549}
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