From 38e8853e5761d09a7e8f580dd277d9b99b834696 Mon Sep 17 00:00:00 2001 From: Homer Horwitz Date: Sat, 1 Nov 2008 22:09:48 +0000 Subject: 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. --- .../Region/Communications/OGS1/OGS1GridServices.cs | 80 +++++++++++++++++++++- 1 file changed, 79 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/Communications/OGS1/OGS1GridServices.cs') 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 return null; } } + + public List InformFriendsInOtherRegion(UUID agentId, ulong destRegionHandle, List friends, bool online) + { + List tpdAway = new List(); + + // destRegionHandle is a region on another server + RegionInfo info = RequestNeighbourInfo(destRegionHandle); + if (info != null) + { + string httpServer = "http://" + info.ExternalEndPoint.Address + ":" + info.HttpPort + "/presence_update_bulk"; + + Hashtable reqParams = new Hashtable(); + reqParams["agentID"] = agentId.ToString(); + reqParams["agentOnline"] = online; + int count = 0; + foreach (UUID uuid in friends) + { + reqParams["friendID_" + count++] = uuid.ToString(); + } + reqParams["friendCount"] = count; + + IList parameters = new ArrayList(); + parameters.Add(reqParams); + try + { + XmlRpcRequest request = new XmlRpcRequest("presence_update_bulk", parameters); + XmlRpcResponse response = request.Send(httpServer, 5000); + Hashtable respData = (Hashtable)response.Value; + + count = (int)respData["friendCount"]; + for (int i = 0; i < count; ++i) + { + UUID uuid; + if(UUID.TryParse((string)respData["friendID_" + i], out uuid)) tpdAway.Add(uuid); + } + } + catch(Exception e) + { + m_log.Error("[OGS1 GRID SERVICES]: InformFriendsInOtherRegion XMLRPC failure: ", e); + } + } + else m_log.WarnFormat("[OGS1 GRID SERVICES]: Couldn't find region {0}???", destRegionHandle); + + return tpdAway; + } + + public bool TriggerTerminateFriend(ulong destRegionHandle, UUID agentID, UUID exFriendID) + { + // destRegionHandle is a region on another server + RegionInfo info = RequestNeighbourInfo(destRegionHandle); + if (info == null) + { + m_log.WarnFormat("[OGS1 GRID SERVICES]: Couldn't find region {0}", destRegionHandle); + return false; // region not found??? + } + + string httpServer = "http://" + info.ExternalEndPoint.Address + ":" + info.HttpPort + "/presence_update_bulk"; + + Hashtable reqParams = new Hashtable(); + reqParams["agentID"] = agentID.ToString(); + reqParams["friendID"] = exFriendID.ToString(); + + IList parameters = new ArrayList(); + parameters.Add(reqParams); + try + { + XmlRpcRequest request = new XmlRpcRequest("terminate_friend", parameters); + XmlRpcResponse response = request.Send(httpServer, 5000); + Hashtable respData = (Hashtable)response.Value; + + return (bool)respData["success"]; + } + catch(Exception e) + { + m_log.Error("[OGS1 GRID SERVICES]: InformFriendsInOtherRegion XMLRPC failure: ", e); + return false; + } + } } -} \ No newline at end of file +} -- cgit v1.1