diff options
Diffstat (limited to 'OpenSim/Services/Connectors/GridUser/GridUserServiceConnector.cs')
-rw-r--r-- | OpenSim/Services/Connectors/GridUser/GridUserServiceConnector.cs | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/OpenSim/Services/Connectors/GridUser/GridUserServiceConnector.cs b/OpenSim/Services/Connectors/GridUser/GridUserServiceConnector.cs index 738cc06..aa98b5d 100644 --- a/OpenSim/Services/Connectors/GridUser/GridUserServiceConnector.cs +++ b/OpenSim/Services/Connectors/GridUser/GridUserServiceConnector.cs | |||
@@ -223,5 +223,65 @@ namespace OpenSim.Services.Connectors | |||
223 | 223 | ||
224 | } | 224 | } |
225 | 225 | ||
226 | public GridUserInfo[] GetGridUserInfo(string[] userIDs) | ||
227 | { | ||
228 | Dictionary<string, object> sendData = new Dictionary<string, object>(); | ||
229 | //sendData["SCOPEID"] = scopeID.ToString(); | ||
230 | sendData["VERSIONMIN"] = ProtocolVersions.ClientProtocolVersionMin.ToString(); | ||
231 | sendData["VERSIONMAX"] = ProtocolVersions.ClientProtocolVersionMax.ToString(); | ||
232 | sendData["METHOD"] = "getgriduserinfos"; | ||
233 | |||
234 | sendData["AgentIDs"] = new List<string>(userIDs); | ||
235 | |||
236 | string reply = string.Empty; | ||
237 | string reqString = ServerUtils.BuildQueryString(sendData); | ||
238 | //m_log.DebugFormat("[PRESENCE CONNECTOR]: queryString = {0}", reqString); | ||
239 | try | ||
240 | { | ||
241 | reply = SynchronousRestFormsRequester.MakeRequest("POST", | ||
242 | m_ServerURI + "/griduser", | ||
243 | reqString); | ||
244 | if (reply == null || (reply != null && reply == string.Empty)) | ||
245 | { | ||
246 | m_log.DebugFormat("[GRID USER CONNECTOR]: GetGridUserInfo received null or empty reply"); | ||
247 | return null; | ||
248 | } | ||
249 | } | ||
250 | catch (Exception e) | ||
251 | { | ||
252 | m_log.DebugFormat("[GRID USER CONNECTOR]: Exception when contacting grid user server: {0}", e.Message); | ||
253 | } | ||
254 | |||
255 | List<GridUserInfo> rinfos = new List<GridUserInfo>(); | ||
256 | |||
257 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | ||
258 | |||
259 | if (replyData != null) | ||
260 | { | ||
261 | if (replyData.ContainsKey("result") && | ||
262 | (replyData["result"].ToString() == "null" || replyData["result"].ToString() == "Failure")) | ||
263 | { | ||
264 | return new GridUserInfo[0]; | ||
265 | } | ||
266 | |||
267 | Dictionary<string, object>.ValueCollection pinfosList = replyData.Values; | ||
268 | //m_log.DebugFormat("[PRESENCE CONNECTOR]: GetAgents returned {0} elements", pinfosList.Count); | ||
269 | foreach (object griduser in pinfosList) | ||
270 | { | ||
271 | if (griduser is Dictionary<string, object>) | ||
272 | { | ||
273 | GridUserInfo pinfo = new GridUserInfo((Dictionary<string, object>)griduser); | ||
274 | rinfos.Add(pinfo); | ||
275 | } | ||
276 | else | ||
277 | m_log.DebugFormat("[GRID USER CONNECTOR]: GetGridUserInfo received invalid response type {0}", | ||
278 | griduser.GetType()); | ||
279 | } | ||
280 | } | ||
281 | else | ||
282 | m_log.DebugFormat("[GRID USER CONNECTOR]: GetGridUserInfo received null response"); | ||
283 | |||
284 | return rinfos.ToArray(); | ||
285 | } | ||
226 | } | 286 | } |
227 | } | 287 | } |