aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs
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/OGS1/OGS1UserServices.cs
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/OGS1/OGS1UserServices.cs60
1 files changed, 59 insertions, 1 deletions
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