IUserData.cs 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  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.Collections.Generic;
  28. using OpenMetaverse;
  29. namespace OpenSim.Framework
  30. {
  31. /// <summary>
  32. /// An interface for connecting to user storage servers.
  33. /// </summary>
  34. public interface IUserDataPlugin : IPlugin
  35. {
  36. /// <summary>
  37. /// Returns a user profile from a database via their UUID
  38. /// </summary>
  39. /// <param name="user">The user's UUID</param>
  40. /// <returns>The user data profile. Returns null if no user is found</returns>
  41. UserProfileData GetUserByUUID(UUID user);
  42. /// <summary>
  43. /// Returns a users profile by searching their username parts
  44. /// </summary>
  45. /// <param name="fname">Account firstname</param>
  46. /// <param name="lname">Account lastname</param>
  47. /// <returns>The user data profile</returns>
  48. UserProfileData GetUserByName(string fname, string lname);
  49. /// <summary>
  50. /// Returns a list of UUIDs firstnames and lastnames that match string query entered into the avatar picker.
  51. /// </summary>
  52. /// <param name="queryID">ID associated with the user's query. This must match what the client sent</param>
  53. /// <param name="query">The filtered contents of the search box when the user hit search.</param>
  54. /// <returns>The user data profile</returns>
  55. List<AvatarPickerAvatar> GeneratePickerResults(UUID queryID, string query);
  56. /// <summary>
  57. /// Returns the current agent for a user searching by it's UUID
  58. /// </summary>
  59. /// <param name="user">The users UUID</param>
  60. /// <returns>The current agent session</returns>
  61. UserAgentData GetAgentByUUID(UUID user);
  62. /// <summary>
  63. /// Returns the current session agent for a user searching by username
  64. /// </summary>
  65. /// <param name="name">The users account name</param>
  66. /// <returns>The current agent session</returns>
  67. UserAgentData GetAgentByName(string name);
  68. /// <summary>
  69. /// Returns the current session agent for a user searching by username parts
  70. /// </summary>
  71. /// <param name="fname">The users first account name</param>
  72. /// <param name="lname">The users account surname</param>
  73. /// <returns>The current agent session</returns>
  74. UserAgentData GetAgentByName(string fname, string lname);
  75. /// <summary>
  76. /// Stores new web-login key for user during web page login
  77. /// </summary>
  78. /// <param name="webLoginKey"></param>
  79. void StoreWebLoginKey(UUID agentID, UUID webLoginKey);
  80. /// <summary>
  81. /// Adds a new User profile to the database
  82. /// </summary>
  83. /// <param name="user">UserProfile to add</param>
  84. void AddNewUserProfile(UserProfileData user);
  85. /// <summary></summary>
  86. /// Updates an existing user profile
  87. /// </summary>
  88. /// <param name="user">UserProfile to update</param>
  89. bool UpdateUserProfile(UserProfileData user);
  90. /// <summary>
  91. /// Adds a new agent to the database
  92. /// </summary>
  93. /// <param name="agent">The agent to add</param>
  94. void AddNewUserAgent(UserAgentData agent);
  95. /// <summary>
  96. /// Adds a new friend to the database for XUser
  97. /// </summary>
  98. /// <param name="friendlistowner">The agent that who's friends list is being added to</param>
  99. /// <param name="friend">The agent that being added to the friends list of the friends list owner</param>
  100. /// <param name="perms">A uint bit vector for set perms that the friend being added has; 0 = none, 1=This friend can see when they sign on, 2 = map, 4 edit objects </param>
  101. void AddNewUserFriend(UUID friendlistowner, UUID friend, uint perms);
  102. /// <summary>
  103. /// Delete friend on friendlistowner's friendlist.
  104. /// </summary>
  105. /// <param name="friendlistowner">The agent that who's friends list is being updated</param>
  106. /// <param name="friend">The Ex-friend agent</param>
  107. void RemoveUserFriend(UUID friendlistowner, UUID friend);
  108. /// <summary>
  109. /// Update permissions for friend on friendlistowner's friendlist.
  110. /// </summary>
  111. /// <param name="friendlistowner">The agent that who's friends list is being updated</param>
  112. /// <param name="friend">The agent that is getting or loosing permissions</param>
  113. /// <param name="perms">A uint bit vector for set perms that the friend being added has; 0 = none, 1=This friend can see when they sign on, 2 = map, 4 edit objects </param>
  114. void UpdateUserFriendPerms(UUID friendlistowner, UUID friend, uint perms);
  115. /// <summary>
  116. /// Returns a list of FriendsListItems that describe the friends and permissions in the friend relationship for UUID friendslistowner
  117. /// </summary>
  118. /// <param name="friendlistowner">The agent that we're retreiving the friends Data.</param>
  119. List<FriendListItem> GetUserFriendList(UUID friendlistowner);
  120. /// <summary>
  121. /// Returns a list of <see cref="FriendRegionInfo/>s for the specified UUIDs.
  122. /// </summary>
  123. /// <param name="uuids">
  124. /// A <see cref="List"/> of <see cref="UUID/>s to fetch info for
  125. /// </param>
  126. /// <returns>
  127. /// A <see cref="Dictionary"/>, mapping the <see cref="UUID"/>s to <see cref="FriendRegionInfo"/>s.
  128. /// </returns>
  129. Dictionary<UUID, FriendRegionInfo> GetFriendRegionInfos(List<UUID> uuids);
  130. /// <summary>
  131. /// Attempts to move currency units between accounts (NOT RELIABLE / TRUSTWORTHY. DONT TRY RUN YOUR OWN CURRENCY EXCHANGE WITH REAL VALUES)
  132. /// </summary>
  133. /// <param name="from">The account to transfer from</param>
  134. /// <param name="to">The account to transfer to</param>
  135. /// <param name="amount">The amount to transfer</param>
  136. /// <returns>Successful?</returns>
  137. bool MoneyTransferRequest(UUID from, UUID to, uint amount);
  138. /// <summary>
  139. /// Attempts to move inventory between accounts, if inventory is copyable it will be copied into the target account.
  140. /// </summary>
  141. /// <param name="from">User to transfer from</param>
  142. /// <param name="to">User to transfer to</param>
  143. /// <param name="inventory">Specified inventory item</param>
  144. /// <returns>Successful?</returns>
  145. bool InventoryTransferRequest(UUID from, UUID to, UUID inventory);
  146. /// <summary>
  147. /// Initialises the plugin (artificial constructor)
  148. /// </summary>
  149. void Initialise(string connect);
  150. /// <summary>
  151. /// Gets the user appearance
  152. /// </summer>
  153. AvatarAppearance GetUserAppearance(UUID user);
  154. void UpdateUserAppearance(UUID user, AvatarAppearance appearance);
  155. void ResetAttachments(UUID userID);
  156. void LogoutUsers(UUID regionID);
  157. }
  158. public class UserDataInitialiser : PluginInitialiserBase
  159. {
  160. private string connect;
  161. public UserDataInitialiser (string s) { connect = s; }
  162. public override void Initialise (IPlugin plugin)
  163. {
  164. IUserDataPlugin p = plugin as IUserDataPlugin;
  165. p.Initialise (connect);
  166. }
  167. }
  168. }