aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services/Connectors
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Services/Connectors')
-rw-r--r--OpenSim/Services/Connectors/Presence/PresenceServicesConnector.cs57
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs12
2 files changed, 69 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>();
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
222 return ResponseToPresenceInfo(sessionResponse); 222 return ResponseToPresenceInfo(sessionResponse);
223 } 223 }
224 224
225 public PresenceInfo GetAgentByUser(UUID userID)
226 {
227 OSDMap userResponse = GetUserData(userID);
228 if (userResponse == null)
229 {
230 m_log.WarnFormat("[SIMIAN PRESENCE CONNECTOR]: Failed to retrieve user data for {0}: {1}",userID.ToString(),userResponse["Message"].AsString());
231 return null;
232 }
233
234 return ResponseToPresenceInfo(userResponse);
235 }
236
225 public PresenceInfo[] GetAgents(string[] userIDs) 237 public PresenceInfo[] GetAgents(string[] userIDs)
226 { 238 {
227 List<PresenceInfo> presences = new List<PresenceInfo>(); 239 List<PresenceInfo> presences = new List<PresenceInfo>();