UserProfileData.cs 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401
  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 OpenMetaverse;
  29. namespace OpenSim.Framework
  30. {
  31. /// <summary>
  32. /// Information about a particular user known to the userserver
  33. /// </summary>
  34. public class UserProfileData
  35. {
  36. /// <summary>
  37. /// A UNIX Timestamp (seconds since epoch) for the users creation
  38. /// </summary>
  39. private int m_created;
  40. /// <summary>
  41. /// The users last registered agent (filled in on the user server)
  42. /// </summary>
  43. private UserAgentData m_currentAgent;
  44. /// <summary>
  45. /// The first component of a users account name
  46. /// </summary>
  47. private string m_firstname;
  48. /// <summary>
  49. /// The coordinates inside the region of the home location
  50. /// </summary>
  51. private Vector3 m_homeLocation;
  52. /// <summary>
  53. /// Where the user will be looking when they rez.
  54. /// </summary>
  55. private Vector3 m_homeLookAt;
  56. private uint m_homeRegionX;
  57. private uint m_homeRegionY;
  58. /// <summary>
  59. /// The ID value for this user
  60. /// </summary>
  61. private UUID m_id;
  62. /// <summary>
  63. /// A UNIX Timestamp for the users last login date / time
  64. /// </summary>
  65. private int m_lastLogin;
  66. /// <summary>
  67. /// A salted hash containing the users password, in the format md5(md5(password) + ":" + salt)
  68. /// </summary>
  69. /// <remarks>This is double MD5'd because the client sends an unsalted MD5 to the loginserver</remarks>
  70. private string m_passwordHash;
  71. /// <summary>
  72. /// The salt used for the users hash, should be 32 bytes or longer
  73. /// </summary>
  74. private string m_passwordSalt;
  75. /// <summary>
  76. /// The about text listed in a users profile.
  77. /// </summary>
  78. private string m_profileAboutText = String.Empty;
  79. /// <summary>
  80. /// A uint mask containing the "I can do" fields of the users profile
  81. /// </summary>
  82. private uint m_profileCanDoMask;
  83. /// <summary>
  84. /// The profile image for the users first life tab
  85. /// </summary>
  86. private UUID m_profileFirstImage;
  87. /// <summary>
  88. /// The first life about text listed in a users profile
  89. /// </summary>
  90. private string m_profileFirstText = String.Empty;
  91. /// <summary>
  92. /// The profile image for an avatar stored on the asset server
  93. /// </summary>
  94. private UUID m_profileImage;
  95. /// <summary>
  96. /// A uint mask containing the "I want to do" part of the users profile
  97. /// </summary>
  98. private uint m_profileWantDoMask; // Profile window "I want to" mask
  99. /// <summary>
  100. /// The profile url for an avatar
  101. /// </summary>
  102. private string m_profileUrl;
  103. /// <summary>
  104. /// The second component of a users account name
  105. /// </summary>
  106. private string m_surname;
  107. /// <summary>
  108. /// A valid email address for the account. Useful for password reset requests.
  109. /// </summary>
  110. private string m_email = String.Empty;
  111. /// <summary>
  112. /// A URI to the users asset server, used for foreigners and large grids.
  113. /// </summary>
  114. private string m_userAssetUri = String.Empty;
  115. /// <summary>
  116. /// A URI to the users inventory server, used for foreigners and large grids
  117. /// </summary>
  118. private string m_userInventoryUri = String.Empty;
  119. /// <summary>
  120. /// The last used Web_login_key
  121. /// </summary>
  122. private UUID m_webLoginKey;
  123. // Data for estates and other goodies
  124. // to get away from per-machine configs a little
  125. //
  126. private int m_userFlags;
  127. private int m_godLevel;
  128. private string m_customType;
  129. private UUID m_partner;
  130. /// <summary>
  131. /// The regionhandle of the users preferred home region. If
  132. /// multiple sims occupy the same spot, the grid may decide
  133. /// which region the user logs into
  134. /// </summary>
  135. public virtual ulong HomeRegion
  136. {
  137. get
  138. {
  139. return Util.RegionWorldLocToHandle(Util.RegionToWorldLoc(m_homeRegionX), Util.RegionToWorldLoc(m_homeRegionY));
  140. // return Utils.UIntsToLong( m_homeRegionX * (uint)Constants.RegionSize, m_homeRegionY * (uint)Constants.RegionSize);
  141. }
  142. set
  143. {
  144. uint regionWorldLocX, regionWorldLocY;
  145. Util.RegionHandleToWorldLoc(value, out regionWorldLocX, out regionWorldLocY);
  146. m_homeRegionX = Util.WorldToRegionLoc(regionWorldLocX);
  147. m_homeRegionY = Util.WorldToRegionLoc(regionWorldLocY);
  148. // m_homeRegionX = (uint) (value >> 40);
  149. // m_homeRegionY = (((uint) (value)) >> 8);
  150. }
  151. }
  152. private UUID m_homeRegionId;
  153. /// <summary>
  154. /// The regionID of the users home region. This is unique;
  155. /// even if the position of the region changes within the
  156. /// grid, this will refer to the same region.
  157. /// </summary>
  158. public UUID HomeRegionID
  159. {
  160. get { return m_homeRegionId; }
  161. set { m_homeRegionId = value; }
  162. }
  163. // Property wrappers
  164. public UUID ID
  165. {
  166. get { return m_id; }
  167. set { m_id = value; }
  168. }
  169. public UUID WebLoginKey
  170. {
  171. get { return m_webLoginKey; }
  172. set { m_webLoginKey = value; }
  173. }
  174. public string FirstName
  175. {
  176. get { return m_firstname; }
  177. set { m_firstname = value; }
  178. }
  179. public string SurName
  180. {
  181. get { return m_surname; }
  182. set { m_surname = value; }
  183. }
  184. /// <value>
  185. /// The concatentation of the various name components.
  186. /// </value>
  187. public string Name
  188. {
  189. get { return String.Format("{0} {1}", m_firstname, m_surname); }
  190. }
  191. public string Email
  192. {
  193. get { return m_email; }
  194. set { m_email = value; }
  195. }
  196. public string PasswordHash
  197. {
  198. get { return m_passwordHash; }
  199. set { m_passwordHash = value; }
  200. }
  201. public string PasswordSalt
  202. {
  203. get { return m_passwordSalt; }
  204. set { m_passwordSalt = value; }
  205. }
  206. public uint HomeRegionX
  207. {
  208. get { return m_homeRegionX; }
  209. set { m_homeRegionX = value; }
  210. }
  211. public uint HomeRegionY
  212. {
  213. get { return m_homeRegionY; }
  214. set { m_homeRegionY = value; }
  215. }
  216. public Vector3 HomeLocation
  217. {
  218. get { return m_homeLocation; }
  219. set { m_homeLocation = value; }
  220. }
  221. // for handy serialization
  222. public float HomeLocationX
  223. {
  224. get { return m_homeLocation.X; }
  225. set { m_homeLocation.X = value; }
  226. }
  227. public float HomeLocationY
  228. {
  229. get { return m_homeLocation.Y; }
  230. set { m_homeLocation.Y = value; }
  231. }
  232. public float HomeLocationZ
  233. {
  234. get { return m_homeLocation.Z; }
  235. set { m_homeLocation.Z = value; }
  236. }
  237. public Vector3 HomeLookAt
  238. {
  239. get { return m_homeLookAt; }
  240. set { m_homeLookAt = value; }
  241. }
  242. // for handy serialization
  243. public float HomeLookAtX
  244. {
  245. get { return m_homeLookAt.X; }
  246. set { m_homeLookAt.X = value; }
  247. }
  248. public float HomeLookAtY
  249. {
  250. get { return m_homeLookAt.Y; }
  251. set { m_homeLookAt.Y = value; }
  252. }
  253. public float HomeLookAtZ
  254. {
  255. get { return m_homeLookAt.Z; }
  256. set { m_homeLookAt.Z = value; }
  257. }
  258. public int Created
  259. {
  260. get { return m_created; }
  261. set { m_created = value; }
  262. }
  263. public int LastLogin
  264. {
  265. get { return m_lastLogin; }
  266. set { m_lastLogin = value; }
  267. }
  268. public string UserInventoryURI
  269. {
  270. get { return m_userInventoryUri; }
  271. set { m_userInventoryUri = value; }
  272. }
  273. public string UserAssetURI
  274. {
  275. get { return m_userAssetUri; }
  276. set { m_userAssetUri = value; }
  277. }
  278. public uint CanDoMask
  279. {
  280. get { return m_profileCanDoMask; }
  281. set { m_profileCanDoMask = value; }
  282. }
  283. public uint WantDoMask
  284. {
  285. get { return m_profileWantDoMask; }
  286. set { m_profileWantDoMask = value; }
  287. }
  288. public string AboutText
  289. {
  290. get { return m_profileAboutText; }
  291. set { m_profileAboutText = value; }
  292. }
  293. public string FirstLifeAboutText
  294. {
  295. get { return m_profileFirstText; }
  296. set { m_profileFirstText = value; }
  297. }
  298. public string ProfileUrl
  299. {
  300. get { return m_profileUrl; }
  301. set { m_profileUrl = value; }
  302. }
  303. public UUID Image
  304. {
  305. get { return m_profileImage; }
  306. set { m_profileImage = value; }
  307. }
  308. public UUID FirstLifeImage
  309. {
  310. get { return m_profileFirstImage; }
  311. set { m_profileFirstImage = value; }
  312. }
  313. public UserAgentData CurrentAgent
  314. {
  315. get { return m_currentAgent; }
  316. set { m_currentAgent = value; }
  317. }
  318. public int UserFlags
  319. {
  320. get { return m_userFlags; }
  321. set { m_userFlags = value; }
  322. }
  323. public int GodLevel
  324. {
  325. get { return m_godLevel; }
  326. set { m_godLevel = value; }
  327. }
  328. public string CustomType
  329. {
  330. get { return m_customType; }
  331. set { m_customType = value; }
  332. }
  333. public UUID Partner
  334. {
  335. get { return m_partner; }
  336. set { m_partner = value; }
  337. }
  338. }
  339. }