LoginResponse.cs 27 KB

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