diff options
author | Adam Frisby | 2008-08-30 13:03:38 +0000 |
---|---|---|
committer | Adam Frisby | 2008-08-30 13:03:38 +0000 |
commit | d0397af998f0ae35ebb8c0a1d0fd837df9990eb9 (patch) | |
tree | 71a3982331673e23c2e3d313a73616ac62a3979b /OpenSim/Grid/UserServer/UserManager.cs | |
parent | * Initial inspection of UserLoginService.cs, cleaned up source code slightly ... (diff) | |
download | opensim-SC-d0397af998f0ae35ebb8c0a1d0fd837df9990eb9.zip opensim-SC-d0397af998f0ae35ebb8c0a1d0fd837df9990eb9.tar.gz opensim-SC-d0397af998f0ae35ebb8c0a1d0fd837df9990eb9.tar.bz2 opensim-SC-d0397af998f0ae35ebb8c0a1d0fd837df9990eb9.tar.xz |
* More cleanup, including UserManager.
Diffstat (limited to 'OpenSim/Grid/UserServer/UserManager.cs')
-rw-r--r-- | OpenSim/Grid/UserServer/UserManager.cs | 176 |
1 files changed, 89 insertions, 87 deletions
diff --git a/OpenSim/Grid/UserServer/UserManager.cs b/OpenSim/Grid/UserServer/UserManager.cs index 760dfe3..69c550a 100644 --- a/OpenSim/Grid/UserServer/UserManager.cs +++ b/OpenSim/Grid/UserServer/UserManager.cs | |||
@@ -29,7 +29,6 @@ using System; | |||
29 | using System.Collections; | 29 | using System.Collections; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Reflection; | 31 | using System.Reflection; |
32 | using System.Text.RegularExpressions; | ||
33 | using libsecondlife; | 32 | using libsecondlife; |
34 | using log4net; | 33 | using log4net; |
35 | using Nwc.XmlRpc; | 34 | using Nwc.XmlRpc; |
@@ -46,7 +45,7 @@ namespace OpenSim.Grid.UserServer | |||
46 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 45 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
47 | 46 | ||
48 | public event logOffUser OnLogOffUser; | 47 | public event logOffUser OnLogOffUser; |
49 | private logOffUser handlerLogOffUser = null; | 48 | private logOffUser handlerLogOffUser; |
50 | 49 | ||
51 | /// <summary> | 50 | /// <summary> |
52 | /// Deletes an active agent session | 51 | /// Deletes an active agent session |
@@ -85,14 +84,14 @@ namespace OpenSim.Grid.UserServer | |||
85 | XmlRpcResponse response = new XmlRpcResponse(); | 84 | XmlRpcResponse response = new XmlRpcResponse(); |
86 | Hashtable responseData = new Hashtable(); | 85 | Hashtable responseData = new Hashtable(); |
87 | // Query Result Information | 86 | // Query Result Information |
88 | responseData["queryid"] = (string) queryID.ToString(); | 87 | responseData["queryid"] = queryID.ToString(); |
89 | responseData["avcount"] = (string) returnUsers.Count.ToString(); | 88 | responseData["avcount"] = returnUsers.Count.ToString(); |
90 | 89 | ||
91 | for (int i = 0; i < returnUsers.Count; i++) | 90 | for (int i = 0; i < returnUsers.Count; i++) |
92 | { | 91 | { |
93 | responseData["avatarid" + i.ToString()] = returnUsers[i].AvatarID.ToString(); | 92 | responseData["avatarid" + i] = returnUsers[i].AvatarID.ToString(); |
94 | responseData["firstname" + i.ToString()] = returnUsers[i].firstName; | 93 | responseData["firstname" + i] = returnUsers[i].firstName; |
95 | responseData["lastname" + i.ToString()] = returnUsers[i].lastName; | 94 | responseData["lastname" + i] = returnUsers[i].lastName; |
96 | } | 95 | } |
97 | response.Value = responseData; | 96 | response.Value = responseData; |
98 | 97 | ||
@@ -105,14 +104,14 @@ namespace OpenSim.Grid.UserServer | |||
105 | Hashtable responseData = new Hashtable(); | 104 | Hashtable responseData = new Hashtable(); |
106 | // Query Result Information | 105 | // Query Result Information |
107 | 106 | ||
108 | responseData["avcount"] = (string)returnUsers.Count.ToString(); | 107 | responseData["avcount"] = returnUsers.Count.ToString(); |
109 | 108 | ||
110 | for (int i = 0; i < returnUsers.Count; i++) | 109 | for (int i = 0; i < returnUsers.Count; i++) |
111 | { | 110 | { |
112 | responseData["ownerID" + i.ToString()] = returnUsers[i].FriendListOwner.UUID.ToString(); | 111 | responseData["ownerID" + i] = returnUsers[i].FriendListOwner.UUID.ToString(); |
113 | responseData["friendID" + i.ToString()] = returnUsers[i].Friend.UUID.ToString(); | 112 | responseData["friendID" + i] = returnUsers[i].Friend.UUID.ToString(); |
114 | responseData["ownerPerms" + i.ToString()] = returnUsers[i].FriendListOwnerPerms.ToString(); | 113 | responseData["ownerPerms" + i] = returnUsers[i].FriendListOwnerPerms.ToString(); |
115 | responseData["friendPerms" + i.ToString()] = returnUsers[i].FriendPerms.ToString(); | 114 | responseData["friendPerms" + i] = returnUsers[i].FriendPerms.ToString(); |
116 | } | 115 | } |
117 | response.Value = responseData; | 116 | response.Value = responseData; |
118 | 117 | ||
@@ -159,7 +158,7 @@ namespace OpenSim.Grid.UserServer | |||
159 | 158 | ||
160 | responseData["user_flags"] = profile.UserFlags.ToString(); | 159 | responseData["user_flags"] = profile.UserFlags.ToString(); |
161 | responseData["god_level"] = profile.GodLevel.ToString(); | 160 | responseData["god_level"] = profile.GodLevel.ToString(); |
162 | responseData["custom_type"] = profile.CustomType.ToString(); | 161 | responseData["custom_type"] = profile.CustomType; |
163 | responseData["partner"] = profile.Partner.ToString(); | 162 | responseData["partner"] = profile.Partner.ToString(); |
164 | response.Value = responseData; | 163 | response.Value = responseData; |
165 | 164 | ||
@@ -188,24 +187,25 @@ namespace OpenSim.Grid.UserServer | |||
188 | public XmlRpcResponse XmlRPCAtRegion(XmlRpcRequest request) | 187 | public XmlRpcResponse XmlRPCAtRegion(XmlRpcRequest request) |
189 | { | 188 | { |
190 | XmlRpcResponse response = new XmlRpcResponse(); | 189 | XmlRpcResponse response = new XmlRpcResponse(); |
191 | Hashtable requestData = (Hashtable)request.Params[0]; | 190 | Hashtable requestData = (Hashtable) request.Params[0]; |
192 | Hashtable responseData = new Hashtable(); | 191 | Hashtable responseData = new Hashtable(); |
193 | string returnstring = "FALSE"; | 192 | string returnstring = "FALSE"; |
194 | 193 | ||
195 | if (requestData.Contains("avatar_id") && requestData.Contains("region_handle") && requestData.Contains("region_uuid")) | 194 | if (requestData.Contains("avatar_id") && requestData.Contains("region_handle") && |
195 | requestData.Contains("region_uuid")) | ||
196 | { | 196 | { |
197 | // ulong cregionhandle = 0; | 197 | // ulong cregionhandle = 0; |
198 | LLUUID regionUUID = LLUUID.Zero; | 198 | LLUUID regionUUID; |
199 | LLUUID avatarUUID = LLUUID.Zero; | 199 | LLUUID avatarUUID; |
200 | 200 | ||
201 | Helpers.TryParse((string)requestData["avatar_id"], out avatarUUID); | 201 | Helpers.TryParse((string) requestData["avatar_id"], out avatarUUID); |
202 | Helpers.TryParse((string)requestData["region_uuid"], out regionUUID); | 202 | Helpers.TryParse((string) requestData["region_uuid"], out regionUUID); |
203 | 203 | ||
204 | if (avatarUUID != LLUUID.Zero) | 204 | if (avatarUUID != LLUUID.Zero) |
205 | { | 205 | { |
206 | UserProfileData userProfile = GetUserProfile(avatarUUID); | 206 | UserProfileData userProfile = GetUserProfile(avatarUUID); |
207 | userProfile.CurrentAgent.Region = regionUUID; | 207 | userProfile.CurrentAgent.Region = regionUUID; |
208 | userProfile.CurrentAgent.Handle = (ulong)Convert.ToInt64((string)requestData["region_handle"]); | 208 | userProfile.CurrentAgent.Handle = (ulong) Convert.ToInt64((string) requestData["region_handle"]); |
209 | //userProfile.CurrentAgent. | 209 | //userProfile.CurrentAgent. |
210 | CommitAgent(ref userProfile); | 210 | CommitAgent(ref userProfile); |
211 | //setUserProfile(userProfile); | 211 | //setUserProfile(userProfile); |
@@ -213,7 +213,6 @@ namespace OpenSim.Grid.UserServer | |||
213 | 213 | ||
214 | returnstring = "TRUE"; | 214 | returnstring = "TRUE"; |
215 | } | 215 | } |
216 | |||
217 | } | 216 | } |
218 | responseData.Add("returnString", returnstring); | 217 | responseData.Add("returnString", returnstring); |
219 | response.Value = responseData; | 218 | response.Value = responseData; |
@@ -223,15 +222,18 @@ namespace OpenSim.Grid.UserServer | |||
223 | public XmlRpcResponse XmlRpcResponseXmlRPCAddUserFriend(XmlRpcRequest request) | 222 | public XmlRpcResponse XmlRpcResponseXmlRPCAddUserFriend(XmlRpcRequest request) |
224 | { | 223 | { |
225 | XmlRpcResponse response = new XmlRpcResponse(); | 224 | XmlRpcResponse response = new XmlRpcResponse(); |
226 | Hashtable requestData = (Hashtable)request.Params[0]; | 225 | Hashtable requestData = (Hashtable) request.Params[0]; |
227 | Hashtable responseData = new Hashtable(); | 226 | Hashtable responseData = new Hashtable(); |
228 | string returnString = "FALSE"; | 227 | string returnString = "FALSE"; |
229 | // Query Result Information | 228 | // Query Result Information |
230 | 229 | ||
231 | if (requestData.Contains("ownerID") && requestData.Contains("friendID") && requestData.Contains("friendPerms")) | 230 | if (requestData.Contains("ownerID") && requestData.Contains("friendID") && |
231 | requestData.Contains("friendPerms")) | ||
232 | { | 232 | { |
233 | // UserManagerBase.AddNewuserFriend | 233 | // UserManagerBase.AddNewuserFriend |
234 | AddNewUserFriend(new LLUUID((string)requestData["ownerID"]), new LLUUID((string)requestData["friendID"]), (uint)Convert.ToInt32((string)requestData["friendPerms"])); | 234 | AddNewUserFriend(new LLUUID((string) requestData["ownerID"]), |
235 | new LLUUID((string) requestData["friendID"]), | ||
236 | (uint) Convert.ToInt32((string) requestData["friendPerms"])); | ||
235 | returnString = "TRUE"; | 237 | returnString = "TRUE"; |
236 | } | 238 | } |
237 | responseData["returnString"] = returnString; | 239 | responseData["returnString"] = returnString; |
@@ -242,7 +244,7 @@ namespace OpenSim.Grid.UserServer | |||
242 | public XmlRpcResponse XmlRpcResponseXmlRPCRemoveUserFriend(XmlRpcRequest request) | 244 | public XmlRpcResponse XmlRpcResponseXmlRPCRemoveUserFriend(XmlRpcRequest request) |
243 | { | 245 | { |
244 | XmlRpcResponse response = new XmlRpcResponse(); | 246 | XmlRpcResponse response = new XmlRpcResponse(); |
245 | Hashtable requestData = (Hashtable)request.Params[0]; | 247 | Hashtable requestData = (Hashtable) request.Params[0]; |
246 | Hashtable responseData = new Hashtable(); | 248 | Hashtable responseData = new Hashtable(); |
247 | string returnString = "FALSE"; | 249 | string returnString = "FALSE"; |
248 | // Query Result Information | 250 | // Query Result Information |
@@ -250,7 +252,8 @@ namespace OpenSim.Grid.UserServer | |||
250 | if (requestData.Contains("ownerID") && requestData.Contains("friendID")) | 252 | if (requestData.Contains("ownerID") && requestData.Contains("friendID")) |
251 | { | 253 | { |
252 | // UserManagerBase.AddNewuserFriend | 254 | // UserManagerBase.AddNewuserFriend |
253 | RemoveUserFriend(new LLUUID((string)requestData["ownerID"]), new LLUUID((string)requestData["friendID"])); | 255 | RemoveUserFriend(new LLUUID((string) requestData["ownerID"]), |
256 | new LLUUID((string) requestData["friendID"])); | ||
254 | returnString = "TRUE"; | 257 | returnString = "TRUE"; |
255 | } | 258 | } |
256 | responseData["returnString"] = returnString; | 259 | responseData["returnString"] = returnString; |
@@ -261,13 +264,16 @@ namespace OpenSim.Grid.UserServer | |||
261 | public XmlRpcResponse XmlRpcResponseXmlRPCUpdateUserFriendPerms(XmlRpcRequest request) | 264 | public XmlRpcResponse XmlRpcResponseXmlRPCUpdateUserFriendPerms(XmlRpcRequest request) |
262 | { | 265 | { |
263 | XmlRpcResponse response = new XmlRpcResponse(); | 266 | XmlRpcResponse response = new XmlRpcResponse(); |
264 | Hashtable requestData = (Hashtable)request.Params[0]; | 267 | Hashtable requestData = (Hashtable) request.Params[0]; |
265 | Hashtable responseData = new Hashtable(); | 268 | Hashtable responseData = new Hashtable(); |
266 | string returnString = "FALSE"; | 269 | string returnString = "FALSE"; |
267 | 270 | ||
268 | if (requestData.Contains("ownerID") && requestData.Contains("friendID") && requestData.Contains("friendPerms")) | 271 | if (requestData.Contains("ownerID") && requestData.Contains("friendID") && |
272 | requestData.Contains("friendPerms")) | ||
269 | { | 273 | { |
270 | UpdateUserFriendPerms(new LLUUID((string)requestData["ownerID"]), new LLUUID((string)requestData["friendID"]), (uint)Convert.ToInt32((string)requestData["friendPerms"])); | 274 | UpdateUserFriendPerms(new LLUUID((string) requestData["ownerID"]), |
275 | new LLUUID((string) requestData["friendID"]), | ||
276 | (uint) Convert.ToInt32((string) requestData["friendPerms"])); | ||
271 | // UserManagerBase. | 277 | // UserManagerBase. |
272 | returnString = "TRUE"; | 278 | returnString = "TRUE"; |
273 | } | 279 | } |
@@ -279,14 +285,14 @@ namespace OpenSim.Grid.UserServer | |||
279 | public XmlRpcResponse XmlRpcResponseXmlRPCGetUserFriendList(XmlRpcRequest request) | 285 | public XmlRpcResponse XmlRpcResponseXmlRPCGetUserFriendList(XmlRpcRequest request) |
280 | { | 286 | { |
281 | // XmlRpcResponse response = new XmlRpcResponse(); | 287 | // XmlRpcResponse response = new XmlRpcResponse(); |
282 | Hashtable requestData = (Hashtable)request.Params[0]; | 288 | Hashtable requestData = (Hashtable) request.Params[0]; |
283 | // Hashtable responseData = new Hashtable(); | 289 | // Hashtable responseData = new Hashtable(); |
284 | 290 | ||
285 | List<FriendListItem> returndata = new List<FriendListItem>(); | 291 | List<FriendListItem> returndata = new List<FriendListItem>(); |
286 | 292 | ||
287 | if (requestData.Contains("ownerID")) | 293 | if (requestData.Contains("ownerID")) |
288 | { | 294 | { |
289 | returndata = this.GetUserFriendList(new LLUUID((string)requestData["ownerID"])); | 295 | returndata = GetUserFriendList(new LLUUID((string) requestData["ownerID"])); |
290 | } | 296 | } |
291 | 297 | ||
292 | return FriendListItemListtoXmlRPCResponse(returndata); | 298 | return FriendListItemListtoXmlRPCResponse(returndata); |
@@ -295,12 +301,12 @@ namespace OpenSim.Grid.UserServer | |||
295 | public XmlRpcResponse XmlRPCGetAvatarAppearance(XmlRpcRequest request) | 301 | public XmlRpcResponse XmlRPCGetAvatarAppearance(XmlRpcRequest request) |
296 | { | 302 | { |
297 | XmlRpcResponse response = new XmlRpcResponse(); | 303 | XmlRpcResponse response = new XmlRpcResponse(); |
298 | Hashtable requestData = (Hashtable)request.Params[0]; | 304 | Hashtable requestData = (Hashtable) request.Params[0]; |
299 | AvatarAppearance appearance = null; | 305 | AvatarAppearance appearance; |
300 | Hashtable responseData = null; | 306 | Hashtable responseData; |
301 | if (requestData.Contains("owner")) | 307 | if (requestData.Contains("owner")) |
302 | { | 308 | { |
303 | appearance = GetUserAppearance(new LLUUID((string)requestData["owner"])); | 309 | appearance = GetUserAppearance(new LLUUID((string) requestData["owner"])); |
304 | if (appearance == null) | 310 | if (appearance == null) |
305 | { | 311 | { |
306 | responseData = new Hashtable(); | 312 | responseData = new Hashtable(); |
@@ -326,12 +332,12 @@ namespace OpenSim.Grid.UserServer | |||
326 | public XmlRpcResponse XmlRPCUpdateAvatarAppearance(XmlRpcRequest request) | 332 | public XmlRpcResponse XmlRPCUpdateAvatarAppearance(XmlRpcRequest request) |
327 | { | 333 | { |
328 | XmlRpcResponse response = new XmlRpcResponse(); | 334 | XmlRpcResponse response = new XmlRpcResponse(); |
329 | Hashtable requestData = (Hashtable)request.Params[0]; | 335 | Hashtable requestData = (Hashtable) request.Params[0]; |
330 | Hashtable responseData = null; | 336 | Hashtable responseData; |
331 | if (requestData.Contains("owner")) | 337 | if (requestData.Contains("owner")) |
332 | { | 338 | { |
333 | AvatarAppearance appearance = new AvatarAppearance(requestData); | 339 | AvatarAppearance appearance = new AvatarAppearance(requestData); |
334 | UpdateUserAppearance(new LLUUID((string)requestData["owner"]), appearance); | 340 | UpdateUserAppearance(new LLUUID((string) requestData["owner"]), appearance); |
335 | responseData = new Hashtable(); | 341 | responseData = new Hashtable(); |
336 | responseData["returnString"] = "TRUE"; | 342 | responseData["returnString"] = "TRUE"; |
337 | } | 343 | } |
@@ -356,8 +362,7 @@ namespace OpenSim.Grid.UserServer | |||
356 | 362 | ||
357 | // Regex objAlphaNumericPattern = new Regex("[^a-zA-Z0-9]"); | 363 | // Regex objAlphaNumericPattern = new Regex("[^a-zA-Z0-9]"); |
358 | 364 | ||
359 | string[] querysplit; | 365 | string[] querysplit = query.Split(' '); |
360 | querysplit = query.Split(' '); | ||
361 | 366 | ||
362 | if (querysplit.Length == 2) | 367 | if (querysplit.Length == 2) |
363 | { | 368 | { |
@@ -389,10 +394,9 @@ namespace OpenSim.Grid.UserServer | |||
389 | //CFK: Console.WriteLine("METHOD BY UUID CALLED"); | 394 | //CFK: Console.WriteLine("METHOD BY UUID CALLED"); |
390 | if (requestData.Contains("avatar_uuid")) | 395 | if (requestData.Contains("avatar_uuid")) |
391 | { | 396 | { |
392 | LLUUID guess = new LLUUID(); | ||
393 | try | 397 | try |
394 | { | 398 | { |
395 | guess = new LLUUID((string) requestData["avatar_uuid"]); | 399 | LLUUID guess = new LLUUID((string) requestData["avatar_uuid"]); |
396 | 400 | ||
397 | userProfile = GetUserProfile(guess); | 401 | userProfile = GetUserProfile(guess); |
398 | } | 402 | } |
@@ -417,15 +421,15 @@ namespace OpenSim.Grid.UserServer | |||
417 | public XmlRpcResponse XmlRPCGetAgentMethodUUID(XmlRpcRequest request) | 421 | public XmlRpcResponse XmlRPCGetAgentMethodUUID(XmlRpcRequest request) |
418 | { | 422 | { |
419 | XmlRpcResponse response = new XmlRpcResponse(); | 423 | XmlRpcResponse response = new XmlRpcResponse(); |
420 | Hashtable requestData = (Hashtable)request.Params[0]; | 424 | Hashtable requestData = (Hashtable) request.Params[0]; |
421 | UserProfileData userProfile; | 425 | UserProfileData userProfile; |
422 | //CFK: this clogs the UserServer log and is not necessary at this time. | 426 | //CFK: this clogs the UserServer log and is not necessary at this time. |
423 | //CFK: Console.WriteLine("METHOD BY UUID CALLED"); | 427 | //CFK: Console.WriteLine("METHOD BY UUID CALLED"); |
424 | if (requestData.Contains("avatar_uuid")) | 428 | if (requestData.Contains("avatar_uuid")) |
425 | { | 429 | { |
426 | LLUUID guess = LLUUID.Zero; | 430 | LLUUID guess; |
427 | 431 | ||
428 | Helpers.TryParse((string)requestData["avatar_uuid"],out guess); | 432 | Helpers.TryParse((string) requestData["avatar_uuid"], out guess); |
429 | 433 | ||
430 | if (guess == LLUUID.Zero) | 434 | if (guess == LLUUID.Zero) |
431 | { | 435 | { |
@@ -446,12 +450,12 @@ namespace OpenSim.Grid.UserServer | |||
446 | } | 450 | } |
447 | Hashtable responseData = new Hashtable(); | 451 | Hashtable responseData = new Hashtable(); |
448 | 452 | ||
449 | responseData["handle"]=userProfile.CurrentAgent.Handle.ToString(); | 453 | responseData["handle"] = userProfile.CurrentAgent.Handle.ToString(); |
450 | responseData["session"]=userProfile.CurrentAgent.SessionID.ToString(); | 454 | responseData["session"] = userProfile.CurrentAgent.SessionID.ToString(); |
451 | if (userProfile.CurrentAgent.AgentOnline) | 455 | if (userProfile.CurrentAgent.AgentOnline) |
452 | responseData["agent_online"]="TRUE"; | 456 | responseData["agent_online"] = "TRUE"; |
453 | else | 457 | else |
454 | responseData["agent_online"]="FALSE"; | 458 | responseData["agent_online"] = "FALSE"; |
455 | 459 | ||
456 | response.Value = responseData; | 460 | response.Value = responseData; |
457 | } | 461 | } |
@@ -466,27 +470,28 @@ namespace OpenSim.Grid.UserServer | |||
466 | public XmlRpcResponse XmlRPCCheckAuthSession(XmlRpcRequest request) | 470 | public XmlRpcResponse XmlRPCCheckAuthSession(XmlRpcRequest request) |
467 | { | 471 | { |
468 | XmlRpcResponse response = new XmlRpcResponse(); | 472 | XmlRpcResponse response = new XmlRpcResponse(); |
469 | Hashtable requestData = (Hashtable)request.Params[0]; | 473 | Hashtable requestData = (Hashtable) request.Params[0]; |
470 | UserProfileData userProfile; | 474 | UserProfileData userProfile; |
471 | 475 | ||
472 | string authed = "FALSE"; | 476 | string authed = "FALSE"; |
473 | if (requestData.Contains("avatar_uuid") && requestData.Contains("session_id")) | 477 | if (requestData.Contains("avatar_uuid") && requestData.Contains("session_id")) |
474 | { | 478 | { |
475 | LLUUID guess_aid = LLUUID.Zero; | 479 | LLUUID guess_aid; |
476 | LLUUID guess_sid = LLUUID.Zero; | 480 | LLUUID guess_sid; |
477 | 481 | ||
478 | Helpers.TryParse((string)requestData["avatar_uuid"], out guess_aid); | 482 | Helpers.TryParse((string) requestData["avatar_uuid"], out guess_aid); |
479 | if (guess_aid == LLUUID.Zero) | 483 | if (guess_aid == LLUUID.Zero) |
480 | { | 484 | { |
481 | return CreateUnknownUserErrorResponse(); | 485 | return CreateUnknownUserErrorResponse(); |
482 | } | 486 | } |
483 | Helpers.TryParse((string)requestData["session_id"], out guess_sid); | 487 | Helpers.TryParse((string) requestData["session_id"], out guess_sid); |
484 | if (guess_sid == LLUUID.Zero) | 488 | if (guess_sid == LLUUID.Zero) |
485 | { | 489 | { |
486 | return CreateUnknownUserErrorResponse(); | 490 | return CreateUnknownUserErrorResponse(); |
487 | } | 491 | } |
488 | userProfile = GetUserProfile(guess_aid); | 492 | userProfile = GetUserProfile(guess_aid); |
489 | if (userProfile != null && userProfile.CurrentAgent != null && userProfile.CurrentAgent.SessionID == guess_sid) | 493 | if (userProfile != null && userProfile.CurrentAgent != null && |
494 | userProfile.CurrentAgent.SessionID == guess_sid) | ||
490 | { | 495 | { |
491 | authed = "TRUE"; | 496 | authed = "TRUE"; |
492 | } | 497 | } |
@@ -507,17 +512,16 @@ namespace OpenSim.Grid.UserServer | |||
507 | { | 512 | { |
508 | m_log.Debug("[UserManager]: Got request to update user profile"); | 513 | m_log.Debug("[UserManager]: Got request to update user profile"); |
509 | XmlRpcResponse response = new XmlRpcResponse(); | 514 | XmlRpcResponse response = new XmlRpcResponse(); |
510 | Hashtable requestData = (Hashtable)request.Params[0]; | 515 | Hashtable requestData = (Hashtable) request.Params[0]; |
511 | Hashtable responseData = new Hashtable(); | 516 | Hashtable responseData = new Hashtable(); |
512 | 517 | ||
513 | UserProfileData userProfile; | ||
514 | if (!requestData.Contains("avatar_uuid")) | 518 | if (!requestData.Contains("avatar_uuid")) |
515 | { | 519 | { |
516 | return CreateUnknownUserErrorResponse(); | 520 | return CreateUnknownUserErrorResponse(); |
517 | } | 521 | } |
518 | 522 | ||
519 | LLUUID UserUUID = new LLUUID((string)requestData["avatar_uuid"]); | 523 | LLUUID UserUUID = new LLUUID((string) requestData["avatar_uuid"]); |
520 | userProfile = GetUserProfile(UserUUID); | 524 | UserProfileData userProfile = GetUserProfile(UserUUID); |
521 | if (null == userProfile) | 525 | if (null == userProfile) |
522 | { | 526 | { |
523 | return CreateUnknownUserErrorResponse(); | 527 | return CreateUnknownUserErrorResponse(); |
@@ -528,11 +532,11 @@ namespace OpenSim.Grid.UserServer | |||
528 | } | 532 | } |
529 | if (requestData.Contains("FLImageID")) | 533 | if (requestData.Contains("FLImageID")) |
530 | { | 534 | { |
531 | userProfile.FirstLifeImage = new LLUUID((string)requestData["FLImageID"]); | 535 | userProfile.FirstLifeImage = new LLUUID((string) requestData["FLImageID"]); |
532 | } | 536 | } |
533 | if (requestData.Contains("ImageID")) | 537 | if (requestData.Contains("ImageID")) |
534 | { | 538 | { |
535 | userProfile.Image = new LLUUID((string)requestData["ImageID"]); | 539 | userProfile.Image = new LLUUID((string) requestData["ImageID"]); |
536 | } | 540 | } |
537 | // dont' know how yet | 541 | // dont' know how yet |
538 | if (requestData.Contains("MaturePublish")) | 542 | if (requestData.Contains("MaturePublish")) |
@@ -540,11 +544,11 @@ namespace OpenSim.Grid.UserServer | |||
540 | } | 544 | } |
541 | if (requestData.Contains("AboutText")) | 545 | if (requestData.Contains("AboutText")) |
542 | { | 546 | { |
543 | userProfile.AboutText = (string)requestData["AboutText"]; | 547 | userProfile.AboutText = (string) requestData["AboutText"]; |
544 | } | 548 | } |
545 | if (requestData.Contains("FLAboutText")) | 549 | if (requestData.Contains("FLAboutText")) |
546 | { | 550 | { |
547 | userProfile.FirstLifeAboutText = (string)requestData["FLAboutText"]; | 551 | userProfile.FirstLifeAboutText = (string) requestData["FLAboutText"]; |
548 | } | 552 | } |
549 | // not in DB yet. | 553 | // not in DB yet. |
550 | if (requestData.Contains("ProfileURL")) | 554 | if (requestData.Contains("ProfileURL")) |
@@ -554,7 +558,7 @@ namespace OpenSim.Grid.UserServer | |||
554 | { | 558 | { |
555 | try | 559 | try |
556 | { | 560 | { |
557 | userProfile.HomeRegion = Convert.ToUInt64((string)requestData["home_region"]); | 561 | userProfile.HomeRegion = Convert.ToUInt64((string) requestData["home_region"]); |
558 | } | 562 | } |
559 | catch (ArgumentException) | 563 | catch (ArgumentException) |
560 | { | 564 | { |
@@ -568,31 +572,29 @@ namespace OpenSim.Grid.UserServer | |||
568 | { | 572 | { |
569 | m_log.Error("[PROFILE]:Failed to set home region, Value was too large"); | 573 | m_log.Error("[PROFILE]:Failed to set home region, Value was too large"); |
570 | } | 574 | } |
571 | |||
572 | } | 575 | } |
573 | if (requestData.Contains("home_region_id")) | 576 | if (requestData.Contains("home_region_id")) |
574 | { | 577 | { |
575 | LLUUID regionID = LLUUID.Zero; | 578 | LLUUID regionID; |
576 | LLUUID.TryParse((string)requestData["home_region_id"], out regionID); | 579 | LLUUID.TryParse((string) requestData["home_region_id"], out regionID); |
577 | userProfile.HomeRegionID = regionID; | 580 | userProfile.HomeRegionID = regionID; |
578 | } | 581 | } |
579 | if (requestData.Contains("home_pos_x")) | 582 | if (requestData.Contains("home_pos_x")) |
580 | { | 583 | { |
581 | try | 584 | try |
582 | { | 585 | { |
583 | userProfile.HomeLocationX = (float)Convert.ToDecimal((string)requestData["home_pos_x"]); | 586 | userProfile.HomeLocationX = (float) Convert.ToDecimal((string) requestData["home_pos_x"]); |
584 | } | 587 | } |
585 | catch (InvalidCastException) | 588 | catch (InvalidCastException) |
586 | { | 589 | { |
587 | m_log.Error("[PROFILE]:Failed to set home postion x"); | 590 | m_log.Error("[PROFILE]:Failed to set home postion x"); |
588 | } | 591 | } |
589 | |||
590 | } | 592 | } |
591 | if (requestData.Contains("home_pos_y")) | 593 | if (requestData.Contains("home_pos_y")) |
592 | { | 594 | { |
593 | try | 595 | try |
594 | { | 596 | { |
595 | userProfile.HomeLocationY = (float)Convert.ToDecimal((string)requestData["home_pos_y"]); | 597 | userProfile.HomeLocationY = (float) Convert.ToDecimal((string) requestData["home_pos_y"]); |
596 | } | 598 | } |
597 | catch (InvalidCastException) | 599 | catch (InvalidCastException) |
598 | { | 600 | { |
@@ -603,7 +605,7 @@ namespace OpenSim.Grid.UserServer | |||
603 | { | 605 | { |
604 | try | 606 | try |
605 | { | 607 | { |
606 | userProfile.HomeLocationZ = (float)Convert.ToDecimal((string)requestData["home_pos_z"]); | 608 | userProfile.HomeLocationZ = (float) Convert.ToDecimal((string) requestData["home_pos_z"]); |
607 | } | 609 | } |
608 | catch (InvalidCastException) | 610 | catch (InvalidCastException) |
609 | { | 611 | { |
@@ -614,7 +616,7 @@ namespace OpenSim.Grid.UserServer | |||
614 | { | 616 | { |
615 | try | 617 | try |
616 | { | 618 | { |
617 | userProfile.HomeLookAtX = (float)Convert.ToDecimal((string)requestData["home_look_x"]); | 619 | userProfile.HomeLookAtX = (float) Convert.ToDecimal((string) requestData["home_look_x"]); |
618 | } | 620 | } |
619 | catch (InvalidCastException) | 621 | catch (InvalidCastException) |
620 | { | 622 | { |
@@ -625,7 +627,7 @@ namespace OpenSim.Grid.UserServer | |||
625 | { | 627 | { |
626 | try | 628 | try |
627 | { | 629 | { |
628 | userProfile.HomeLookAtY = (float)Convert.ToDecimal((string)requestData["home_look_y"]); | 630 | userProfile.HomeLookAtY = (float) Convert.ToDecimal((string) requestData["home_look_y"]); |
629 | } | 631 | } |
630 | catch (InvalidCastException) | 632 | catch (InvalidCastException) |
631 | { | 633 | { |
@@ -636,7 +638,7 @@ namespace OpenSim.Grid.UserServer | |||
636 | { | 638 | { |
637 | try | 639 | try |
638 | { | 640 | { |
639 | userProfile.HomeLookAtZ = (float)Convert.ToDecimal((string)requestData["home_look_z"]); | 641 | userProfile.HomeLookAtZ = (float) Convert.ToDecimal((string) requestData["home_look_z"]); |
640 | } | 642 | } |
641 | catch (InvalidCastException) | 643 | catch (InvalidCastException) |
642 | { | 644 | { |
@@ -647,7 +649,7 @@ namespace OpenSim.Grid.UserServer | |||
647 | { | 649 | { |
648 | try | 650 | try |
649 | { | 651 | { |
650 | userProfile.UserFlags = Convert.ToInt32((string)requestData["user_flags"]); | 652 | userProfile.UserFlags = Convert.ToInt32((string) requestData["user_flags"]); |
651 | } | 653 | } |
652 | catch (InvalidCastException) | 654 | catch (InvalidCastException) |
653 | { | 655 | { |
@@ -658,7 +660,7 @@ namespace OpenSim.Grid.UserServer | |||
658 | { | 660 | { |
659 | try | 661 | try |
660 | { | 662 | { |
661 | userProfile.GodLevel = Convert.ToInt32((string)requestData["god_level"]); | 663 | userProfile.GodLevel = Convert.ToInt32((string) requestData["god_level"]); |
662 | } | 664 | } |
663 | catch (InvalidCastException) | 665 | catch (InvalidCastException) |
664 | { | 666 | { |
@@ -669,7 +671,7 @@ namespace OpenSim.Grid.UserServer | |||
669 | { | 671 | { |
670 | try | 672 | try |
671 | { | 673 | { |
672 | userProfile.CustomType = (string)requestData["custom_type"]; | 674 | userProfile.CustomType = (string) requestData["custom_type"]; |
673 | } | 675 | } |
674 | catch (InvalidCastException) | 676 | catch (InvalidCastException) |
675 | { | 677 | { |
@@ -680,7 +682,7 @@ namespace OpenSim.Grid.UserServer | |||
680 | { | 682 | { |
681 | try | 683 | try |
682 | { | 684 | { |
683 | userProfile.Partner = new LLUUID((string)requestData["partner"]); | 685 | userProfile.Partner = new LLUUID((string) requestData["partner"]); |
684 | } | 686 | } |
685 | catch (InvalidCastException) | 687 | catch (InvalidCastException) |
686 | { | 688 | { |
@@ -689,7 +691,7 @@ namespace OpenSim.Grid.UserServer | |||
689 | } | 691 | } |
690 | else | 692 | else |
691 | { | 693 | { |
692 | userProfile.Partner = LLUUID.Zero; | 694 | userProfile.Partner = LLUUID.Zero; |
693 | } | 695 | } |
694 | 696 | ||
695 | // call plugin! | 697 | // call plugin! |
@@ -702,18 +704,18 @@ namespace OpenSim.Grid.UserServer | |||
702 | public XmlRpcResponse XmlRPCLogOffUserMethodUUID(XmlRpcRequest request) | 704 | public XmlRpcResponse XmlRPCLogOffUserMethodUUID(XmlRpcRequest request) |
703 | { | 705 | { |
704 | XmlRpcResponse response = new XmlRpcResponse(); | 706 | XmlRpcResponse response = new XmlRpcResponse(); |
705 | Hashtable requestData = (Hashtable)request.Params[0]; | 707 | Hashtable requestData = (Hashtable) request.Params[0]; |
706 | 708 | ||
707 | if (requestData.Contains("avatar_uuid")) | 709 | if (requestData.Contains("avatar_uuid")) |
708 | { | 710 | { |
709 | try | 711 | try |
710 | { | 712 | { |
711 | LLUUID userUUID = new LLUUID((string)requestData["avatar_uuid"]); | 713 | LLUUID userUUID = new LLUUID((string) requestData["avatar_uuid"]); |
712 | LLUUID RegionID = new LLUUID((string)requestData["region_uuid"]); | 714 | LLUUID RegionID = new LLUUID((string) requestData["region_uuid"]); |
713 | ulong regionhandle = (ulong)Convert.ToInt64((string)requestData["region_handle"]); | 715 | ulong regionhandle = (ulong) Convert.ToInt64((string) requestData["region_handle"]); |
714 | float posx = (float)Convert.ToDecimal((string)requestData["region_pos_x"]); | 716 | float posx = (float) Convert.ToDecimal((string) requestData["region_pos_x"]); |
715 | float posy = (float)Convert.ToDecimal((string)requestData["region_pos_y"]); | 717 | float posy = (float) Convert.ToDecimal((string) requestData["region_pos_y"]); |
716 | float posz = (float)Convert.ToDecimal((string)requestData["region_pos_z"]); | 718 | float posz = (float) Convert.ToDecimal((string) requestData["region_pos_z"]); |
717 | 719 | ||
718 | handlerLogOffUser = OnLogOffUser; | 720 | handlerLogOffUser = OnLogOffUser; |
719 | if (handlerLogOffUser != null) | 721 | if (handlerLogOffUser != null) |
@@ -752,4 +754,4 @@ namespace OpenSim.Grid.UserServer | |||
752 | throw new Exception("The method or operation is not implemented."); | 754 | throw new Exception("The method or operation is not implemented."); |
753 | } | 755 | } |
754 | } | 756 | } |
755 | } | 757 | } \ No newline at end of file |