LoginResponse.cs 28 KB

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