UserManager.cs 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667
  1. /*
  2. * Copyright (c) Contributors, http://opensimulator.org/
  3. * See CONTRIBUTORS.TXT for a full list of copyright holders.
  4. *
  5. * Redistribution and use in source and binary forms, with or without
  6. * modification, are permitted provided that the following conditions are met:
  7. * * Redistributions of source code must retain the above copyright
  8. * notice, this list of conditions and the following disclaimer.
  9. * * Redistributions in binary form must reproduce the above copyright
  10. * notice, this list of conditions and the following disclaimer in the
  11. * documentation and/or other materials provided with the distribution.
  12. * * Neither the name of the OpenSim Project nor the
  13. * names of its contributors may be used to endorse or promote products
  14. * derived from this software without specific prior written permission.
  15. *
  16. * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
  17. * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  18. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  19. * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
  20. * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  21. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  22. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  23. * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  24. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  25. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  26. */
  27. using System;
  28. using System.Collections;
  29. using System.Collections.Generic;
  30. using System.Reflection;
  31. using System.Text.RegularExpressions;
  32. using libsecondlife;
  33. using log4net;
  34. using Nwc.XmlRpc;
  35. using OpenSim.Framework;
  36. using OpenSim.Framework.Communications;
  37. using OpenSim.Framework.Servers;
  38. namespace OpenSim.Grid.UserServer
  39. {
  40. public delegate void logOffUser(LLUUID AgentID);
  41. public class UserManager : UserManagerBase
  42. {
  43. private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
  44. public event logOffUser OnLogOffUser;
  45. private logOffUser handlerLogOffUser = null;
  46. /// <summary>
  47. /// Deletes an active agent session
  48. /// </summary>
  49. /// <param name="request">The request</param>
  50. /// <param name="path">The path (eg /bork/narf/test)</param>
  51. /// <param name="param">Parameters sent</param>
  52. /// <param name="httpRequest">HTTP request header object</param>
  53. /// <param name="httpResponse">HTTP response header object</param>
  54. /// <returns>Success "OK" else error</returns>
  55. public string RestDeleteUserSessionMethod(string request, string path, string param,
  56. OSHttpRequest httpRequest, OSHttpResponse httpResponse)
  57. {
  58. // TODO! Important!
  59. return "OK";
  60. }
  61. /// <summary>
  62. /// Returns an error message that the user could not be found in the database
  63. /// </summary>
  64. /// <returns>XML string consisting of a error element containing individual error(s)</returns>
  65. public XmlRpcResponse CreateUnknownUserErrorResponse()
  66. {
  67. XmlRpcResponse response = new XmlRpcResponse();
  68. Hashtable responseData = new Hashtable();
  69. responseData["error_type"] = "unknown_user";
  70. responseData["error_desc"] = "The user requested is not in the database";
  71. response.Value = responseData;
  72. return response;
  73. }
  74. public XmlRpcResponse AvatarPickerListtoXmlRPCResponse(LLUUID queryID, List<AvatarPickerAvatar> returnUsers)
  75. {
  76. XmlRpcResponse response = new XmlRpcResponse();
  77. Hashtable responseData = new Hashtable();
  78. // Query Result Information
  79. responseData["queryid"] = (string) queryID.ToString();
  80. responseData["avcount"] = (string) returnUsers.Count.ToString();
  81. for (int i = 0; i < returnUsers.Count; i++)
  82. {
  83. responseData["avatarid" + i.ToString()] = returnUsers[i].AvatarID.ToString();
  84. responseData["firstname" + i.ToString()] = returnUsers[i].firstName;
  85. responseData["lastname" + i.ToString()] = returnUsers[i].lastName;
  86. }
  87. response.Value = responseData;
  88. return response;
  89. }
  90. public XmlRpcResponse FriendListItemListtoXmlRPCResponse(List<FriendListItem> returnUsers)
  91. {
  92. XmlRpcResponse response = new XmlRpcResponse();
  93. Hashtable responseData = new Hashtable();
  94. // Query Result Information
  95. responseData["avcount"] = (string)returnUsers.Count.ToString();
  96. for (int i = 0; i < returnUsers.Count; i++)
  97. {
  98. responseData["ownerID" + i.ToString()] = returnUsers[i].FriendListOwner.UUID.ToString();
  99. responseData["friendID" + i.ToString()] = returnUsers[i].Friend.UUID.ToString();
  100. responseData["ownerPerms" + i.ToString()] = returnUsers[i].FriendListOwnerPerms.ToString();
  101. responseData["friendPerms" + i.ToString()] = returnUsers[i].FriendPerms.ToString();
  102. }
  103. response.Value = responseData;
  104. return response;
  105. }
  106. /// <summary>
  107. /// Converts a user profile to an XML element which can be returned
  108. /// </summary>
  109. /// <param name="profile">The user profile</param>
  110. /// <returns>A string containing an XML Document of the user profile</returns>
  111. public XmlRpcResponse ProfileToXmlRPCResponse(UserProfileData profile)
  112. {
  113. XmlRpcResponse response = new XmlRpcResponse();
  114. Hashtable responseData = new Hashtable();
  115. // Account information
  116. responseData["firstname"] = profile.FirstName;
  117. responseData["lastname"] = profile.SurName;
  118. responseData["uuid"] = profile.ID.ToString();
  119. // Server Information
  120. responseData["server_inventory"] = profile.UserInventoryURI;
  121. responseData["server_asset"] = profile.UserAssetURI;
  122. // Profile Information
  123. responseData["profile_about"] = profile.AboutText;
  124. responseData["profile_firstlife_about"] = profile.FirstLifeAboutText;
  125. responseData["profile_firstlife_image"] = profile.FirstLifeImage.ToString();
  126. responseData["profile_can_do"] = profile.CanDoMask.ToString();
  127. responseData["profile_want_do"] = profile.WantDoMask.ToString();
  128. responseData["profile_image"] = profile.Image.ToString();
  129. responseData["profile_created"] = profile.Created.ToString();
  130. responseData["profile_lastlogin"] = profile.LastLogin.ToString();
  131. // Home region information
  132. responseData["home_coordinates_x"] = profile.HomeLocation.X.ToString();
  133. responseData["home_coordinates_y"] = profile.HomeLocation.Y.ToString();
  134. responseData["home_coordinates_z"] = profile.HomeLocation.Z.ToString();
  135. responseData["home_region"] = profile.HomeRegion.ToString();
  136. responseData["home_look_x"] = profile.HomeLookAt.X.ToString();
  137. responseData["home_look_y"] = profile.HomeLookAt.Y.ToString();
  138. responseData["home_look_z"] = profile.HomeLookAt.Z.ToString();
  139. response.Value = responseData;
  140. return response;
  141. }
  142. #region XMLRPC User Methods
  143. public XmlRpcResponse XmlRPCGetAvatarPickerAvatar(XmlRpcRequest request)
  144. {
  145. // XmlRpcResponse response = new XmlRpcResponse();
  146. Hashtable requestData = (Hashtable) request.Params[0];
  147. List<AvatarPickerAvatar> returnAvatar = new List<AvatarPickerAvatar>();
  148. LLUUID queryID = new LLUUID(LLUUID.Zero.ToString());
  149. if (requestData.Contains("avquery") && requestData.Contains("queryid"))
  150. {
  151. queryID = new LLUUID((string) requestData["queryid"]);
  152. returnAvatar = GenerateAgentPickerRequestResponse(queryID, (string) requestData["avquery"]);
  153. }
  154. m_log.InfoFormat("[AVATARINFO]: Servicing Avatar Query: " + (string) requestData["avquery"]);
  155. return AvatarPickerListtoXmlRPCResponse(queryID, returnAvatar);
  156. }
  157. public XmlRpcResponse XmlRPCAtRegion(XmlRpcRequest request)
  158. {
  159. XmlRpcResponse response = new XmlRpcResponse();
  160. Hashtable requestData = (Hashtable)request.Params[0];
  161. Hashtable responseData = new Hashtable();
  162. string returnstring = "FALSE";
  163. if (requestData.Contains("avatar_id") && requestData.Contains("region_handle") && requestData.Contains("region_uuid"))
  164. {
  165. // ulong cregionhandle = 0;
  166. LLUUID regionUUID = LLUUID.Zero;
  167. LLUUID AvatarID = LLUUID.Zero;
  168. Helpers.TryParse((string)requestData["avatar_id"], out AvatarID);
  169. Helpers.TryParse((string)requestData["region_uuid"], out regionUUID);
  170. // try
  171. // {
  172. // cregionhandle = (ulong)Convert.ToInt64((string)requestData["region_handle"]);
  173. // }
  174. // catch (ArgumentException)
  175. // {
  176. // }
  177. // catch (OverflowException)
  178. // {
  179. // }
  180. // catch (FormatException)
  181. // {
  182. // }
  183. if (AvatarID != LLUUID.Zero)
  184. {
  185. UserProfileData userProfile = GetUserProfile(new LLUUID((string)requestData["avatar_id"]));
  186. userProfile.CurrentAgent.Region = new LLUUID((string)requestData["region_uuid"]);
  187. userProfile.CurrentAgent.Handle = (ulong)Convert.ToInt64((string)requestData["region_handle"]);
  188. //userProfile.CurrentAgent.
  189. CommitAgent(ref userProfile);
  190. //setUserProfile(userProfile);
  191. returnstring = "TRUE";
  192. }
  193. }
  194. responseData.Add("returnString", returnstring);
  195. response.Value = responseData;
  196. return response;
  197. }
  198. public XmlRpcResponse XmlRpcResponseXmlRPCAddUserFriend(XmlRpcRequest request)
  199. {
  200. XmlRpcResponse response = new XmlRpcResponse();
  201. Hashtable requestData = (Hashtable)request.Params[0];
  202. Hashtable responseData = new Hashtable();
  203. string returnString = "FALSE";
  204. // Query Result Information
  205. if (requestData.Contains("ownerID") && requestData.Contains("friendID") && requestData.Contains("friendPerms"))
  206. {
  207. // UserManagerBase.AddNewuserFriend
  208. AddNewUserFriend(new LLUUID((string)requestData["ownerID"]), new LLUUID((string)requestData["friendID"]), (uint)Convert.ToInt32((string)requestData["friendPerms"]));
  209. returnString = "TRUE";
  210. }
  211. responseData["returnString"] = returnString;
  212. response.Value = responseData;
  213. return response;
  214. }
  215. public XmlRpcResponse XmlRpcResponseXmlRPCRemoveUserFriend(XmlRpcRequest request)
  216. {
  217. XmlRpcResponse response = new XmlRpcResponse();
  218. Hashtable requestData = (Hashtable)request.Params[0];
  219. Hashtable responseData = new Hashtable();
  220. string returnString = "FALSE";
  221. // Query Result Information
  222. if (requestData.Contains("ownerID") && requestData.Contains("friendID"))
  223. {
  224. // UserManagerBase.AddNewuserFriend
  225. RemoveUserFriend(new LLUUID((string)requestData["ownerID"]), new LLUUID((string)requestData["friendID"]));
  226. returnString = "TRUE";
  227. }
  228. responseData["returnString"] = returnString;
  229. response.Value = responseData;
  230. return response;
  231. }
  232. public XmlRpcResponse XmlRpcResponseXmlRPCUpdateUserFriendPerms(XmlRpcRequest request)
  233. {
  234. XmlRpcResponse response = new XmlRpcResponse();
  235. Hashtable requestData = (Hashtable)request.Params[0];
  236. Hashtable responseData = new Hashtable();
  237. string returnString = "FALSE";
  238. if (requestData.Contains("ownerID") && requestData.Contains("friendID") && requestData.Contains("friendPerms"))
  239. {
  240. UpdateUserFriendPerms(new LLUUID((string)requestData["ownerID"]), new LLUUID((string)requestData["friendID"]), (uint)Convert.ToInt32((string)requestData["friendPerms"]));
  241. // UserManagerBase.
  242. returnString = "TRUE";
  243. }
  244. responseData["returnString"] = returnString;
  245. response.Value = responseData;
  246. return response;
  247. }
  248. public XmlRpcResponse XmlRpcResponseXmlRPCGetUserFriendList(XmlRpcRequest request)
  249. {
  250. // XmlRpcResponse response = new XmlRpcResponse();
  251. Hashtable requestData = (Hashtable)request.Params[0];
  252. // Hashtable responseData = new Hashtable();
  253. List<FriendListItem> returndata = new List<FriendListItem>();
  254. if (requestData.Contains("ownerID"))
  255. {
  256. returndata = this.GetUserFriendList(new LLUUID((string)requestData["ownerID"]));
  257. }
  258. return FriendListItemListtoXmlRPCResponse(returndata);
  259. }
  260. public XmlRpcResponse XmlRPCGetAvatarAppearance(XmlRpcRequest request)
  261. {
  262. XmlRpcResponse response = new XmlRpcResponse();
  263. Hashtable requestData = (Hashtable)request.Params[0];
  264. AvatarAppearance appearance = null;
  265. Hashtable responseData = null;
  266. if (requestData.Contains("owner"))
  267. {
  268. appearance = GetUserAppearance(new LLUUID((string)requestData["owner"]));
  269. if (appearance == null)
  270. {
  271. responseData = new Hashtable();
  272. responseData["error_type"] = "no appearance";
  273. responseData["error_desc"] = "There was no appearance found for this avatar";
  274. }
  275. else
  276. {
  277. responseData = appearance.ToHashTable();
  278. }
  279. }
  280. else
  281. {
  282. responseData = new Hashtable();
  283. responseData["error_type"] = "unknown_avatar";
  284. responseData["error_desc"] = "The avatar appearance requested is not in the database";
  285. }
  286. response.Value = responseData;
  287. return response;
  288. }
  289. public XmlRpcResponse XmlRPCUpdateAvatarAppearance(XmlRpcRequest request)
  290. {
  291. XmlRpcResponse response = new XmlRpcResponse();
  292. Hashtable requestData = (Hashtable)request.Params[0];
  293. Hashtable responseData = null;
  294. if (requestData.Contains("owner"))
  295. {
  296. AvatarAppearance appearance = new AvatarAppearance(requestData);
  297. UpdateUserAppearance(new LLUUID((string)requestData["owner"]), appearance);
  298. responseData = new Hashtable();
  299. responseData["returnString"] = "TRUE";
  300. }
  301. else
  302. {
  303. responseData = new Hashtable();
  304. responseData["error_type"] = "unknown_avatar";
  305. responseData["error_desc"] = "The avatar appearance requested is not in the database";
  306. }
  307. response.Value = responseData;
  308. return response;
  309. }
  310. public XmlRpcResponse XmlRPCGetUserMethodName(XmlRpcRequest request)
  311. {
  312. // XmlRpcResponse response = new XmlRpcResponse();
  313. Hashtable requestData = (Hashtable) request.Params[0];
  314. UserProfileData userProfile;
  315. if (requestData.Contains("avatar_name"))
  316. {
  317. string query = (string) requestData["avatar_name"];
  318. // Regex objAlphaNumericPattern = new Regex("[^a-zA-Z0-9]");
  319. string[] querysplit;
  320. querysplit = query.Split(' ');
  321. if (querysplit.Length == 2)
  322. {
  323. userProfile = GetUserProfile(querysplit[0], querysplit[1]);
  324. if (userProfile == null)
  325. {
  326. return CreateUnknownUserErrorResponse();
  327. }
  328. }
  329. else
  330. {
  331. return CreateUnknownUserErrorResponse();
  332. }
  333. }
  334. else
  335. {
  336. return CreateUnknownUserErrorResponse();
  337. }
  338. return ProfileToXmlRPCResponse(userProfile);
  339. }
  340. public XmlRpcResponse XmlRPCGetUserMethodUUID(XmlRpcRequest request)
  341. {
  342. // XmlRpcResponse response = new XmlRpcResponse();
  343. Hashtable requestData = (Hashtable) request.Params[0];
  344. UserProfileData userProfile;
  345. //CFK: this clogs the UserServer log and is not necessary at this time.
  346. //CFK: Console.WriteLine("METHOD BY UUID CALLED");
  347. if (requestData.Contains("avatar_uuid"))
  348. {
  349. LLUUID guess = new LLUUID();
  350. try
  351. {
  352. guess = new LLUUID((string) requestData["avatar_uuid"]);
  353. userProfile = GetUserProfile(guess);
  354. }
  355. catch (FormatException)
  356. {
  357. return CreateUnknownUserErrorResponse();
  358. }
  359. if (userProfile == null)
  360. {
  361. return CreateUnknownUserErrorResponse();
  362. }
  363. }
  364. else
  365. {
  366. return CreateUnknownUserErrorResponse();
  367. }
  368. return ProfileToXmlRPCResponse(userProfile);
  369. }
  370. public XmlRpcResponse XmlRPCGetAgentMethodUUID(XmlRpcRequest request)
  371. {
  372. XmlRpcResponse response = new XmlRpcResponse();
  373. Hashtable requestData = (Hashtable)request.Params[0];
  374. UserProfileData userProfile;
  375. //CFK: this clogs the UserServer log and is not necessary at this time.
  376. //CFK: Console.WriteLine("METHOD BY UUID CALLED");
  377. if (requestData.Contains("avatar_uuid"))
  378. {
  379. LLUUID guess = LLUUID.Zero;
  380. Helpers.TryParse((string)requestData["avatar_uuid"],out guess);
  381. if (guess == LLUUID.Zero)
  382. {
  383. return CreateUnknownUserErrorResponse();
  384. }
  385. userProfile = GetUserProfile(guess);
  386. if (userProfile == null)
  387. {
  388. return CreateUnknownUserErrorResponse();
  389. }
  390. // no agent???
  391. if (userProfile.CurrentAgent == null)
  392. {
  393. return CreateUnknownUserErrorResponse();
  394. }
  395. Hashtable responseData = new Hashtable();
  396. responseData["handle"]=userProfile.CurrentAgent.Handle.ToString();
  397. responseData["session"]=userProfile.CurrentAgent.SessionID.ToString();
  398. if (userProfile.CurrentAgent.AgentOnline)
  399. responseData["agent_online"]="TRUE";
  400. else
  401. responseData["agent_online"]="FALSE";
  402. response.Value = responseData;
  403. }
  404. else
  405. {
  406. return CreateUnknownUserErrorResponse();
  407. }
  408. return response;
  409. }
  410. public XmlRpcResponse XmlRpcResponseXmlRPCUpdateUserProfile(XmlRpcRequest request)
  411. {
  412. m_log.Debug("[UserManager]: Got request to update user profile");
  413. XmlRpcResponse response = new XmlRpcResponse();
  414. Hashtable requestData = (Hashtable)request.Params[0];
  415. Hashtable responseData = new Hashtable();
  416. UserProfileData userProfile;
  417. if (!requestData.Contains("avatar_uuid"))
  418. {
  419. return CreateUnknownUserErrorResponse();
  420. }
  421. LLUUID UserUUID = new LLUUID((string)requestData["avatar_uuid"]);
  422. userProfile = GetUserProfile(UserUUID);
  423. if (null == userProfile)
  424. {
  425. return CreateUnknownUserErrorResponse();
  426. }
  427. // don't know how yet.
  428. if (requestData.Contains("AllowPublish"))
  429. {
  430. }
  431. if (requestData.Contains("FLImageID"))
  432. {
  433. userProfile.FirstLifeImage = new LLUUID((string)requestData["FLImageID"]);
  434. }
  435. if (requestData.Contains("ImageID"))
  436. {
  437. userProfile.Image = new LLUUID((string)requestData["ImageID"]);
  438. }
  439. // dont' know how yet
  440. if (requestData.Contains("MaturePublish"))
  441. {
  442. }
  443. if (requestData.Contains("AboutText"))
  444. {
  445. userProfile.AboutText = (string)requestData["AboutText"];
  446. }
  447. if (requestData.Contains("FLAboutText"))
  448. {
  449. userProfile.FirstLifeAboutText = (string)requestData["FLAboutText"];
  450. }
  451. // not in DB yet.
  452. if (requestData.Contains("ProfileURL"))
  453. {
  454. }
  455. if (requestData.Contains("home_region"))
  456. {
  457. try
  458. {
  459. userProfile.HomeRegion = Convert.ToUInt64((string)requestData["home_region"]);
  460. }
  461. catch (ArgumentException)
  462. {
  463. m_log.Error("[PROFILE]:Failed to set home region, Invalid Argument");
  464. }
  465. catch (FormatException)
  466. {
  467. m_log.Error("[PROFILE]:Failed to set home region, Invalid Format");
  468. }
  469. catch (OverflowException)
  470. {
  471. m_log.Error("[PROFILE]:Failed to set home region, Value was too large");
  472. }
  473. }
  474. if (requestData.Contains("home_pos_x"))
  475. {
  476. try
  477. {
  478. userProfile.HomeLocationX = (float)Convert.ToDecimal((string)requestData["home_pos_x"]);
  479. }
  480. catch (InvalidCastException)
  481. {
  482. m_log.Error("[PROFILE]:Failed to set home postion x");
  483. }
  484. }
  485. if (requestData.Contains("home_pos_y"))
  486. {
  487. try
  488. {
  489. userProfile.HomeLocationY = (float)Convert.ToDecimal((string)requestData["home_pos_y"]);
  490. }
  491. catch (InvalidCastException)
  492. {
  493. m_log.Error("[PROFILE]:Failed to set home postion y");
  494. }
  495. }
  496. if (requestData.Contains("home_pos_z"))
  497. {
  498. try
  499. {
  500. userProfile.HomeLocationZ = (float)Convert.ToDecimal((string)requestData["home_pos_z"]);
  501. }
  502. catch (InvalidCastException)
  503. {
  504. m_log.Error("[PROFILE]:Failed to set home postion z");
  505. }
  506. }
  507. if (requestData.Contains("home_look_x"))
  508. {
  509. try
  510. {
  511. userProfile.HomeLookAtX = (float)Convert.ToDecimal((string)requestData["home_look_x"]);
  512. }
  513. catch (InvalidCastException)
  514. {
  515. m_log.Error("[PROFILE]:Failed to set home lookat x");
  516. }
  517. }
  518. if (requestData.Contains("home_look_y"))
  519. {
  520. try
  521. {
  522. userProfile.HomeLookAtY = (float)Convert.ToDecimal((string)requestData["home_look_y"]);
  523. }
  524. catch (InvalidCastException)
  525. {
  526. m_log.Error("[PROFILE]:Failed to set home lookat y");
  527. }
  528. }
  529. if (requestData.Contains("home_look_z"))
  530. {
  531. try
  532. {
  533. userProfile.HomeLookAtZ = (float)Convert.ToDecimal((string)requestData["home_look_z"]);
  534. }
  535. catch (InvalidCastException)
  536. {
  537. m_log.Error("[PROFILE]:Failed to set home lookat z");
  538. }
  539. }
  540. // call plugin!
  541. bool ret = UpdateUserProfileProperties(userProfile);
  542. responseData["returnString"] = ret.ToString();
  543. response.Value = responseData;
  544. return response;
  545. }
  546. public XmlRpcResponse XmlRPCLogOffUserMethodUUID(XmlRpcRequest request)
  547. {
  548. XmlRpcResponse response = new XmlRpcResponse();
  549. Hashtable requestData = (Hashtable)request.Params[0];
  550. if (requestData.Contains("avatar_uuid"))
  551. {
  552. try
  553. {
  554. LLUUID userUUID = new LLUUID((string)requestData["avatar_uuid"]);
  555. LLUUID RegionID = new LLUUID((string)requestData["region_uuid"]);
  556. ulong regionhandle = (ulong)Convert.ToInt64((string)requestData["region_handle"]);
  557. float posx = (float)Convert.ToDecimal((string)requestData["region_pos_x"]);
  558. float posy = (float)Convert.ToDecimal((string)requestData["region_pos_y"]);
  559. float posz = (float)Convert.ToDecimal((string)requestData["region_pos_z"]);
  560. handlerLogOffUser = OnLogOffUser;
  561. if (handlerLogOffUser != null)
  562. handlerLogOffUser(userUUID);
  563. LogOffUser(userUUID, RegionID, regionhandle, posx, posy, posz);
  564. }
  565. catch (FormatException)
  566. {
  567. m_log.Warn("[LOGOUT]: Error in Logout XMLRPC Params");
  568. return response;
  569. }
  570. }
  571. else
  572. {
  573. return CreateUnknownUserErrorResponse();
  574. }
  575. return response;
  576. }
  577. #endregion
  578. public override UserProfileData SetupMasterUser(string firstName, string lastName)
  579. {
  580. throw new Exception("The method or operation is not implemented.");
  581. }
  582. public override UserProfileData SetupMasterUser(string firstName, string lastName, string password)
  583. {
  584. throw new Exception("The method or operation is not implemented.");
  585. }
  586. public override UserProfileData SetupMasterUser(LLUUID uuid)
  587. {
  588. throw new Exception("The method or operation is not implemented.");
  589. }
  590. }
  591. }