LoginResponse.cs 27 KB

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