OGS1UserServices.cs 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662
  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.Net;
  31. using System.Reflection;
  32. using System.Text.RegularExpressions;
  33. using libsecondlife;
  34. using log4net;
  35. using Nwc.XmlRpc;
  36. using OpenSim.Framework;
  37. using OpenSim.Framework.Communications;
  38. namespace OpenSim.Region.Communications.OGS1
  39. {
  40. public class OGS1UserServices : IUserService
  41. {
  42. private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
  43. private CommunicationsOGS1 m_parent;
  44. public OGS1UserServices(CommunicationsOGS1 parent)
  45. {
  46. m_parent = parent;
  47. }
  48. public UserProfileData ConvertXMLRPCDataToUserProfile(Hashtable data)
  49. {
  50. if (data.Contains("error_type"))
  51. {
  52. m_log.Warn("[GRID]: " +
  53. "Error sent by user server when trying to get user profile: (" +
  54. data["error_type"] +
  55. "): " + data["error_desc"]);
  56. return null;
  57. }
  58. UserProfileData userData = new UserProfileData();
  59. userData.FirstName = (string) data["firstname"];
  60. userData.SurName = (string) data["lastname"];
  61. userData.ID = new LLUUID((string) data["uuid"]);
  62. userData.UserInventoryURI = (string) data["server_inventory"];
  63. userData.UserAssetURI = (string) data["server_asset"];
  64. userData.FirstLifeAboutText = (string) data["profile_firstlife_about"];
  65. userData.FirstLifeImage = new LLUUID((string) data["profile_firstlife_image"]);
  66. userData.CanDoMask = Convert.ToUInt32((string) data["profile_can_do"]);
  67. userData.WantDoMask = Convert.ToUInt32(data["profile_want_do"]);
  68. userData.AboutText = (string)data["profile_about"];
  69. userData.Image = new LLUUID((string) data["profile_image"]);
  70. userData.LastLogin = Convert.ToInt32((string) data["profile_lastlogin"]);
  71. userData.HomeRegion = Convert.ToUInt64((string) data["home_region"]);
  72. userData.HomeLocation =
  73. new LLVector3((float) Convert.ToDecimal((string) data["home_coordinates_x"]),
  74. (float) Convert.ToDecimal((string) data["home_coordinates_y"]),
  75. (float) Convert.ToDecimal((string) data["home_coordinates_z"]));
  76. userData.HomeLookAt =
  77. new LLVector3((float) Convert.ToDecimal((string) data["home_look_x"]),
  78. (float) Convert.ToDecimal((string) data["home_look_y"]),
  79. (float) Convert.ToDecimal((string) data["home_look_z"]));
  80. return userData;
  81. }
  82. public AvatarAppearance ConvertXMLRPCDataToAvatarAppearance(Hashtable data)
  83. {
  84. if (data != null)
  85. {
  86. if (data.Contains("error_type"))
  87. {
  88. m_log.Warn("[GRID]: " +
  89. "Error sent by user server when trying to get user appearance: (" +
  90. data["error_type"] +
  91. "): " + data["error_desc"]);
  92. return null;
  93. }
  94. else
  95. {
  96. return new AvatarAppearance(data);
  97. }
  98. }
  99. else
  100. {
  101. m_log.Error("[GRID]: The avatar appearance is null, something bad happenend");
  102. return null;
  103. }
  104. }
  105. public List<AvatarPickerAvatar> ConvertXMLRPCDataToAvatarPickerList(LLUUID queryID, Hashtable data)
  106. {
  107. List<AvatarPickerAvatar> pickerlist = new List<AvatarPickerAvatar>();
  108. int pickercount = Convert.ToInt32((string) data["avcount"]);
  109. LLUUID respqueryID = new LLUUID((string) data["queryid"]);
  110. if (queryID == respqueryID)
  111. {
  112. for (int i = 0; i < pickercount; i++)
  113. {
  114. AvatarPickerAvatar apicker = new AvatarPickerAvatar();
  115. LLUUID avatarID = new LLUUID((string) data["avatarid" + i.ToString()]);
  116. string firstname = (string) data["firstname" + i.ToString()];
  117. string lastname = (string) data["lastname" + i.ToString()];
  118. apicker.AvatarID = avatarID;
  119. apicker.firstName = firstname;
  120. apicker.lastName = lastname;
  121. pickerlist.Add(apicker);
  122. }
  123. }
  124. else
  125. {
  126. m_log.Warn("[OGS1 USER SERVICES]: Got invalid queryID from userServer");
  127. }
  128. return pickerlist;
  129. }
  130. public List<FriendListItem> ConvertXMLRPCDataToFriendListItemList(Hashtable data)
  131. {
  132. List<FriendListItem> buddylist = new List<FriendListItem>();
  133. int buddycount = Convert.ToInt32((string)data["avcount"]);
  134. for (int i = 0; i < buddycount; i++)
  135. {
  136. FriendListItem buddylistitem = new FriendListItem();
  137. buddylistitem.FriendListOwner = new LLUUID((string)data["ownerID" + i.ToString()]);
  138. buddylistitem.Friend = new LLUUID((string)data["friendID" + i.ToString()]);
  139. buddylistitem.FriendListOwnerPerms = (uint)Convert.ToInt32((string)data["ownerPerms" + i.ToString()]);
  140. buddylistitem.FriendPerms = (uint)Convert.ToInt32((string)data["friendPerms" + i.ToString()]);
  141. buddylist.Add(buddylistitem);
  142. }
  143. return buddylist;
  144. }
  145. /// <summary>
  146. /// Logs off a user on the user server
  147. /// </summary>
  148. /// <param name="UserID">UUID of the user</param>
  149. /// <param name="regionData">UUID of the Region</param>
  150. /// <param name="posx">final position x</param>
  151. /// <param name="posy">final position y</param>
  152. /// <param name="posz">final position z</param>
  153. public void LogOffUser(LLUUID userid, LLUUID regionid, ulong regionhandle, float posx, float posy, float posz)
  154. {
  155. Hashtable param = new Hashtable();
  156. param["avatar_uuid"] = userid.UUID.ToString();
  157. param["region_uuid"] = regionid.UUID.ToString();
  158. param["region_handle"] = regionhandle.ToString();
  159. param["region_pos_x"] = posx.ToString();
  160. param["region_pos_y"] = posy.ToString();
  161. param["region_pos_z"] = posz.ToString();
  162. IList parameters = new ArrayList();
  163. parameters.Add(param);
  164. XmlRpcRequest req = new XmlRpcRequest("logout_of_simulator", parameters);
  165. try
  166. {
  167. XmlRpcResponse resp = req.Send(m_parent.NetworkServersInfo.UserURL, 3000);
  168. }
  169. catch (WebException)
  170. {
  171. m_log.Warn("[LOGOFF]: Unable to notify grid server of user logoff");
  172. }
  173. }
  174. public UserProfileData GetUserProfile(string firstName, string lastName)
  175. {
  176. return GetUserProfile(firstName + " " + lastName);
  177. }
  178. public List<AvatarPickerAvatar> GenerateAgentPickerRequestResponse(LLUUID queryID, string query)
  179. {
  180. List<AvatarPickerAvatar> pickerlist = new List<AvatarPickerAvatar>();
  181. Regex objAlphaNumericPattern = new Regex("[^a-zA-Z0-9 ]");
  182. try
  183. {
  184. Hashtable param = new Hashtable();
  185. param["queryid"] = (string) queryID.ToString();
  186. param["avquery"] = objAlphaNumericPattern.Replace(query, String.Empty);
  187. IList parameters = new ArrayList();
  188. parameters.Add(param);
  189. XmlRpcRequest req = new XmlRpcRequest("get_avatar_picker_avatar", parameters);
  190. XmlRpcResponse resp = req.Send(m_parent.NetworkServersInfo.UserURL, 3000);
  191. Hashtable respData = (Hashtable) resp.Value;
  192. pickerlist = ConvertXMLRPCDataToAvatarPickerList(queryID, respData);
  193. }
  194. catch (WebException e)
  195. {
  196. m_log.Warn("[OGS1 USER SERVICES]: Error when trying to fetch Avatar Picker Response: " +
  197. e.Message);
  198. // Return Empty picker list (no results)
  199. }
  200. return pickerlist;
  201. }
  202. /// <summary>
  203. /// Get a user profile from the user server
  204. /// </summary>
  205. /// <param name="avatarID"></param>
  206. /// <returns>null if the request fails</returns>
  207. public UserProfileData GetUserProfile(string name)
  208. {
  209. try
  210. {
  211. Hashtable param = new Hashtable();
  212. param["avatar_name"] = name;
  213. IList parameters = new ArrayList();
  214. parameters.Add(param);
  215. XmlRpcRequest req = new XmlRpcRequest("get_user_by_name", parameters);
  216. XmlRpcResponse resp = req.Send(m_parent.NetworkServersInfo.UserURL, 6000);
  217. Hashtable respData = (Hashtable) resp.Value;
  218. return ConvertXMLRPCDataToUserProfile(respData);
  219. }
  220. catch (WebException e)
  221. {
  222. m_log.ErrorFormat(
  223. "[OGS1 USER SERVICES]: Error when trying to fetch profile data by name from remote user server: {0}",
  224. e);
  225. }
  226. return null;
  227. }
  228. /// <summary>
  229. /// Get a user profile from the user server
  230. /// </summary>
  231. /// <param name="avatarID"></param>
  232. /// <returns>null if the request fails</returns>
  233. public UserProfileData GetUserProfile(LLUUID avatarID)
  234. {
  235. try
  236. {
  237. Hashtable param = new Hashtable();
  238. param["avatar_uuid"] = avatarID.ToString();
  239. IList parameters = new ArrayList();
  240. parameters.Add(param);
  241. XmlRpcRequest req = new XmlRpcRequest("get_user_by_uuid", parameters);
  242. XmlRpcResponse resp = req.Send(m_parent.NetworkServersInfo.UserURL, 6000);
  243. Hashtable respData = (Hashtable) resp.Value;
  244. return ConvertXMLRPCDataToUserProfile(respData);
  245. }
  246. catch (Exception e)
  247. {
  248. m_log.ErrorFormat(
  249. "[OGS1 USER SERVICES]: Error when trying to fetch profile data by uuid from remote user server: {0}",
  250. e);
  251. }
  252. return null;
  253. }
  254. public void clearUserAgent(LLUUID avatarID)
  255. {
  256. // TODO: implement
  257. }
  258. /// <summary>
  259. /// Retrieve the user information for the given master uuid.
  260. /// </summary>
  261. /// <param name="uuid"></param>
  262. /// <returns></returns>
  263. public UserProfileData SetupMasterUser(string firstName, string lastName)
  264. {
  265. return SetupMasterUser(firstName, lastName, String.Empty);
  266. }
  267. /// <summary>
  268. /// Retrieve the user information for the given master uuid.
  269. /// </summary>
  270. /// <param name="uuid"></param>
  271. /// <returns></returns>
  272. public UserProfileData SetupMasterUser(string firstName, string lastName, string password)
  273. {
  274. UserProfileData profile = GetUserProfile(firstName, lastName);
  275. return profile;
  276. }
  277. /// <summary>
  278. /// Retrieve the user information for the given master uuid.
  279. /// </summary>
  280. /// <param name="uuid"></param>
  281. /// <returns></returns>
  282. public UserProfileData SetupMasterUser(LLUUID uuid)
  283. {
  284. UserProfileData data = GetUserProfile(uuid);
  285. if (data == null)
  286. {
  287. throw new Exception(
  288. "Could not retrieve profile for master user " + uuid + ". User server did not respond to the request.");
  289. }
  290. return data;
  291. }
  292. public LLUUID AddUserProfile(string firstName, string lastName, string pass, uint regX, uint regY)
  293. {
  294. throw new Exception("The method or operation is not implemented.");
  295. }
  296. public bool UpdateUserProfileProperties(UserProfileData UserProfile)
  297. {
  298. m_log.Debug("[OGS1 USER SERVICES]: Asking UserServer to update profile.");
  299. Hashtable param = new Hashtable();
  300. param["avatar_uuid"] = UserProfile.ID.ToString();
  301. //param["AllowPublish"] = UserProfile.ToString();
  302. param["FLImageID"] = UserProfile.FirstLifeImage.ToString();
  303. param["ImageID"] = UserProfile.Image.ToString();
  304. //param["MaturePublish"] = MaturePublish.ToString();
  305. param["AboutText"] = UserProfile.AboutText;
  306. param["FLAboutText"] = UserProfile.FirstLifeAboutText;
  307. //param["ProfileURL"] = UserProfile.ProfileURL.ToString();
  308. param["home_region"] = UserProfile.HomeRegion.ToString();
  309. param["home_pos_x"] = UserProfile.HomeLocationX.ToString();
  310. param["home_pos_y"] = UserProfile.HomeLocationY.ToString();
  311. param["home_pos_z"] = UserProfile.HomeLocationZ.ToString();
  312. param["home_look_x"] = UserProfile.HomeLookAtX.ToString();
  313. param["home_look_y"] = UserProfile.HomeLookAtY.ToString();
  314. param["home_look_z"] = UserProfile.HomeLookAtZ.ToString();
  315. IList parameters = new ArrayList();
  316. parameters.Add(param);
  317. XmlRpcRequest req = new XmlRpcRequest("update_user_profile", parameters);
  318. XmlRpcResponse resp = req.Send(m_parent.NetworkServersInfo.UserURL, 3000);
  319. Hashtable respData = (Hashtable)resp.Value;
  320. if (respData != null)
  321. {
  322. if (respData.Contains("returnString"))
  323. {
  324. if (((string)respData["returnString"]).ToUpper() != "TRUE")
  325. {
  326. m_log.Warn("[GRID]: Unable to update user profile, User Server Reported an issue");
  327. return false;
  328. }
  329. }
  330. else
  331. {
  332. m_log.Warn("[GRID]: Unable to update user profile, UserServer didn't understand me!");
  333. return false;
  334. }
  335. }
  336. else
  337. {
  338. m_log.Warn("[GRID]: Unable to update user profile, UserServer didn't understand me!");
  339. return false;
  340. }
  341. return true;
  342. }
  343. #region IUserServices Friend Methods
  344. /// <summary>
  345. /// Adds a new friend to the database for XUser
  346. /// </summary>
  347. /// <param name="friendlistowner">The agent that who's friends list is being added to</param>
  348. /// <param name="friend">The agent that being added to the friends list of the friends list owner</param>
  349. /// <param name="perms">A uint bit vector for set perms that the friend being added has; 0 = none, 1=This friend can see when they sign on, 2 = map, 4 edit objects </param>
  350. public void AddNewUserFriend(LLUUID friendlistowner, LLUUID friend, uint perms)
  351. {
  352. try
  353. {
  354. Hashtable param = new Hashtable();
  355. param["ownerID"] = friendlistowner.UUID.ToString();
  356. param["friendID"] = friend.UUID.ToString();
  357. param["friendPerms"] = perms.ToString();
  358. IList parameters = new ArrayList();
  359. parameters.Add(param);
  360. XmlRpcRequest req = new XmlRpcRequest("add_new_user_friend", parameters);
  361. XmlRpcResponse resp = req.Send(m_parent.NetworkServersInfo.UserURL, 3000);
  362. Hashtable respData = (Hashtable)resp.Value;
  363. if (respData != null)
  364. {
  365. if (respData.Contains("returnString"))
  366. {
  367. if ((string)respData["returnString"] == "TRUE")
  368. {
  369. }
  370. else
  371. {
  372. m_log.Warn("[GRID]: Unable to add new friend, User Server Reported an issue");
  373. }
  374. }
  375. else
  376. {
  377. m_log.Warn("[GRID]: Unable to add new friend, UserServer didn't understand me!");
  378. }
  379. }
  380. else
  381. {
  382. m_log.Warn("[GRID]: Unable to add new friend, UserServer didn't understand me!");
  383. }
  384. }
  385. catch (WebException e)
  386. {
  387. m_log.Warn("[GRID]: Error when trying to AddNewUserFriend: " +
  388. e.Message);
  389. }
  390. }
  391. /// <summary>
  392. /// Delete friend on friendlistowner's friendlist.
  393. /// </summary>
  394. /// <param name="friendlistowner">The agent that who's friends list is being updated</param>
  395. /// <param name="friend">The Ex-friend agent</param>
  396. public void RemoveUserFriend(LLUUID friendlistowner, LLUUID friend)
  397. {
  398. try
  399. {
  400. Hashtable param = new Hashtable();
  401. param["ownerID"] = friendlistowner.UUID.ToString();
  402. param["friendID"] = friend.UUID.ToString();
  403. IList parameters = new ArrayList();
  404. parameters.Add(param);
  405. XmlRpcRequest req = new XmlRpcRequest("remove_user_friend", parameters);
  406. XmlRpcResponse resp = req.Send(m_parent.NetworkServersInfo.UserURL, 3000);
  407. Hashtable respData = (Hashtable)resp.Value;
  408. if (respData != null)
  409. {
  410. if (respData.Contains("returnString"))
  411. {
  412. if ((string)respData["returnString"] == "TRUE")
  413. {
  414. }
  415. else
  416. {
  417. m_log.Warn("[GRID]: Unable to remove friend, User Server Reported an issue");
  418. }
  419. }
  420. else
  421. {
  422. m_log.Warn("[GRID]: Unable to remove friend, UserServer didn't understand me!");
  423. }
  424. }
  425. else
  426. {
  427. m_log.Warn("[GRID]: Unable to remove friend, UserServer didn't understand me!");
  428. }
  429. }
  430. catch (WebException e)
  431. {
  432. m_log.Warn("[GRID]: Error when trying to RemoveUserFriend: " +
  433. e.Message);
  434. }
  435. }
  436. /// <summary>
  437. /// Update permissions for friend on friendlistowner's friendlist.
  438. /// </summary>
  439. /// <param name="friendlistowner">The agent that who's friends list is being updated</param>
  440. /// <param name="friend">The agent that is getting or loosing permissions</param>
  441. /// <param name="perms">A uint bit vector for set perms that the friend being added has; 0 = none, 1=This friend can see when they sign on, 2 = map, 4 edit objects </param>
  442. public void UpdateUserFriendPerms(LLUUID friendlistowner, LLUUID friend, uint perms)
  443. {
  444. try
  445. {
  446. Hashtable param = new Hashtable();
  447. param["ownerID"] = friendlistowner.UUID.ToString();
  448. param["friendID"] = friend.UUID.ToString();
  449. param["friendPerms"] = perms.ToString();
  450. IList parameters = new ArrayList();
  451. parameters.Add(param);
  452. XmlRpcRequest req = new XmlRpcRequest("update_user_friend_perms", parameters);
  453. XmlRpcResponse resp = req.Send(m_parent.NetworkServersInfo.UserURL, 3000);
  454. Hashtable respData = (Hashtable)resp.Value;
  455. if (respData != null)
  456. {
  457. if (respData.Contains("returnString"))
  458. {
  459. if ((string)respData["returnString"] == "TRUE")
  460. {
  461. }
  462. else
  463. {
  464. m_log.Warn("[GRID]: Unable to update_user_friend_perms, User Server Reported an issue");
  465. }
  466. }
  467. else
  468. {
  469. m_log.Warn("[GRID]: Unable to update_user_friend_perms, UserServer didn't understand me!");
  470. }
  471. }
  472. else
  473. {
  474. m_log.Warn("[GRID]: Unable to update_user_friend_perms, UserServer didn't understand me!");
  475. }
  476. }
  477. catch (WebException e)
  478. {
  479. m_log.Warn("[GRID]: Error when trying to update_user_friend_perms: " +
  480. e.Message);
  481. }
  482. }
  483. /// <summary>
  484. /// Returns a list of FriendsListItems that describe the friends and permissions in the friend relationship for LLUUID friendslistowner
  485. /// </summary>
  486. /// <param name="friendlistowner">The agent that we're retreiving the friends Data.</param>
  487. public List<FriendListItem> GetUserFriendList(LLUUID friendlistowner)
  488. {
  489. List<FriendListItem> buddylist = new List<FriendListItem>();
  490. try
  491. {
  492. Hashtable param = new Hashtable();
  493. param["ownerID"] = friendlistowner.UUID.ToString();
  494. IList parameters = new ArrayList();
  495. parameters.Add(param);
  496. XmlRpcRequest req = new XmlRpcRequest("get_user_friend_list", parameters);
  497. XmlRpcResponse resp = req.Send(m_parent.NetworkServersInfo.UserURL, 8000);
  498. Hashtable respData = (Hashtable) resp.Value;
  499. if (respData.Contains("avcount"))
  500. {
  501. buddylist = ConvertXMLRPCDataToFriendListItemList(respData);
  502. }
  503. }
  504. catch (WebException e)
  505. {
  506. m_log.Warn("[OGS1 USER SERVICES]: Error when trying to fetch Avatar's friends list: " +
  507. e.Message);
  508. // Return Empty list (no friends)
  509. }
  510. return buddylist;
  511. }
  512. #endregion
  513. /// Appearance
  514. /// TODO: stubs for now to get us to a compiling state gently
  515. public AvatarAppearance GetUserAppearance(LLUUID user)
  516. {
  517. AvatarAppearance appearance = null;
  518. try
  519. {
  520. Hashtable param = new Hashtable();
  521. param["owner"] = user.ToString();
  522. IList parameters = new ArrayList();
  523. parameters.Add(param);
  524. XmlRpcRequest req = new XmlRpcRequest("get_avatar_appearance", parameters);
  525. XmlRpcResponse resp = req.Send(m_parent.NetworkServersInfo.UserURL, 8000);
  526. Hashtable respData = (Hashtable) resp.Value;
  527. return ConvertXMLRPCDataToAvatarAppearance(respData);
  528. }
  529. catch (WebException e)
  530. {
  531. m_log.Warn("[OGS1 USER SERVICES]: Error when trying to fetch Avatar's appearance: " +
  532. e.Message);
  533. // Return Empty list (no friends)
  534. }
  535. return appearance;
  536. }
  537. public void UpdateUserAppearance(LLUUID user, AvatarAppearance appearance)
  538. {
  539. try
  540. {
  541. Hashtable param = appearance.ToHashTable();
  542. param["owner"] = user.ToString();
  543. IList parameters = new ArrayList();
  544. parameters.Add(param);
  545. XmlRpcRequest req = new XmlRpcRequest("update_avatar_appearance", parameters);
  546. XmlRpcResponse resp = req.Send(m_parent.NetworkServersInfo.UserURL, 8000);
  547. Hashtable respData = (Hashtable) resp.Value;
  548. if (respData != null)
  549. {
  550. if (respData.Contains("returnString"))
  551. {
  552. if ((string)respData["returnString"] == "TRUE")
  553. {
  554. }
  555. else
  556. {
  557. m_log.Warn("[GRID]: Unable to update_user_appearance, User Server Reported an issue");
  558. }
  559. }
  560. else
  561. {
  562. m_log.Warn("[GRID]: Unable to update_user_appearance, UserServer didn't understand me!");
  563. }
  564. }
  565. else
  566. {
  567. m_log.Warn("[GRID]: Unable to update_user_appearance, UserServer didn't understand me!");
  568. }
  569. }
  570. catch (WebException e)
  571. {
  572. m_log.Warn("[OGS1 USER SERVICES]: Error when trying to update Avatar's appearance: " +
  573. e.Message);
  574. // Return Empty list (no friends)
  575. }
  576. }
  577. public void AddAttachment(LLUUID user, LLUUID item)
  578. {
  579. return;
  580. }
  581. public void RemoveAttachment(LLUUID user, LLUUID item)
  582. {
  583. return;
  584. }
  585. public List<LLUUID> GetAttachments(LLUUID user)
  586. {
  587. return new List<LLUUID>();
  588. }
  589. }
  590. }