aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/General
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework/General')
-rw-r--r--OpenSim/Framework/General/Interfaces/IClientAPI.cs1
-rw-r--r--OpenSim/Framework/General/Interfaces/IUserData.cs135
-rw-r--r--OpenSim/Framework/General/Interfaces/IUserService.cs2
-rw-r--r--OpenSim/Framework/General/Types/InventoryItemBase.cs222
-rw-r--r--OpenSim/Framework/General/Types/UserProfileData.cs191
5 files changed, 549 insertions, 2 deletions
diff --git a/OpenSim/Framework/General/Interfaces/IClientAPI.cs b/OpenSim/Framework/General/Interfaces/IClientAPI.cs
index 344a55c..bedea9e 100644
--- a/OpenSim/Framework/General/Interfaces/IClientAPI.cs
+++ b/OpenSim/Framework/General/Interfaces/IClientAPI.cs
@@ -31,7 +31,6 @@ using System.Net;
31using libsecondlife; 31using libsecondlife;
32using libsecondlife.Packets; 32using libsecondlife.Packets;
33using OpenSim.Framework.Types; 33using OpenSim.Framework.Types;
34using OpenSim.Framework.Data;
35 34
36namespace OpenSim.Framework.Interfaces 35namespace OpenSim.Framework.Interfaces
37{ 36{
diff --git a/OpenSim/Framework/General/Interfaces/IUserData.cs b/OpenSim/Framework/General/Interfaces/IUserData.cs
new file mode 100644
index 0000000..bb3abe0
--- /dev/null
+++ b/OpenSim/Framework/General/Interfaces/IUserData.cs
@@ -0,0 +1,135 @@
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*/
28using libsecondlife;
29using OpenSim.Framework.Types;
30
31namespace OpenSim.Framework.Data
32{
33 /// <summary>
34 /// An interface for connecting to user storage servers.
35 /// </summary>
36 public interface IUserData
37 {
38 /// <summary>
39 /// Returns a user profile from a database via their UUID
40 /// </summary>
41 /// <param name="user">The accounts UUID</param>
42 /// <returns>The user data profile</returns>
43 UserProfileData GetUserByUUID(LLUUID user);
44
45 /// <summary>
46 /// Returns a users profile by searching their username
47 /// </summary>
48 /// <param name="name">The users username</param>
49 /// <returns>The user data profile</returns>
50 UserProfileData GetUserByName(string name);
51
52 /// <summary>
53 /// Returns a users profile by searching their username parts
54 /// </summary>
55 /// <param name="fname">Account firstname</param>
56 /// <param name="lname">Account lastname</param>
57 /// <returns>The user data profile</returns>
58 UserProfileData GetUserByName(string fname, string lname);
59
60 /// <summary>
61 /// Returns the current agent for a user searching by it's UUID
62 /// </summary>
63 /// <param name="user">The users UUID</param>
64 /// <returns>The current agent session</returns>
65 UserAgentData GetAgentByUUID(LLUUID user);
66
67 /// <summary>
68 /// Returns the current session agent for a user searching by username
69 /// </summary>
70 /// <param name="name">The users account name</param>
71 /// <returns>The current agent session</returns>
72 UserAgentData GetAgentByName(string name);
73
74 /// <summary>
75 /// Returns the current session agent for a user searching by username parts
76 /// </summary>
77 /// <param name="fname">The users first account name</param>
78 /// <param name="lname">The users account surname</param>
79 /// <returns>The current agent session</returns>
80 UserAgentData GetAgentByName(string fname, string lname);
81
82 /// <summary>
83 /// Adds a new User profile to the database
84 /// </summary>
85 /// <param name="user">UserProfile to add</param>
86 void AddNewUserProfile(UserProfileData user);
87
88 /// <summary>
89 /// Updates an existing user profile
90 /// </summary>
91 /// <param name="user">UserProfile to update</param>
92 bool UpdateUserProfile(UserProfileData user);
93
94 /// <summary>
95 /// Adds a new agent to the database
96 /// </summary>
97 /// <param name="agent">The agent to add</param>
98 void AddNewUserAgent(UserAgentData agent);
99
100 /// <summary>
101 /// Attempts to move currency units between accounts (NOT RELIABLE / TRUSTWORTHY. DONT TRY RUN YOUR OWN CURRENCY EXCHANGE WITH REAL VALUES)
102 /// </summary>
103 /// <param name="from">The account to transfer from</param>
104 /// <param name="to">The account to transfer to</param>
105 /// <param name="amount">The amount to transfer</param>
106 /// <returns>Successful?</returns>
107 bool MoneyTransferRequest(LLUUID from, LLUUID to, uint amount);
108
109 /// <summary>
110 /// Attempts to move inventory between accounts, if inventory is copyable it will be copied into the target account.
111 /// </summary>
112 /// <param name="from">User to transfer from</param>
113 /// <param name="to">User to transfer to</param>
114 /// <param name="inventory">Specified inventory item</param>
115 /// <returns>Successful?</returns>
116 bool InventoryTransferRequest(LLUUID from, LLUUID to, LLUUID inventory);
117
118 /// <summary>
119 /// Returns the plugin version
120 /// </summary>
121 /// <returns>Plugin version in MAJOR.MINOR.REVISION.BUILD format</returns>
122 string GetVersion();
123
124 /// <summary>
125 /// Returns the plugin name
126 /// </summary>
127 /// <returns>Plugin name, eg MySQL User Provider</returns>
128 string getName();
129
130 /// <summary>
131 /// Initialises the plugin (artificial constructor)
132 /// </summary>
133 void Initialise();
134 }
135}
diff --git a/OpenSim/Framework/General/Interfaces/IUserService.cs b/OpenSim/Framework/General/Interfaces/IUserService.cs
index 974e025..461d4cb 100644
--- a/OpenSim/Framework/General/Interfaces/IUserService.cs
+++ b/OpenSim/Framework/General/Interfaces/IUserService.cs
@@ -26,7 +26,7 @@
26* 26*
27*/ 27*/
28using libsecondlife; 28using libsecondlife;
29using OpenSim.Framework.Data; 29using OpenSim.Framework.Types;
30 30
31namespace OpenSim.Framework.Interfaces 31namespace OpenSim.Framework.Interfaces
32{ 32{
diff --git a/OpenSim/Framework/General/Types/InventoryItemBase.cs b/OpenSim/Framework/General/Types/InventoryItemBase.cs
new file mode 100644
index 0000000..e3dbe71
--- /dev/null
+++ b/OpenSim/Framework/General/Types/InventoryItemBase.cs
@@ -0,0 +1,222 @@
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*/
28using System.Collections.Generic;
29using libsecondlife;
30
31namespace OpenSim.Framework.Types
32{
33 /// <summary>
34 /// Inventory Item - contains all the properties associated with an individual inventory piece.
35 /// </summary>
36 public class InventoryItemBase
37 {
38 /// <summary>
39 /// A UUID containing the ID for the inventory item itself
40 /// </summary>
41 public LLUUID inventoryID;
42 /// <summary>
43 /// The UUID of the associated asset on the asset server
44 /// </summary>
45 public LLUUID assetID;
46 /// <summary>
47 /// This is an enumerated value determining the type of asset (eg Notecard, Sound, Object, etc)
48 /// </summary>
49 public int assetType;
50 /// <summary>
51 /// The type of inventory item. (Can be slightly different to the asset type
52 /// </summary>
53 public int invType;
54 /// <summary>
55 /// The folder this item is contained in
56 /// </summary>
57 public LLUUID parentFolderID;
58 /// <summary>
59 /// The owner of this inventory item
60 /// </summary>
61 public LLUUID avatarID;
62 /// <summary>
63 /// The creator of this item
64 /// </summary>
65 public LLUUID creatorsID;
66 /// <summary>
67 /// The name of the inventory item (must be less than 64 characters)
68 /// </summary>
69 public string inventoryName;
70 /// <summary>
71 /// The description of the inventory item (must be less than 64 characters)
72 /// </summary>
73 public string inventoryDescription;
74 /// <summary>
75 /// A mask containing the permissions for the next owner (cannot be enforced)
76 /// </summary>
77 public uint inventoryNextPermissions;
78 /// <summary>
79 /// A mask containing permissions for the current owner (cannot be enforced)
80 /// </summary>
81 public uint inventoryCurrentPermissions;
82 /// <summary>
83 ///
84 /// </summary>
85 public uint inventoryBasePermissions;
86 /// <summary>
87 ///
88 /// </summary>
89 public uint inventoryEveryOnePermissions;
90 }
91
92 /// <summary>
93 /// A Class for folders which contain users inventory
94 /// </summary>
95 public class InventoryFolderBase
96 {
97 /// <summary>
98 /// The name of the folder (64 characters or less)
99 /// </summary>
100 public string name;
101 /// <summary>
102 /// The agent who's inventory this is contained by
103 /// </summary>
104 public LLUUID agentID;
105 /// <summary>
106 /// The folder this folder is contained in
107 /// </summary>
108 public LLUUID parentID;
109 /// <summary>
110 /// The UUID for this folder
111 /// </summary>
112 public LLUUID folderID;
113 /// <summary>
114 /// Tyep of Items normally stored in this folder
115 /// </summary>
116 public short type;
117 /// <summary>
118 ///
119 /// </summary>
120 public ushort version;
121 }
122
123 /// <summary>
124 /// An interface for accessing inventory data from a storage server
125 /// </summary>
126 public interface IInventoryData
127 {
128 /// <summary>
129 /// Initialises the interface
130 /// </summary>
131 void Initialise();
132
133 /// <summary>
134 /// Closes the interface
135 /// </summary>
136 void Close();
137
138 /// <summary>
139 /// The plugin being loaded
140 /// </summary>
141 /// <returns>A string containing the plugin name</returns>
142 string getName();
143
144 /// <summary>
145 /// The plugins version
146 /// </summary>
147 /// <returns>A string containing the plugin version</returns>
148 string getVersion();
149
150 /// <summary>
151 /// Returns a list of inventory items contained within the specified folder
152 /// </summary>
153 /// <param name="folderID">The UUID of the target folder</param>
154 /// <returns>A List of InventoryItemBase items</returns>
155 List<InventoryItemBase> getInventoryInFolder(LLUUID folderID);
156
157 /// <summary>
158 /// Returns a list of the root folders within a users inventory
159 /// </summary>
160 /// <param name="user">The user whos inventory is to be searched</param>
161 /// <returns>A list of folder objects</returns>
162 List<InventoryFolderBase> getUserRootFolders(LLUUID user);
163
164 /// <summary>
165 /// Returns the users inventory root folder.
166 /// </summary>
167 /// <param name="user">The UUID of the user who is having inventory being returned</param>
168 /// <returns>Root inventory folder</returns>
169 InventoryFolderBase getUserRootFolder(LLUUID user);
170
171 /// <summary>
172 /// Returns a list of inventory folders contained in the folder 'parentID'
173 /// </summary>
174 /// <param name="parentID">The folder to get subfolders for</param>
175 /// <returns>A list of inventory folders</returns>
176 List<InventoryFolderBase> getInventoryFolders(LLUUID parentID);
177
178 /// <summary>
179 /// Returns an inventory item by its UUID
180 /// </summary>
181 /// <param name="item">The UUID of the item to be returned</param>
182 /// <returns>A class containing item information</returns>
183 InventoryItemBase getInventoryItem(LLUUID item);
184
185 /// <summary>
186 /// Returns a specified inventory folder by its UUID
187 /// </summary>
188 /// <param name="folder">The UUID of the folder to be returned</param>
189 /// <returns>A class containing folder information</returns>
190 InventoryFolderBase getInventoryFolder(LLUUID folder);
191
192 /// <summary>
193 /// Creates a new inventory item based on item
194 /// </summary>
195 /// <param name="item">The item to be created</param>
196 void addInventoryItem(InventoryItemBase item);
197
198 /// <summary>
199 /// Updates an inventory item with item (updates based on ID)
200 /// </summary>
201 /// <param name="item">The updated item</param>
202 void updateInventoryItem(InventoryItemBase item);
203
204 /// <summary>
205 ///
206 /// </summary>
207 /// <param name="item"></param>
208 void deleteInventoryItem(InventoryItemBase item);
209
210 /// <summary>
211 /// Adds a new folder specified by folder
212 /// </summary>
213 /// <param name="folder">The inventory folder</param>
214 void addInventoryFolder(InventoryFolderBase folder);
215
216 /// <summary>
217 /// Updates a folder based on its ID with folder
218 /// </summary>
219 /// <param name="folder">The inventory folder</param>
220 void updateInventoryFolder(InventoryFolderBase folder);
221 }
222} \ No newline at end of file
diff --git a/OpenSim/Framework/General/Types/UserProfileData.cs b/OpenSim/Framework/General/Types/UserProfileData.cs
new file mode 100644
index 0000000..20d8224
--- /dev/null
+++ b/OpenSim/Framework/General/Types/UserProfileData.cs
@@ -0,0 +1,191 @@
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*/
28using System;
29using libsecondlife;
30
31namespace OpenSim.Framework.Types
32{
33 /// <summary>
34 /// Information about a particular user known to the userserver
35 /// </summary>
36 public class UserProfileData
37 {
38 /// <summary>
39 /// The ID value for this user
40 /// </summary>
41 public LLUUID UUID;
42
43 /// <summary>
44 /// The first component of a users account name
45 /// </summary>
46 public string username;
47 /// <summary>
48 /// The second component of a users account name
49 /// </summary>
50 public string surname;
51
52 /// <summary>
53 /// A salted hash containing the users password, in the format md5(md5(password) + ":" + salt)
54 /// </summary>
55 /// <remarks>This is double MD5'd because the client sends an unsalted MD5 to the loginserver</remarks>
56 public string passwordHash;
57 /// <summary>
58 /// The salt used for the users hash, should be 32 bytes or longer
59 /// </summary>
60 public string passwordSalt;
61
62 /// <summary>
63 /// The regionhandle of the users preffered home region. If multiple sims occupy the same spot, the grid may decide which region the user logs into
64 /// </summary>
65 public ulong homeRegion
66 {
67 get { return Helpers.UIntsToLong((homeRegionX * 256), (homeRegionY * 256)); }
68 set {
69 homeRegionX = (uint)(value >> 40);
70 homeRegionY = (((uint)(value)) >> 8);
71 }
72 }
73 public uint homeRegionX;
74 public uint homeRegionY;
75 /// <summary>
76 /// The coordinates inside the region of the home location
77 /// </summary>
78 public LLVector3 homeLocation;
79 /// <summary>
80 /// Where the user will be looking when they rez.
81 /// </summary>
82 public LLVector3 homeLookAt;
83
84 /// <summary>
85 /// A UNIX Timestamp (seconds since epoch) for the users creation
86 /// </summary>
87 public int created;
88 /// <summary>
89 /// A UNIX Timestamp for the users last login date / time
90 /// </summary>
91 public int lastLogin;
92
93 public LLUUID rootInventoryFolderID;
94
95 /// <summary>
96 /// A URI to the users inventory server, used for foreigners and large grids
97 /// </summary>
98 public string userInventoryURI = String.Empty;
99 /// <summary>
100 /// A URI to the users asset server, used for foreigners and large grids.
101 /// </summary>
102 public string userAssetURI = String.Empty;
103
104 /// <summary>
105 /// A uint mask containing the "I can do" fields of the users profile
106 /// </summary>
107 public uint profileCanDoMask;
108 /// <summary>
109 /// A uint mask containing the "I want to do" part of the users profile
110 /// </summary>
111 public uint profileWantDoMask; // Profile window "I want to" mask
112
113 /// <summary>
114 /// The about text listed in a users profile.
115 /// </summary>
116 public string profileAboutText = String.Empty;
117 /// <summary>
118 /// The first life about text listed in a users profile
119 /// </summary>
120 public string profileFirstText = String.Empty;
121
122 /// <summary>
123 /// The profile image for an avatar stored on the asset server
124 /// </summary>
125 public LLUUID profileImage;
126 /// <summary>
127 /// The profile image for the users first life tab
128 /// </summary>
129 public LLUUID profileFirstImage;
130 /// <summary>
131 /// The users last registered agent (filled in on the user server)
132 /// </summary>
133 public UserAgentData currentAgent;
134 }
135
136 /// <summary>
137 /// Information about a users session
138 /// </summary>
139 public class UserAgentData
140 {
141 /// <summary>
142 /// The UUID of the users avatar (not the agent!)
143 /// </summary>
144 public LLUUID UUID;
145 /// <summary>
146 /// The IP address of the user
147 /// </summary>
148 public string agentIP = String.Empty;
149 /// <summary>
150 /// The port of the user
151 /// </summary>
152 public uint agentPort;
153 /// <summary>
154 /// Is the user online?
155 /// </summary>
156 public bool agentOnline;
157 /// <summary>
158 /// The session ID for the user (also the agent ID)
159 /// </summary>
160 public LLUUID sessionID;
161 /// <summary>
162 /// The "secure" session ID for the user
163 /// </summary>
164 /// <remarks>Not very secure. Dont rely on it for anything more than Linden Lab does.</remarks>
165 public LLUUID secureSessionID;
166 /// <summary>
167 /// The region the user logged into initially
168 /// </summary>
169 public LLUUID regionID;
170 /// <summary>
171 /// A unix timestamp from when the user logged in
172 /// </summary>
173 public int loginTime;
174 /// <summary>
175 /// When this agent expired and logged out, 0 if still online
176 /// </summary>
177 public int logoutTime;
178 /// <summary>
179 /// Current region the user is logged into
180 /// </summary>
181 public LLUUID currentRegion;
182 /// <summary>
183 /// Region handle of the current region the user is in
184 /// </summary>
185 public ulong currentHandle;
186 /// <summary>
187 /// The position of the user within the region
188 /// </summary>
189 public LLVector3 currentPos;
190 }
191} \ No newline at end of file