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