diff options
Diffstat (limited to 'OpenSim/Services/Connectors/Presence')
-rw-r--r-- | OpenSim/Services/Connectors/Presence/PresenceServicesConnector.cs | 57 |
1 files changed, 57 insertions, 0 deletions
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 | |||
329 | return pinfo; | 329 | return pinfo; |
330 | } | 330 | } |
331 | 331 | ||
332 | public PresenceInfo GetAgentByUser(UUID userID) | ||
333 | { | ||
334 | Dictionary<string, object> sendData = new Dictionary<string, object>(); | ||
335 | //sendData["SCOPEID"] = scopeID.ToString(); | ||
336 | sendData["VERSIONMIN"] = ProtocolVersions.ClientProtocolVersionMin.ToString(); | ||
337 | sendData["VERSIONMAX"] = ProtocolVersions.ClientProtocolVersionMax.ToString(); | ||
338 | sendData["METHOD"] = "getagentbyuser"; | ||
339 | |||
340 | sendData["UserID"] = userID.ToString(); | ||
341 | |||
342 | string reply = string.Empty; | ||
343 | string reqString = ServerUtils.BuildQueryString(sendData); | ||
344 | string uri = m_ServerURI + "/presence"; | ||
345 | // m_log.DebugFormat("[PRESENCE CONNECTOR]: queryString = {0}", reqString); | ||
346 | try | ||
347 | { | ||
348 | reply = SynchronousRestFormsRequester.MakeRequest("POST", | ||
349 | uri, | ||
350 | reqString, | ||
351 | m_Auth); | ||
352 | if (reply == null || (reply != null && reply == string.Empty)) | ||
353 | { | ||
354 | m_log.DebugFormat("[PRESENCE CONNECTOR]: GetAgentByUser received null or empty reply"); | ||
355 | return null; | ||
356 | } | ||
357 | } | ||
358 | catch (Exception e) | ||
359 | { | ||
360 | m_log.DebugFormat("[PRESENCE CONNECTOR]: Exception when contacting presence server at {0}: {1}", uri, e.Message); | ||
361 | return null; | ||
362 | } | ||
363 | |||
364 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | ||
365 | PresenceInfo pinfo = null; | ||
366 | |||
367 | if ((replyData != null) && replyData.ContainsKey("result") && (replyData["result"] != null)) | ||
368 | { | ||
369 | if (replyData["result"] is Dictionary<string, object>) | ||
370 | { | ||
371 | pinfo = new PresenceInfo((Dictionary<string, object>)replyData["result"]); | ||
372 | } | ||
373 | else | ||
374 | { | ||
375 | if (replyData["result"].ToString() == "null") | ||
376 | return null; | ||
377 | |||
378 | m_log.DebugFormat("[PRESENCE CONNECTOR]: Invalid reply (result not dictionary) received from presence server when querying for userID {0}", userID.ToString()); | ||
379 | } | ||
380 | } | ||
381 | else | ||
382 | { | ||
383 | m_log.DebugFormat("[PRESENCE CONNECTOR]: Invalid reply received from presence server when querying for userID {0}", userID.ToString()); | ||
384 | } | ||
385 | |||
386 | return pinfo; | ||
387 | } | ||
388 | |||
332 | public PresenceInfo[] GetAgents(string[] userIDs) | 389 | public PresenceInfo[] GetAgents(string[] userIDs) |
333 | { | 390 | { |
334 | Dictionary<string, object> sendData = new Dictionary<string, object>(); | 391 | Dictionary<string, object> sendData = new Dictionary<string, object>(); |