LoginResponse.cs 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767
  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 libsecondlife;
  31. using libsecondlife.StructuredData;
  32. using Nwc.XmlRpc;
  33. using OpenSim.Framework.Console;
  34. namespace OpenSim.Framework.UserManagement
  35. {
  36. /// <summary>
  37. /// A temp class to handle login response.
  38. /// Should make use of UserProfileManager where possible.
  39. /// </summary>
  40. public class LoginResponse
  41. {
  42. private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
  43. private Hashtable loginFlagsHash;
  44. private Hashtable globalTexturesHash;
  45. private Hashtable loginError;
  46. private Hashtable uiConfigHash;
  47. private ArrayList loginFlags;
  48. private ArrayList globalTextures;
  49. private ArrayList eventCategories;
  50. private ArrayList uiConfig;
  51. private ArrayList classifiedCategories;
  52. private ArrayList inventoryRoot;
  53. private ArrayList initialOutfit;
  54. private ArrayList agentInventory;
  55. private ArrayList inventoryLibraryOwner;
  56. private ArrayList inventoryLibRoot;
  57. private ArrayList inventoryLibrary;
  58. private UserInfo userProfile;
  59. private LLUUID agentID;
  60. private LLUUID sessionID;
  61. private LLUUID secureSessionID;
  62. // Login Flags
  63. private string dst;
  64. private string stipendSinceLogin;
  65. private string gendered;
  66. private string everLoggedIn;
  67. private string login;
  68. private uint simPort;
  69. private string simAddress;
  70. private string agentAccess;
  71. private Int32 circuitCode;
  72. private uint regionX;
  73. private uint regionY;
  74. // Login
  75. private string firstname;
  76. private string lastname;
  77. // Global Textures
  78. private string sunTexture;
  79. private string cloudTexture;
  80. private string moonTexture;
  81. // Error Flags
  82. private string errorReason;
  83. private string errorMessage;
  84. // Response
  85. private XmlRpcResponse xmlRpcResponse;
  86. private XmlRpcResponse defaultXmlRpcResponse;
  87. private string welcomeMessage;
  88. private string startLocation;
  89. private string allowFirstLife;
  90. private string home;
  91. private string seedCapability;
  92. private string lookAt;
  93. private BuddyList m_buddyList = null;
  94. public LoginResponse()
  95. {
  96. loginFlags = new ArrayList();
  97. globalTextures = new ArrayList();
  98. eventCategories = new ArrayList();
  99. uiConfig = new ArrayList();
  100. classifiedCategories = new ArrayList();
  101. loginError = new Hashtable();
  102. uiConfigHash = new Hashtable();
  103. defaultXmlRpcResponse = new XmlRpcResponse();
  104. userProfile = new UserInfo();
  105. inventoryRoot = new ArrayList();
  106. initialOutfit = new ArrayList();
  107. agentInventory = new ArrayList();
  108. inventoryLibrary = new ArrayList();
  109. inventoryLibraryOwner = new ArrayList();
  110. xmlRpcResponse = new XmlRpcResponse();
  111. defaultXmlRpcResponse = new XmlRpcResponse();
  112. SetDefaultValues();
  113. }
  114. public void SetDefaultValues()
  115. {
  116. DST = "N";
  117. StipendSinceLogin = "N";
  118. Gendered = "Y";
  119. EverLoggedIn = "Y";
  120. login = "false";
  121. firstname = "Test";
  122. lastname = "User";
  123. agentAccess = "M";
  124. startLocation = "last";
  125. allowFirstLife = "Y";
  126. SunTexture = "cce0f112-878f-4586-a2e2-a8f104bba271";
  127. CloudTexture = "dc4b9f0b-d008-45c6-96a4-01dd947ac621";
  128. MoonTexture = "ec4b9f0b-d008-45c6-96a4-01dd947ac621";
  129. ErrorMessage = "You have entered an invalid name/password combination. Check Caps/lock.";
  130. ErrorReason = "key";
  131. welcomeMessage = "Welcome to OpenSim!";
  132. seedCapability = String.Empty;
  133. home = "{'region_handle':[r" + (1000*Constants.RegionSize).ToString() + ",r" + (1000*Constants.RegionSize).ToString() + "], 'position':[r" +
  134. userProfile.homepos.X.ToString() + ",r" + userProfile.homepos.Y.ToString() + ",r" +
  135. userProfile.homepos.Z.ToString() + "], 'look_at':[r" + userProfile.homelookat.X.ToString() + ",r" +
  136. userProfile.homelookat.Y.ToString() + ",r" + userProfile.homelookat.Z.ToString() + "]}";
  137. lookAt = "[r0.99949799999999999756,r0.03166859999999999814,r0]";
  138. RegionX = (uint) 255232;
  139. RegionY = (uint) 254976;
  140. // Classifieds;
  141. AddClassifiedCategory((Int32) 1, "Shopping");
  142. AddClassifiedCategory((Int32) 2, "Land Rental");
  143. AddClassifiedCategory((Int32) 3, "Property Rental");
  144. AddClassifiedCategory((Int32) 4, "Special Attraction");
  145. AddClassifiedCategory((Int32) 5, "New Products");
  146. AddClassifiedCategory((Int32) 6, "Employment");
  147. AddClassifiedCategory((Int32) 7, "Wanted");
  148. AddClassifiedCategory((Int32) 8, "Service");
  149. AddClassifiedCategory((Int32) 9, "Personal");
  150. SessionID = LLUUID.Random();
  151. SecureSessionID = LLUUID.Random();
  152. AgentID = LLUUID.Random();
  153. Hashtable InitialOutfitHash = new Hashtable();
  154. InitialOutfitHash["folder_name"] = "Nightclub Female";
  155. InitialOutfitHash["gender"] = "female";
  156. initialOutfit.Add(InitialOutfitHash);
  157. }
  158. #region Login Failure Methods
  159. public XmlRpcResponse GenerateFailureResponse(string reason, string message, string login)
  160. {
  161. // Overwrite any default values;
  162. xmlRpcResponse = new XmlRpcResponse();
  163. // Ensure Login Failed message/reason;
  164. ErrorMessage = message;
  165. ErrorReason = reason;
  166. loginError["reason"] = ErrorReason;
  167. loginError["message"] = ErrorMessage;
  168. loginError["login"] = login;
  169. xmlRpcResponse.Value = loginError;
  170. return (xmlRpcResponse);
  171. }
  172. public LLSD GenerateFailureResponseLLSD(string reason, string message, string login)
  173. {
  174. LLSDMap map = new LLSDMap();
  175. // Ensure Login Failed message/reason;
  176. ErrorMessage = message;
  177. ErrorReason = reason;
  178. map["reason"] = LLSD.FromString(ErrorReason);
  179. map["message"] = LLSD.FromString(ErrorMessage);
  180. map["login"] = LLSD.FromString(login);
  181. return map;
  182. }
  183. public XmlRpcResponse CreateFailedResponse()
  184. {
  185. return (CreateLoginFailedResponse());
  186. }
  187. public LLSD CreateFailedResponseLLSD()
  188. {
  189. return CreateLoginFailedResponseLLSD();
  190. }
  191. public XmlRpcResponse CreateLoginFailedResponse()
  192. {
  193. return
  194. (GenerateFailureResponse("key",
  195. "Could not authenticate your avatar. Please check your username and password, and check the grid if problems persist.",
  196. "false"));
  197. }
  198. public LLSD CreateLoginFailedResponseLLSD()
  199. {
  200. return GenerateFailureResponseLLSD(
  201. "key",
  202. "Could not authenticate your avatar. Please check your username and password, and check the grid if problems persist.",
  203. "false");
  204. }
  205. public XmlRpcResponse CreateAlreadyLoggedInResponse()
  206. {
  207. return
  208. (GenerateFailureResponse("presence",
  209. "You appear to be already logged in. " +
  210. "If this is not the case please wait for your session to timeout. " +
  211. "If this takes longer than a few minutes please contact the grid owner. " +
  212. "Please wait 5 minutes if you are going to connect to a region nearby to the region you were at previously.",
  213. "false"));
  214. }
  215. public LLSD CreateAlreadyLoggedInResponseLLSD()
  216. {
  217. return GenerateFailureResponseLLSD(
  218. "presence",
  219. "You appear to be already logged in. " +
  220. "If this is not the case please wait for your session to timeout. " +
  221. "If this takes longer than a few minutes please contact the grid owner",
  222. "false");
  223. }
  224. public XmlRpcResponse CreateDeadRegionResponse()
  225. {
  226. return
  227. (GenerateFailureResponse("key",
  228. "The region you are attempting to log into is not responding. Please select another region and try again.",
  229. "false"));
  230. }
  231. public LLSD CreateDeadRegionResponseLLSD()
  232. {
  233. return GenerateFailureResponseLLSD(
  234. "key",
  235. "The region you are attempting to log into is not responding. Please select another region and try again.",
  236. "false");
  237. }
  238. public XmlRpcResponse CreateGridErrorResponse()
  239. {
  240. return
  241. (GenerateFailureResponse("key",
  242. "Error connecting to grid. Could not percieve credentials from login XML.",
  243. "false"));
  244. }
  245. public LLSD CreateGridErrorResponseLLSD()
  246. {
  247. return GenerateFailureResponseLLSD(
  248. "key",
  249. "Error connecting to grid. Could not percieve credentials from login XML.",
  250. "false");
  251. }
  252. #endregion
  253. public XmlRpcResponse ToXmlRpcResponse()
  254. {
  255. try
  256. {
  257. Hashtable responseData = new Hashtable();
  258. loginFlagsHash = new Hashtable();
  259. loginFlagsHash["daylight_savings"] = DST;
  260. loginFlagsHash["stipend_since_login"] = StipendSinceLogin;
  261. loginFlagsHash["gendered"] = Gendered;
  262. loginFlagsHash["ever_logged_in"] = EverLoggedIn;
  263. loginFlags.Add(loginFlagsHash);
  264. responseData["first_name"] = Firstname;
  265. responseData["last_name"] = Lastname;
  266. responseData["agent_access"] = agentAccess;
  267. globalTexturesHash = new Hashtable();
  268. globalTexturesHash["sun_texture_id"] = SunTexture;
  269. globalTexturesHash["cloud_texture_id"] = CloudTexture;
  270. globalTexturesHash["moon_texture_id"] = MoonTexture;
  271. globalTextures.Add(globalTexturesHash);
  272. // this.eventCategories.Add(this.eventCategoriesHash);
  273. AddToUIConfig("allow_first_life", allowFirstLife);
  274. uiConfig.Add(uiConfigHash);
  275. responseData["sim_port"] = (Int32) SimPort;
  276. responseData["sim_ip"] = SimAddress;
  277. responseData["agent_id"] = AgentID.ToString();
  278. responseData["session_id"] = SessionID.ToString();
  279. responseData["secure_session_id"] = SecureSessionID.ToString();
  280. responseData["circuit_code"] = CircuitCode;
  281. responseData["seconds_since_epoch"] = (Int32) (DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
  282. responseData["login-flags"] = loginFlags;
  283. responseData["global-textures"] = globalTextures;
  284. responseData["seed_capability"] = seedCapability;
  285. responseData["event_categories"] = eventCategories;
  286. responseData["event_notifications"] = new ArrayList(); // todo
  287. responseData["classified_categories"] = classifiedCategories;
  288. responseData["ui-config"] = uiConfig;
  289. responseData["inventory-skeleton"] = agentInventory;
  290. responseData["inventory-skel-lib"] = inventoryLibrary;
  291. responseData["inventory-root"] = inventoryRoot;
  292. responseData["inventory-lib-root"] = inventoryLibRoot;
  293. responseData["gestures"] = new ArrayList(); // todo
  294. responseData["inventory-lib-owner"] = inventoryLibraryOwner;
  295. responseData["initial-outfit"] = initialOutfit;
  296. responseData["start_location"] = startLocation;
  297. responseData["seed_capability"] = seedCapability;
  298. responseData["home"] = home;
  299. responseData["look_at"] = lookAt;
  300. responseData["message"] = welcomeMessage;
  301. responseData["region_x"] = (Int32)(RegionX * Constants.RegionSize);
  302. responseData["region_y"] = (Int32)(RegionY * Constants.RegionSize);
  303. //responseData["inventory-lib-root"] = new ArrayList(); // todo
  304. if (m_buddyList != null)
  305. {
  306. responseData["buddy-list"] = m_buddyList.ToArray();
  307. }
  308. responseData["login"] = "true";
  309. xmlRpcResponse.Value = responseData;
  310. return (xmlRpcResponse);
  311. }
  312. catch (Exception e)
  313. {
  314. m_log.Warn("[CLIENT]: LoginResponse: Error creating XML-RPC Response: " + e.Message);
  315. return (GenerateFailureResponse("Internal Error", "Error generating Login Response", "false"));
  316. }
  317. }
  318. public LLSD ToLLSDResponse()
  319. {
  320. try
  321. {
  322. LLSDMap map = new LLSDMap();
  323. map["first_name"] = LLSD.FromString(Firstname);
  324. map["last_name"] = LLSD.FromString(Lastname);
  325. map["agent_access"] = LLSD.FromString(agentAccess);
  326. map["sim_port"] = LLSD.FromInteger(SimPort);
  327. map["sim_ip"] = LLSD.FromString(SimAddress);
  328. map["agent_id"] = LLSD.FromUUID(AgentID);
  329. map["session_id"] = LLSD.FromUUID(SessionID);
  330. map["secure_session_id"] = LLSD.FromUUID(SecureSessionID);
  331. map["circuit_code"] = LLSD.FromInteger(CircuitCode);
  332. map["seconds_since_epoch"] = LLSD.FromInteger((int)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds);
  333. #region Login Flags
  334. LLSDMap loginFlagsLLSD = new LLSDMap();
  335. loginFlagsLLSD["daylight_savings"] = LLSD.FromString(DST);
  336. loginFlagsLLSD["stipend_since_login"] = LLSD.FromString(StipendSinceLogin);
  337. loginFlagsLLSD["gendered"] = LLSD.FromString(Gendered);
  338. loginFlagsLLSD["ever_logged_in"] = LLSD.FromString(EverLoggedIn);
  339. map["login-flags"] = WrapLLSDMap(loginFlagsLLSD);
  340. #endregion Login Flags
  341. #region Global Textures
  342. LLSDMap globalTexturesLLSD = new LLSDMap();
  343. globalTexturesLLSD["sun_texture_id"] = LLSD.FromString(SunTexture);
  344. globalTexturesLLSD["cloud_texture_id"] = LLSD.FromString(CloudTexture);
  345. globalTexturesLLSD["moon_texture_id"] = LLSD.FromString(MoonTexture);
  346. map["global-textures"] = WrapLLSDMap(globalTexturesLLSD);
  347. #endregion Global Textures
  348. map["seed_capability"] = LLSD.FromString(seedCapability);
  349. map["event_categories"] = ArrayListToLLSDArray(eventCategories);
  350. //map["event_notifications"] = new LLSDArray(); // todo
  351. map["classified_categories"] = ArrayListToLLSDArray(classifiedCategories);
  352. #region UI Config
  353. LLSDMap uiConfigLLSD = new LLSDMap();
  354. uiConfigLLSD["allow_first_life"] = LLSD.FromString(allowFirstLife);
  355. map["ui-config"] = WrapLLSDMap(uiConfigLLSD);
  356. #endregion UI Config
  357. #region Inventory
  358. map["inventory-skeleton"] = ArrayListToLLSDArray(agentInventory);
  359. map["inventory-skel-lib"] = ArrayListToLLSDArray(inventoryLibrary);
  360. map["inventory-root"] = ArrayListToLLSDArray(inventoryRoot); ;
  361. map["inventory-lib-root"] = ArrayListToLLSDArray(inventoryLibRoot);
  362. map["inventory-lib-owner"] = ArrayListToLLSDArray(inventoryLibraryOwner);
  363. #endregion Inventory
  364. map["gestures"] = new LLSDArray(); // todo
  365. map["initial-outfit"] = ArrayListToLLSDArray(initialOutfit);
  366. map["start_location"] = LLSD.FromString(startLocation);
  367. map["seed_capability"] = LLSD.FromString(seedCapability);
  368. map["home"] = LLSD.FromString(home);
  369. map["look_at"] = LLSD.FromString(lookAt);
  370. map["message"] = LLSD.FromString(welcomeMessage);
  371. map["region_x"] = LLSD.FromInteger(RegionX * Constants.RegionSize);
  372. map["region_y"] = LLSD.FromInteger(RegionY * Constants.RegionSize);
  373. if (m_buddyList != null)
  374. {
  375. map["buddy-list"] = ArrayListToLLSDArray(m_buddyList.ToArray());
  376. }
  377. map["login"] = LLSD.FromString("true");
  378. return map;
  379. }
  380. catch (Exception e)
  381. {
  382. m_log.Warn("[CLIENT]: LoginResponse: Error creating XML-RPC Response: " + e.Message);
  383. return GenerateFailureResponseLLSD("Internal Error", "Error generating Login Response", "false");
  384. }
  385. }
  386. public LLSDArray ArrayListToLLSDArray(ArrayList arrlst)
  387. {
  388. LLSDArray llsdBack = new LLSDArray();
  389. foreach (Hashtable ht in arrlst)
  390. {
  391. LLSDMap mp = new LLSDMap();
  392. foreach (DictionaryEntry deHt in ht)
  393. {
  394. mp.Add((string)deHt.Key, LLSDString.FromObject(deHt.Value));
  395. }
  396. llsdBack.Add(mp);
  397. }
  398. return llsdBack;
  399. }
  400. private LLSDArray WrapLLSDMap(LLSDMap wrapMe)
  401. {
  402. LLSDArray array = new LLSDArray();
  403. array.Add(wrapMe);
  404. return array;
  405. }
  406. public void SetEventCategories(string category, string value)
  407. {
  408. // this.eventCategoriesHash[category] = value;
  409. //TODO
  410. }
  411. public void AddToUIConfig(string itemName, string item)
  412. {
  413. uiConfigHash[itemName] = item;
  414. }
  415. public void AddClassifiedCategory(Int32 ID, string categoryName)
  416. {
  417. Hashtable hash = new Hashtable();
  418. hash["category_name"] = categoryName;
  419. hash["category_id"] = ID;
  420. classifiedCategories.Add(hash);
  421. // this.classifiedCategoriesHash.Clear();
  422. }
  423. #region Properties
  424. public string Login
  425. {
  426. get { return login; }
  427. set { login = value; }
  428. }
  429. public string DST
  430. {
  431. get { return dst; }
  432. set { dst = value; }
  433. }
  434. public string StipendSinceLogin
  435. {
  436. get { return stipendSinceLogin; }
  437. set { stipendSinceLogin = value; }
  438. }
  439. public string Gendered
  440. {
  441. get { return gendered; }
  442. set { gendered = value; }
  443. }
  444. public string EverLoggedIn
  445. {
  446. get { return everLoggedIn; }
  447. set { everLoggedIn = value; }
  448. }
  449. public uint SimPort
  450. {
  451. get { return simPort; }
  452. set { simPort = value; }
  453. }
  454. public string SimAddress
  455. {
  456. get { return simAddress; }
  457. set { simAddress = value; }
  458. }
  459. public LLUUID AgentID
  460. {
  461. get { return agentID; }
  462. set { agentID = value; }
  463. }
  464. public LLUUID SessionID
  465. {
  466. get { return sessionID; }
  467. set { sessionID = value; }
  468. }
  469. public LLUUID SecureSessionID
  470. {
  471. get { return secureSessionID; }
  472. set { secureSessionID = value; }
  473. }
  474. public Int32 CircuitCode
  475. {
  476. get { return circuitCode; }
  477. set { circuitCode = value; }
  478. }
  479. public uint RegionX
  480. {
  481. get { return regionX; }
  482. set { regionX = value; }
  483. }
  484. public uint RegionY
  485. {
  486. get { return regionY; }
  487. set { regionY = value; }
  488. }
  489. public string SunTexture
  490. {
  491. get { return sunTexture; }
  492. set { sunTexture = value; }
  493. }
  494. public string CloudTexture
  495. {
  496. get { return cloudTexture; }
  497. set { cloudTexture = value; }
  498. }
  499. public string MoonTexture
  500. {
  501. get { return moonTexture; }
  502. set { moonTexture = value; }
  503. }
  504. public string Firstname
  505. {
  506. get { return firstname; }
  507. set { firstname = value; }
  508. }
  509. public string Lastname
  510. {
  511. get { return lastname; }
  512. set { lastname = value; }
  513. }
  514. public string AgentAccess
  515. {
  516. get { return agentAccess; }
  517. set { agentAccess = value; }
  518. }
  519. public string StartLocation
  520. {
  521. get { return startLocation; }
  522. set { startLocation = value; }
  523. }
  524. public string LookAt
  525. {
  526. get { return lookAt; }
  527. set { lookAt = value; }
  528. }
  529. public string SeedCapability
  530. {
  531. get { return seedCapability; }
  532. set { seedCapability = value; }
  533. }
  534. public string ErrorReason
  535. {
  536. get { return errorReason; }
  537. set { errorReason = value; }
  538. }
  539. public string ErrorMessage
  540. {
  541. get { return errorMessage; }
  542. set { errorMessage = value; }
  543. }
  544. public ArrayList InventoryRoot
  545. {
  546. get { return inventoryRoot; }
  547. set { inventoryRoot = value; }
  548. }
  549. public ArrayList InventorySkeleton
  550. {
  551. get { return agentInventory; }
  552. set { agentInventory = value; }
  553. }
  554. public ArrayList InventoryLibrary
  555. {
  556. get { return inventoryLibrary; }
  557. set { inventoryLibrary = value; }
  558. }
  559. public ArrayList InventoryLibraryOwner
  560. {
  561. get { return inventoryLibraryOwner; }
  562. set { inventoryLibraryOwner = value; }
  563. }
  564. public ArrayList InventoryLibRoot
  565. {
  566. get { return inventoryLibRoot; }
  567. set { inventoryLibRoot = value; }
  568. }
  569. public string Home
  570. {
  571. get { return home; }
  572. set { home = value; }
  573. }
  574. public string Message
  575. {
  576. get { return welcomeMessage; }
  577. set { welcomeMessage = value; }
  578. }
  579. public BuddyList BuddList
  580. {
  581. get { return m_buddyList; }
  582. set { m_buddyList = value; }
  583. }
  584. #endregion
  585. public class UserInfo
  586. {
  587. public string firstname;
  588. public string lastname;
  589. public ulong homeregionhandle;
  590. public LLVector3 homepos;
  591. public LLVector3 homelookat;
  592. }
  593. public class BuddyList
  594. {
  595. public List<BuddyInfo> Buddies = new List<BuddyInfo>();
  596. public void AddNewBuddy(BuddyInfo buddy)
  597. {
  598. if (!Buddies.Contains(buddy))
  599. {
  600. Buddies.Add(buddy);
  601. }
  602. }
  603. public ArrayList ToArray()
  604. {
  605. ArrayList buddyArray = new ArrayList();
  606. foreach (BuddyInfo buddy in Buddies)
  607. {
  608. buddyArray.Add(buddy.ToHashTable());
  609. }
  610. return buddyArray;
  611. }
  612. public class BuddyInfo
  613. {
  614. public int BuddyRightsHave = 1;
  615. public int BuddyRightsGiven = 1;
  616. public LLUUID BuddyID;
  617. public BuddyInfo(string buddyID)
  618. {
  619. BuddyID = new LLUUID(buddyID);
  620. }
  621. public BuddyInfo(LLUUID buddyID)
  622. {
  623. BuddyID = buddyID;
  624. }
  625. public Hashtable ToHashTable()
  626. {
  627. Hashtable hTable = new Hashtable();
  628. hTable["buddy_rights_has"] = BuddyRightsHave;
  629. hTable["buddy_rights_given"] = BuddyRightsGiven;
  630. hTable["buddy_id"] = BuddyID.ToString();
  631. return hTable;
  632. }
  633. }
  634. }
  635. }
  636. }