From 7aecb3c7d9262b7dcd43b45736bb008a2f1ca742 Mon Sep 17 00:00:00 2001 From: onefang Date: Thu, 15 Aug 2019 02:18:35 +1000 Subject: Bandaid for ghost users, check and remove them from Presence when they log on. Once again OOP proves it's worse that spaghetti, but cutting up the spaghetti and hiding it all over the kitchen. Note the commented out bits from GateKeeperService.cs, this stuff is checked TWICE, though this time is for HGers, or not. --- .../Presence/PresenceServicesConnector.cs | 57 ++++++++++++++++++++++ .../SimianGrid/SimianPresenceServiceConnector.cs | 12 +++++ 2 files changed, 69 insertions(+) (limited to 'OpenSim/Services/Connectors') diff --git a/OpenSim/Services/Connectors/Presence/PresenceServicesConnector.cs b/OpenSim/Services/Connectors/Presence/PresenceServicesConnector.cs index 89d64ca..04a0c5e 100644 --- a/OpenSim/Services/Connectors/Presence/PresenceServicesConnector.cs +++ b/OpenSim/Services/Connectors/Presence/PresenceServicesConnector.cs @@ -329,6 +329,63 @@ namespace OpenSim.Services.Connectors return pinfo; } + public PresenceInfo GetAgentByUser(UUID userID) + { + Dictionary sendData = new Dictionary(); + //sendData["SCOPEID"] = scopeID.ToString(); + sendData["VERSIONMIN"] = ProtocolVersions.ClientProtocolVersionMin.ToString(); + sendData["VERSIONMAX"] = ProtocolVersions.ClientProtocolVersionMax.ToString(); + sendData["METHOD"] = "getagentbyuser"; + + sendData["UserID"] = userID.ToString(); + + string reply = string.Empty; + string reqString = ServerUtils.BuildQueryString(sendData); + string uri = m_ServerURI + "/presence"; + // m_log.DebugFormat("[PRESENCE CONNECTOR]: queryString = {0}", reqString); + try + { + reply = SynchronousRestFormsRequester.MakeRequest("POST", + uri, + reqString, + m_Auth); + if (reply == null || (reply != null && reply == string.Empty)) + { + m_log.DebugFormat("[PRESENCE CONNECTOR]: GetAgentByUser received null or empty reply"); + return null; + } + } + catch (Exception e) + { + m_log.DebugFormat("[PRESENCE CONNECTOR]: Exception when contacting presence server at {0}: {1}", uri, e.Message); + return null; + } + + Dictionary replyData = ServerUtils.ParseXmlResponse(reply); + PresenceInfo pinfo = null; + + if ((replyData != null) && replyData.ContainsKey("result") && (replyData["result"] != null)) + { + if (replyData["result"] is Dictionary) + { + pinfo = new PresenceInfo((Dictionary)replyData["result"]); + } + else + { + if (replyData["result"].ToString() == "null") + return null; + + m_log.DebugFormat("[PRESENCE CONNECTOR]: Invalid reply (result not dictionary) received from presence server when querying for userID {0}", userID.ToString()); + } + } + else + { + m_log.DebugFormat("[PRESENCE CONNECTOR]: Invalid reply received from presence server when querying for userID {0}", userID.ToString()); + } + + return pinfo; + } + public PresenceInfo[] GetAgents(string[] userIDs) { Dictionary sendData = new Dictionary(); diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs index 08efefb..2a34379 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs @@ -222,6 +222,18 @@ namespace OpenSim.Services.Connectors.SimianGrid return ResponseToPresenceInfo(sessionResponse); } + public PresenceInfo GetAgentByUser(UUID userID) + { + OSDMap userResponse = GetUserData(userID); + if (userResponse == null) + { + m_log.WarnFormat("[SIMIAN PRESENCE CONNECTOR]: Failed to retrieve user data for {0}: {1}",userID.ToString(),userResponse["Message"].AsString()); + return null; + } + + return ResponseToPresenceInfo(userResponse); + } + public PresenceInfo[] GetAgents(string[] userIDs) { List presences = new List(); -- cgit v1.1