diff options
author | MW | 2009-02-24 13:33:57 +0000 |
---|---|---|
committer | MW | 2009-02-24 13:33:57 +0000 |
commit | 2a91f21d082aee4dc97b5b0d29e1739cfe409024 (patch) | |
tree | 950cf659d45ffc05367814c0075b48f4a2aabbc5 /OpenSim/Grid/UserServer/UserManager.cs | |
parent | update version number for bamboo zip file output (diff) | |
download | opensim-SC-2a91f21d082aee4dc97b5b0d29e1739cfe409024.zip opensim-SC-2a91f21d082aee4dc97b5b0d29e1739cfe409024.tar.gz opensim-SC-2a91f21d082aee4dc97b5b0d29e1739cfe409024.tar.bz2 opensim-SC-2a91f21d082aee4dc97b5b0d29e1739cfe409024.tar.xz |
More refactoring of the UserServer.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Grid/UserServer/UserManager.cs | 187 |
1 files changed, 32 insertions, 155 deletions
diff --git a/OpenSim/Grid/UserServer/UserManager.cs b/OpenSim/Grid/UserServer/UserManager.cs index 6229dec..ca50421 100644 --- a/OpenSim/Grid/UserServer/UserManager.cs +++ b/OpenSim/Grid/UserServer/UserManager.cs | |||
@@ -48,16 +48,45 @@ namespace OpenSim.Grid.UserServer | |||
48 | private logOffUser handlerLogOffUser; | 48 | private logOffUser handlerLogOffUser; |
49 | 49 | ||
50 | private UserDataBaseService m_userDataBaseService; | 50 | private UserDataBaseService m_userDataBaseService; |
51 | private BaseHttpServer m_httpServer; | ||
51 | 52 | ||
52 | /// <summary> | 53 | /// <summary> |
53 | /// Constructor | 54 | /// |
54 | /// </summary> | 55 | /// </summary> |
55 | /// <param name="interServiceInventoryService"></param> | 56 | /// <param name="userDataBaseService"></param> |
56 | public UserManager(IInterServiceInventoryServices interServiceInventoryService, UserDataBaseService userDataBaseService) | 57 | public UserManager( UserDataBaseService userDataBaseService) |
57 | { | 58 | { |
58 | m_userDataBaseService = userDataBaseService; | 59 | m_userDataBaseService = userDataBaseService; |
59 | } | 60 | } |
60 | 61 | ||
62 | public void Initialise() | ||
63 | { | ||
64 | |||
65 | } | ||
66 | |||
67 | public void PostInitialise() | ||
68 | { | ||
69 | |||
70 | } | ||
71 | |||
72 | public void RegisterHandlers(BaseHttpServer httpServer) | ||
73 | { | ||
74 | m_httpServer = httpServer; | ||
75 | |||
76 | m_httpServer.AddXmlRPCHandler("get_user_by_name", XmlRPCGetUserMethodName); | ||
77 | m_httpServer.AddXmlRPCHandler("get_user_by_uuid", XmlRPCGetUserMethodUUID); | ||
78 | m_httpServer.AddXmlRPCHandler("get_avatar_picker_avatar", XmlRPCGetAvatarPickerAvatar); | ||
79 | |||
80 | m_httpServer.AddXmlRPCHandler("update_user_current_region", XmlRPCAtRegion); | ||
81 | m_httpServer.AddXmlRPCHandler("logout_of_simulator", XmlRPCLogOffUserMethodUUID); | ||
82 | m_httpServer.AddXmlRPCHandler("get_agent_by_uuid", XmlRPCGetAgentMethodUUID); | ||
83 | m_httpServer.AddXmlRPCHandler("check_auth_session", XmlRPCCheckAuthSession); | ||
84 | |||
85 | m_httpServer.AddXmlRPCHandler("update_user_profile", XmlRpcResponseXmlRPCUpdateUserProfile); | ||
86 | |||
87 | m_httpServer.AddStreamHandler(new RestStreamHandler("DELETE", "/usersessions/", RestDeleteUserSessionMethod)); | ||
88 | } | ||
89 | |||
61 | /// <summary> | 90 | /// <summary> |
62 | /// Deletes an active agent session | 91 | /// Deletes an active agent session |
63 | /// </summary> | 92 | /// </summary> |
@@ -109,26 +138,6 @@ namespace OpenSim.Grid.UserServer | |||
109 | return response; | 138 | return response; |
110 | } | 139 | } |
111 | 140 | ||
112 | public XmlRpcResponse FriendListItemListtoXmlRPCResponse(List<FriendListItem> returnUsers) | ||
113 | { | ||
114 | XmlRpcResponse response = new XmlRpcResponse(); | ||
115 | Hashtable responseData = new Hashtable(); | ||
116 | // Query Result Information | ||
117 | |||
118 | responseData["avcount"] = returnUsers.Count.ToString(); | ||
119 | |||
120 | for (int i = 0; i < returnUsers.Count; i++) | ||
121 | { | ||
122 | responseData["ownerID" + i] = returnUsers[i].FriendListOwner.ToString(); | ||
123 | responseData["friendID" + i] = returnUsers[i].Friend.ToString(); | ||
124 | responseData["ownerPerms" + i] = returnUsers[i].FriendListOwnerPerms.ToString(); | ||
125 | responseData["friendPerms" + i] = returnUsers[i].FriendPerms.ToString(); | ||
126 | } | ||
127 | response.Value = responseData; | ||
128 | |||
129 | return response; | ||
130 | } | ||
131 | |||
132 | /// <summary> | 141 | /// <summary> |
133 | /// Converts a user profile to an XML element which can be returned | 142 | /// Converts a user profile to an XML element which can be returned |
134 | /// </summary> | 143 | /// </summary> |
@@ -230,138 +239,6 @@ namespace OpenSim.Grid.UserServer | |||
230 | return response; | 239 | return response; |
231 | } | 240 | } |
232 | 241 | ||
233 | public XmlRpcResponse XmlRpcResponseXmlRPCAddUserFriend(XmlRpcRequest request) | ||
234 | { | ||
235 | XmlRpcResponse response = new XmlRpcResponse(); | ||
236 | Hashtable requestData = (Hashtable) request.Params[0]; | ||
237 | Hashtable responseData = new Hashtable(); | ||
238 | string returnString = "FALSE"; | ||
239 | // Query Result Information | ||
240 | |||
241 | if (requestData.Contains("ownerID") && requestData.Contains("friendID") && | ||
242 | requestData.Contains("friendPerms")) | ||
243 | { | ||
244 | // UserManagerBase.AddNewuserFriend | ||
245 | m_userDataBaseService.AddNewUserFriend(new UUID((string)requestData["ownerID"]), | ||
246 | new UUID((string) requestData["friendID"]), | ||
247 | (uint) Convert.ToInt32((string) requestData["friendPerms"])); | ||
248 | returnString = "TRUE"; | ||
249 | } | ||
250 | responseData["returnString"] = returnString; | ||
251 | response.Value = responseData; | ||
252 | return response; | ||
253 | } | ||
254 | |||
255 | public XmlRpcResponse XmlRpcResponseXmlRPCRemoveUserFriend(XmlRpcRequest request) | ||
256 | { | ||
257 | XmlRpcResponse response = new XmlRpcResponse(); | ||
258 | Hashtable requestData = (Hashtable) request.Params[0]; | ||
259 | Hashtable responseData = new Hashtable(); | ||
260 | string returnString = "FALSE"; | ||
261 | // Query Result Information | ||
262 | |||
263 | if (requestData.Contains("ownerID") && requestData.Contains("friendID")) | ||
264 | { | ||
265 | // UserManagerBase.AddNewuserFriend | ||
266 | m_userDataBaseService.RemoveUserFriend(new UUID((string)requestData["ownerID"]), | ||
267 | new UUID((string) requestData["friendID"])); | ||
268 | returnString = "TRUE"; | ||
269 | } | ||
270 | responseData["returnString"] = returnString; | ||
271 | response.Value = responseData; | ||
272 | return response; | ||
273 | } | ||
274 | |||
275 | public XmlRpcResponse XmlRpcResponseXmlRPCUpdateUserFriendPerms(XmlRpcRequest request) | ||
276 | { | ||
277 | XmlRpcResponse response = new XmlRpcResponse(); | ||
278 | Hashtable requestData = (Hashtable) request.Params[0]; | ||
279 | Hashtable responseData = new Hashtable(); | ||
280 | string returnString = "FALSE"; | ||
281 | |||
282 | if (requestData.Contains("ownerID") && requestData.Contains("friendID") && | ||
283 | requestData.Contains("friendPerms")) | ||
284 | { | ||
285 | m_userDataBaseService.UpdateUserFriendPerms(new UUID((string)requestData["ownerID"]), | ||
286 | new UUID((string) requestData["friendID"]), | ||
287 | (uint) Convert.ToInt32((string) requestData["friendPerms"])); | ||
288 | // UserManagerBase. | ||
289 | returnString = "TRUE"; | ||
290 | } | ||
291 | responseData["returnString"] = returnString; | ||
292 | response.Value = responseData; | ||
293 | return response; | ||
294 | } | ||
295 | |||
296 | public XmlRpcResponse XmlRpcResponseXmlRPCGetUserFriendList(XmlRpcRequest request) | ||
297 | { | ||
298 | // XmlRpcResponse response = new XmlRpcResponse(); | ||
299 | Hashtable requestData = (Hashtable) request.Params[0]; | ||
300 | // Hashtable responseData = new Hashtable(); | ||
301 | |||
302 | List<FriendListItem> returndata = new List<FriendListItem>(); | ||
303 | |||
304 | if (requestData.Contains("ownerID")) | ||
305 | { | ||
306 | returndata = m_userDataBaseService.GetUserFriendList(new UUID((string)requestData["ownerID"])); | ||
307 | } | ||
308 | |||
309 | return FriendListItemListtoXmlRPCResponse(returndata); | ||
310 | } | ||
311 | |||
312 | public XmlRpcResponse XmlRPCGetAvatarAppearance(XmlRpcRequest request) | ||
313 | { | ||
314 | XmlRpcResponse response = new XmlRpcResponse(); | ||
315 | Hashtable requestData = (Hashtable) request.Params[0]; | ||
316 | AvatarAppearance appearance; | ||
317 | Hashtable responseData; | ||
318 | if (requestData.Contains("owner")) | ||
319 | { | ||
320 | appearance = m_userDataBaseService.GetUserAppearance(new UUID((string)requestData["owner"])); | ||
321 | if (appearance == null) | ||
322 | { | ||
323 | responseData = new Hashtable(); | ||
324 | responseData["error_type"] = "no appearance"; | ||
325 | responseData["error_desc"] = "There was no appearance found for this avatar"; | ||
326 | } | ||
327 | else | ||
328 | { | ||
329 | responseData = appearance.ToHashTable(); | ||
330 | } | ||
331 | } | ||
332 | else | ||
333 | { | ||
334 | responseData = new Hashtable(); | ||
335 | responseData["error_type"] = "unknown_avatar"; | ||
336 | responseData["error_desc"] = "The avatar appearance requested is not in the database"; | ||
337 | } | ||
338 | |||
339 | response.Value = responseData; | ||
340 | return response; | ||
341 | } | ||
342 | |||
343 | public XmlRpcResponse XmlRPCUpdateAvatarAppearance(XmlRpcRequest request) | ||
344 | { | ||
345 | XmlRpcResponse response = new XmlRpcResponse(); | ||
346 | Hashtable requestData = (Hashtable) request.Params[0]; | ||
347 | Hashtable responseData; | ||
348 | if (requestData.Contains("owner")) | ||
349 | { | ||
350 | AvatarAppearance appearance = new AvatarAppearance(requestData); | ||
351 | m_userDataBaseService.UpdateUserAppearance(new UUID((string)requestData["owner"]), appearance); | ||
352 | responseData = new Hashtable(); | ||
353 | responseData["returnString"] = "TRUE"; | ||
354 | } | ||
355 | else | ||
356 | { | ||
357 | responseData = new Hashtable(); | ||
358 | responseData["error_type"] = "unknown_avatar"; | ||
359 | responseData["error_desc"] = "The avatar appearance requested is not in the database"; | ||
360 | } | ||
361 | response.Value = responseData; | ||
362 | return response; | ||
363 | } | ||
364 | |||
365 | public XmlRpcResponse XmlRPCGetUserMethodName(XmlRpcRequest request) | 242 | public XmlRpcResponse XmlRPCGetUserMethodName(XmlRpcRequest request) |
366 | { | 243 | { |
367 | // XmlRpcResponse response = new XmlRpcResponse(); | 244 | // XmlRpcResponse response = new XmlRpcResponse(); |