aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services/Connectors/Presence/PresenceServicesConnector.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Services/Connectors/Presence/PresenceServicesConnector.cs')
-rw-r--r--OpenSim/Services/Connectors/Presence/PresenceServicesConnector.cs72
1 files changed, 70 insertions, 2 deletions
diff --git a/OpenSim/Services/Connectors/Presence/PresenceServicesConnector.cs b/OpenSim/Services/Connectors/Presence/PresenceServicesConnector.cs
index b7e95c4..04a0c5e 100644
--- a/OpenSim/Services/Connectors/Presence/PresenceServicesConnector.cs
+++ b/OpenSim/Services/Connectors/Presence/PresenceServicesConnector.cs
@@ -107,7 +107,7 @@ namespace OpenSim.Services.Connectors
107 { 107 {
108 string reply = SynchronousRestFormsRequester.MakeRequest("POST", 108 string reply = SynchronousRestFormsRequester.MakeRequest("POST",
109 uri, 109 uri,
110 reqString, 110 reqString,
111 m_Auth); 111 m_Auth);
112 if (reply != string.Empty) 112 if (reply != string.Empty)
113 { 113 {
@@ -313,6 +313,74 @@ namespace OpenSim.Services.Connectors
313 { 313 {
314 pinfo = new PresenceInfo((Dictionary<string, object>)replyData["result"]); 314 pinfo = new PresenceInfo((Dictionary<string, object>)replyData["result"]);
315 } 315 }
316 else
317 {
318 if (replyData["result"].ToString() == "null")
319 return null;
320
321 m_log.DebugFormat("[PRESENCE CONNECTOR]: Invalid reply (result not dictionary) received from presence server when querying for sessionID {0}", sessionID.ToString());
322 }
323 }
324 else
325 {
326 m_log.DebugFormat("[PRESENCE CONNECTOR]: Invalid reply received from presence server when querying for sessionID {0}", sessionID.ToString());
327 }
328
329 return pinfo;
330 }
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());
316 } 384 }
317 385
318 return pinfo; 386 return pinfo;
@@ -355,7 +423,7 @@ namespace OpenSim.Services.Connectors
355 423
356 if (replyData != null) 424 if (replyData != null)
357 { 425 {
358 if (replyData.ContainsKey("result") && 426 if (replyData.ContainsKey("result") &&
359 (replyData["result"].ToString() == "null" || replyData["result"].ToString() == "Failure")) 427 (replyData["result"].ToString() == "null" || replyData["result"].ToString() == "Failure"))
360 { 428 {
361 return new PresenceInfo[0]; 429 return new PresenceInfo[0];