diff options
Allow retrival of multiple user records in one operation, analog to presence
Diffstat (limited to 'OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs')
-rw-r--r-- | OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs b/OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs index 4c0d52e..bf21255 100644 --- a/OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs +++ b/OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs | |||
@@ -88,6 +88,8 @@ namespace OpenSim.Server.Handlers.GridUser | |||
88 | return SetPosition(request); | 88 | return SetPosition(request); |
89 | case "getgriduserinfo": | 89 | case "getgriduserinfo": |
90 | return GetGridUserInfo(request); | 90 | return GetGridUserInfo(request); |
91 | case "getgriduserinfos": | ||
92 | return GetGridUserInfos(request); | ||
91 | } | 93 | } |
92 | m_log.DebugFormat("[GRID USER HANDLER]: unknown method request: {0}", method); | 94 | m_log.DebugFormat("[GRID USER HANDLER]: unknown method request: {0}", method); |
93 | } | 95 | } |
@@ -193,6 +195,46 @@ namespace OpenSim.Server.Handlers.GridUser | |||
193 | 195 | ||
194 | } | 196 | } |
195 | 197 | ||
198 | byte[] GetGridUserInfos(Dictionary<string, object> request) | ||
199 | { | ||
200 | |||
201 | string[] userIDs; | ||
202 | |||
203 | if (!request.ContainsKey("AgentIDs")) | ||
204 | { | ||
205 | m_log.DebugFormat("[GRID USER HANDLER]: GetGridUserInfos called without required uuids argument"); | ||
206 | return FailureResult(); | ||
207 | } | ||
208 | |||
209 | if (!(request["AgentIDs"] is List<string>)) | ||
210 | { | ||
211 | m_log.DebugFormat("[GRID USER HANDLER]: GetGridUserInfos input argument was of unexpected type {0}", request["uuids"].GetType().ToString()); | ||
212 | return FailureResult(); | ||
213 | } | ||
214 | |||
215 | userIDs = ((List<string>)request["AgentIDs"]).ToArray(); | ||
216 | |||
217 | GridUserInfo[] pinfos = m_GridUserService.GetGridUserInfo(userIDs); | ||
218 | |||
219 | Dictionary<string, object> result = new Dictionary<string, object>(); | ||
220 | if ((pinfos == null) || ((pinfos != null) && (pinfos.Length == 0))) | ||
221 | result["result"] = "null"; | ||
222 | else | ||
223 | { | ||
224 | int i = 0; | ||
225 | foreach (GridUserInfo pinfo in pinfos) | ||
226 | { | ||
227 | Dictionary<string, object> rinfoDict = pinfo.ToKeyValuePairs(); | ||
228 | result["griduser" + i] = rinfoDict; | ||
229 | i++; | ||
230 | } | ||
231 | } | ||
232 | |||
233 | string xmlString = ServerUtils.BuildXmlResponse(result); | ||
234 | UTF8Encoding encoding = new UTF8Encoding(); | ||
235 | return encoding.GetBytes(xmlString); | ||
236 | } | ||
237 | |||
196 | private bool UnpackArgs(Dictionary<string, object> request, out string user, out UUID region, out Vector3 position, out Vector3 lookAt) | 238 | private bool UnpackArgs(Dictionary<string, object> request, out string user, out UUID region, out Vector3 position, out Vector3 lookAt) |
197 | { | 239 | { |
198 | user = string.Empty; | 240 | user = string.Empty; |