diff options
author | Sean Dague | 2007-07-16 15:40:11 +0000 |
---|---|---|
committer | Sean Dague | 2007-07-16 15:40:11 +0000 |
commit | 2a3c79df83e800d5dfe75a1a3b140ed81da2b1d6 (patch) | |
tree | e3f80ad51736cf17e856547b1bcf956010927434 /OpenSim/Framework/UserManager/UserManagerBase.cs | |
parent | *Trunk compiles now (diff) | |
download | opensim-SC-2a3c79df83e800d5dfe75a1a3b140ed81da2b1d6.zip opensim-SC-2a3c79df83e800d5dfe75a1a3b140ed81da2b1d6.tar.gz opensim-SC-2a3c79df83e800d5dfe75a1a3b140ed81da2b1d6.tar.bz2 opensim-SC-2a3c79df83e800d5dfe75a1a3b140ed81da2b1d6.tar.xz |
changed to native line ending encoding
Diffstat (limited to 'OpenSim/Framework/UserManager/UserManagerBase.cs')
-rw-r--r-- | OpenSim/Framework/UserManager/UserManagerBase.cs | 1262 |
1 files changed, 631 insertions, 631 deletions
diff --git a/OpenSim/Framework/UserManager/UserManagerBase.cs b/OpenSim/Framework/UserManager/UserManagerBase.cs index 4e688f7..fe45d1b 100644 --- a/OpenSim/Framework/UserManager/UserManagerBase.cs +++ b/OpenSim/Framework/UserManager/UserManagerBase.cs | |||
@@ -1,631 +1,631 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | 2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 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 | 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 | 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 | 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. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | using System; | 28 | using System; |
29 | using System.Collections; | 29 | using System.Collections; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Reflection; | 31 | using System.Reflection; |
32 | using System.Security.Cryptography; | 32 | using System.Security.Cryptography; |
33 | using libsecondlife; | 33 | using libsecondlife; |
34 | using Nwc.XmlRpc; | 34 | using Nwc.XmlRpc; |
35 | using OpenSim.Framework.Console; | 35 | using OpenSim.Framework.Console; |
36 | using OpenSim.Framework.Data; | 36 | using OpenSim.Framework.Data; |
37 | using OpenSim.Framework.Interfaces; | 37 | using OpenSim.Framework.Interfaces; |
38 | using OpenSim.Framework.Inventory; | 38 | using OpenSim.Framework.Inventory; |
39 | using OpenSim.Framework.Utilities; | 39 | using OpenSim.Framework.Utilities; |
40 | 40 | ||
41 | namespace OpenSim.Framework.UserManagement | 41 | namespace OpenSim.Framework.UserManagement |
42 | { | 42 | { |
43 | public abstract class UserManagerBase | 43 | public abstract class UserManagerBase |
44 | { | 44 | { |
45 | public UserConfig _config; | 45 | public UserConfig _config; |
46 | Dictionary<string, IUserData> _plugins = new Dictionary<string, IUserData>(); | 46 | Dictionary<string, IUserData> _plugins = new Dictionary<string, IUserData>(); |
47 | 47 | ||
48 | /// <summary> | 48 | /// <summary> |
49 | /// Adds a new user server plugin - user servers will be requested in the order they were loaded. | 49 | /// Adds a new user server plugin - user servers will be requested in the order they were loaded. |
50 | /// </summary> | 50 | /// </summary> |
51 | /// <param name="FileName">The filename to the user server plugin DLL</param> | 51 | /// <param name="FileName">The filename to the user server plugin DLL</param> |
52 | public void AddPlugin(string FileName) | 52 | public void AddPlugin(string FileName) |
53 | { | 53 | { |
54 | MainLog.Instance.Verbose( "Userstorage: Attempting to load " + FileName); | 54 | MainLog.Instance.Verbose( "Userstorage: Attempting to load " + FileName); |
55 | Assembly pluginAssembly = Assembly.LoadFrom(FileName); | 55 | Assembly pluginAssembly = Assembly.LoadFrom(FileName); |
56 | 56 | ||
57 | MainLog.Instance.Verbose( "Userstorage: Found " + pluginAssembly.GetTypes().Length + " interfaces."); | 57 | MainLog.Instance.Verbose( "Userstorage: Found " + pluginAssembly.GetTypes().Length + " interfaces."); |
58 | foreach (Type pluginType in pluginAssembly.GetTypes()) | 58 | foreach (Type pluginType in pluginAssembly.GetTypes()) |
59 | { | 59 | { |
60 | if (!pluginType.IsAbstract) | 60 | if (!pluginType.IsAbstract) |
61 | { | 61 | { |
62 | Type typeInterface = pluginType.GetInterface("IUserData", true); | 62 | Type typeInterface = pluginType.GetInterface("IUserData", true); |
63 | 63 | ||
64 | if (typeInterface != null) | 64 | if (typeInterface != null) |
65 | { | 65 | { |
66 | IUserData plug = (IUserData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); | 66 | IUserData plug = (IUserData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); |
67 | plug.Initialise(); | 67 | plug.Initialise(); |
68 | this._plugins.Add(plug.getName(), plug); | 68 | this._plugins.Add(plug.getName(), plug); |
69 | MainLog.Instance.Verbose( "Userstorage: Added IUserData Interface"); | 69 | MainLog.Instance.Verbose( "Userstorage: Added IUserData Interface"); |
70 | } | 70 | } |
71 | 71 | ||
72 | typeInterface = null; | 72 | typeInterface = null; |
73 | } | 73 | } |
74 | } | 74 | } |
75 | 75 | ||
76 | pluginAssembly = null; | 76 | pluginAssembly = null; |
77 | } | 77 | } |
78 | 78 | ||
79 | #region Get UserProfile | 79 | #region Get UserProfile |
80 | /// <summary> | 80 | /// <summary> |
81 | /// Loads a user profile from a database by UUID | 81 | /// Loads a user profile from a database by UUID |
82 | /// </summary> | 82 | /// </summary> |
83 | /// <param name="uuid">The target UUID</param> | 83 | /// <param name="uuid">The target UUID</param> |
84 | /// <returns>A user profile</returns> | 84 | /// <returns>A user profile</returns> |
85 | public UserProfileData getUserProfile(LLUUID uuid) | 85 | public UserProfileData getUserProfile(LLUUID uuid) |
86 | { | 86 | { |
87 | foreach (KeyValuePair<string, IUserData> plugin in _plugins) | 87 | foreach (KeyValuePair<string, IUserData> plugin in _plugins) |
88 | { | 88 | { |
89 | try | 89 | try |
90 | { | 90 | { |
91 | UserProfileData profile = plugin.Value.getUserByUUID(uuid); | 91 | UserProfileData profile = plugin.Value.getUserByUUID(uuid); |
92 | profile.currentAgent = getUserAgent(profile.UUID); | 92 | profile.currentAgent = getUserAgent(profile.UUID); |
93 | return profile; | 93 | return profile; |
94 | } | 94 | } |
95 | catch (Exception e) | 95 | catch (Exception e) |
96 | { | 96 | { |
97 | MainLog.Instance.Verbose( "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); | 97 | MainLog.Instance.Verbose( "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); |
98 | } | 98 | } |
99 | } | 99 | } |
100 | 100 | ||
101 | return null; | 101 | return null; |
102 | } | 102 | } |
103 | 103 | ||
104 | 104 | ||
105 | /// <summary> | 105 | /// <summary> |
106 | /// Loads a user profile by name | 106 | /// Loads a user profile by name |
107 | /// </summary> | 107 | /// </summary> |
108 | /// <param name="name">The target name</param> | 108 | /// <param name="name">The target name</param> |
109 | /// <returns>A user profile</returns> | 109 | /// <returns>A user profile</returns> |
110 | public UserProfileData getUserProfile(string name) | 110 | public UserProfileData getUserProfile(string name) |
111 | { | 111 | { |
112 | foreach (KeyValuePair<string, IUserData> plugin in _plugins) | 112 | foreach (KeyValuePair<string, IUserData> plugin in _plugins) |
113 | { | 113 | { |
114 | try | 114 | try |
115 | { | 115 | { |
116 | UserProfileData profile = plugin.Value.getUserByName(name); | 116 | UserProfileData profile = plugin.Value.getUserByName(name); |
117 | profile.currentAgent = getUserAgent(profile.UUID); | 117 | profile.currentAgent = getUserAgent(profile.UUID); |
118 | return profile; | 118 | return profile; |
119 | } | 119 | } |
120 | catch (Exception e) | 120 | catch (Exception e) |
121 | { | 121 | { |
122 | System.Console.WriteLine("EEK!"); | 122 | System.Console.WriteLine("EEK!"); |
123 | MainLog.Instance.Verbose( "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); | 123 | MainLog.Instance.Verbose( "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); |
124 | } | 124 | } |
125 | } | 125 | } |
126 | 126 | ||
127 | return null; | 127 | return null; |
128 | } | 128 | } |
129 | 129 | ||
130 | /// <summary> | 130 | /// <summary> |
131 | /// Loads a user profile by name | 131 | /// Loads a user profile by name |
132 | /// </summary> | 132 | /// </summary> |
133 | /// <param name="fname">First name</param> | 133 | /// <param name="fname">First name</param> |
134 | /// <param name="lname">Last name</param> | 134 | /// <param name="lname">Last name</param> |
135 | /// <returns>A user profile</returns> | 135 | /// <returns>A user profile</returns> |
136 | public UserProfileData getUserProfile(string fname, string lname) | 136 | public UserProfileData getUserProfile(string fname, string lname) |
137 | { | 137 | { |
138 | foreach (KeyValuePair<string, IUserData> plugin in _plugins) | 138 | foreach (KeyValuePair<string, IUserData> plugin in _plugins) |
139 | { | 139 | { |
140 | try | 140 | try |
141 | { | 141 | { |
142 | UserProfileData profile = plugin.Value.getUserByName(fname,lname); | 142 | UserProfileData profile = plugin.Value.getUserByName(fname,lname); |
143 | 143 | ||
144 | profile.currentAgent = getUserAgent(profile.UUID); | 144 | profile.currentAgent = getUserAgent(profile.UUID); |
145 | 145 | ||
146 | return profile; | 146 | return profile; |
147 | } | 147 | } |
148 | catch (Exception e) | 148 | catch (Exception e) |
149 | { | 149 | { |
150 | MainLog.Instance.Verbose( "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); | 150 | MainLog.Instance.Verbose( "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); |
151 | } | 151 | } |
152 | } | 152 | } |
153 | 153 | ||
154 | return null; | 154 | return null; |
155 | } | 155 | } |
156 | #endregion | 156 | #endregion |
157 | 157 | ||
158 | #region Get UserAgent | 158 | #region Get UserAgent |
159 | /// <summary> | 159 | /// <summary> |
160 | /// Loads a user agent by uuid (not called directly) | 160 | /// Loads a user agent by uuid (not called directly) |
161 | /// </summary> | 161 | /// </summary> |
162 | /// <param name="uuid">The agents UUID</param> | 162 | /// <param name="uuid">The agents UUID</param> |
163 | /// <returns>Agent profiles</returns> | 163 | /// <returns>Agent profiles</returns> |
164 | public UserAgentData getUserAgent(LLUUID uuid) | 164 | public UserAgentData getUserAgent(LLUUID uuid) |
165 | { | 165 | { |
166 | foreach (KeyValuePair<string, IUserData> plugin in _plugins) | 166 | foreach (KeyValuePair<string, IUserData> plugin in _plugins) |
167 | { | 167 | { |
168 | try | 168 | try |
169 | { | 169 | { |
170 | return plugin.Value.getAgentByUUID(uuid); | 170 | return plugin.Value.getAgentByUUID(uuid); |
171 | } | 171 | } |
172 | catch (Exception e) | 172 | catch (Exception e) |
173 | { | 173 | { |
174 | MainLog.Instance.Verbose( "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); | 174 | MainLog.Instance.Verbose( "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); |
175 | } | 175 | } |
176 | } | 176 | } |
177 | 177 | ||
178 | return null; | 178 | return null; |
179 | } | 179 | } |
180 | 180 | ||
181 | /// <summary> | 181 | /// <summary> |
182 | /// Loads a user agent by name (not called directly) | 182 | /// Loads a user agent by name (not called directly) |
183 | /// </summary> | 183 | /// </summary> |
184 | /// <param name="name">The agents name</param> | 184 | /// <param name="name">The agents name</param> |
185 | /// <returns>A user agent</returns> | 185 | /// <returns>A user agent</returns> |
186 | public UserAgentData getUserAgent(string name) | 186 | public UserAgentData getUserAgent(string name) |
187 | { | 187 | { |
188 | foreach (KeyValuePair<string, IUserData> plugin in _plugins) | 188 | foreach (KeyValuePair<string, IUserData> plugin in _plugins) |
189 | { | 189 | { |
190 | try | 190 | try |
191 | { | 191 | { |
192 | return plugin.Value.getAgentByName(name); | 192 | return plugin.Value.getAgentByName(name); |
193 | } | 193 | } |
194 | catch (Exception e) | 194 | catch (Exception e) |
195 | { | 195 | { |
196 | MainLog.Instance.Verbose( "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); | 196 | MainLog.Instance.Verbose( "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); |
197 | } | 197 | } |
198 | } | 198 | } |
199 | 199 | ||
200 | return null; | 200 | return null; |
201 | } | 201 | } |
202 | 202 | ||
203 | /// <summary> | 203 | /// <summary> |
204 | /// Loads a user agent by name (not called directly) | 204 | /// Loads a user agent by name (not called directly) |
205 | /// </summary> | 205 | /// </summary> |
206 | /// <param name="fname">The agents firstname</param> | 206 | /// <param name="fname">The agents firstname</param> |
207 | /// <param name="lname">The agents lastname</param> | 207 | /// <param name="lname">The agents lastname</param> |
208 | /// <returns>A user agent</returns> | 208 | /// <returns>A user agent</returns> |
209 | public UserAgentData getUserAgent(string fname, string lname) | 209 | public UserAgentData getUserAgent(string fname, string lname) |
210 | { | 210 | { |
211 | foreach (KeyValuePair<string, IUserData> plugin in _plugins) | 211 | foreach (KeyValuePair<string, IUserData> plugin in _plugins) |
212 | { | 212 | { |
213 | try | 213 | try |
214 | { | 214 | { |
215 | return plugin.Value.getAgentByName(fname,lname); | 215 | return plugin.Value.getAgentByName(fname,lname); |
216 | } | 216 | } |
217 | catch (Exception e) | 217 | catch (Exception e) |
218 | { | 218 | { |
219 | MainLog.Instance.Verbose( "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); | 219 | MainLog.Instance.Verbose( "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); |
220 | } | 220 | } |
221 | } | 221 | } |
222 | 222 | ||
223 | return null; | 223 | return null; |
224 | } | 224 | } |
225 | 225 | ||
226 | #endregion | 226 | #endregion |
227 | 227 | ||
228 | #region CreateAgent | 228 | #region CreateAgent |
229 | /// <summary> | 229 | /// <summary> |
230 | /// Creates and initialises a new user agent - make sure to use CommitAgent when done to submit to the DB | 230 | /// Creates and initialises a new user agent - make sure to use CommitAgent when done to submit to the DB |
231 | /// </summary> | 231 | /// </summary> |
232 | /// <param name="profile">The users profile</param> | 232 | /// <param name="profile">The users profile</param> |
233 | /// <param name="request">The users loginrequest</param> | 233 | /// <param name="request">The users loginrequest</param> |
234 | public void CreateAgent(UserProfileData profile, XmlRpcRequest request) | 234 | public void CreateAgent(UserProfileData profile, XmlRpcRequest request) |
235 | { | 235 | { |
236 | Hashtable requestData = (Hashtable)request.Params[0]; | 236 | Hashtable requestData = (Hashtable)request.Params[0]; |
237 | 237 | ||
238 | UserAgentData agent = new UserAgentData(); | 238 | UserAgentData agent = new UserAgentData(); |
239 | 239 | ||
240 | // User connection | 240 | // User connection |
241 | agent.agentOnline = true; | 241 | agent.agentOnline = true; |
242 | 242 | ||
243 | // Generate sessions | 243 | // Generate sessions |
244 | RNGCryptoServiceProvider rand = new RNGCryptoServiceProvider(); | 244 | RNGCryptoServiceProvider rand = new RNGCryptoServiceProvider(); |
245 | byte[] randDataS = new byte[16]; | 245 | byte[] randDataS = new byte[16]; |
246 | byte[] randDataSS = new byte[16]; | 246 | byte[] randDataSS = new byte[16]; |
247 | rand.GetBytes(randDataS); | 247 | rand.GetBytes(randDataS); |
248 | rand.GetBytes(randDataSS); | 248 | rand.GetBytes(randDataSS); |
249 | 249 | ||
250 | agent.secureSessionID = new LLUUID(randDataSS, 0); | 250 | agent.secureSessionID = new LLUUID(randDataSS, 0); |
251 | agent.sessionID = new LLUUID(randDataS, 0); | 251 | agent.sessionID = new LLUUID(randDataS, 0); |
252 | 252 | ||
253 | // Profile UUID | 253 | // Profile UUID |
254 | agent.UUID = profile.UUID; | 254 | agent.UUID = profile.UUID; |
255 | 255 | ||
256 | // Current position (from Home) | 256 | // Current position (from Home) |
257 | agent.currentHandle = profile.homeRegion; | 257 | agent.currentHandle = profile.homeRegion; |
258 | agent.currentPos = profile.homeLocation; | 258 | agent.currentPos = profile.homeLocation; |
259 | 259 | ||
260 | // If user specified additional start, use that | 260 | // If user specified additional start, use that |
261 | if (requestData.ContainsKey("start")) | 261 | if (requestData.ContainsKey("start")) |
262 | { | 262 | { |
263 | string startLoc = ((string)requestData["start"]).Trim(); | 263 | string startLoc = ((string)requestData["start"]).Trim(); |
264 | if (!(startLoc == "last" || startLoc == "home")) | 264 | if (!(startLoc == "last" || startLoc == "home")) |
265 | { | 265 | { |
266 | // Format: uri:Ahern&162&213&34 | 266 | // Format: uri:Ahern&162&213&34 |
267 | try | 267 | try |
268 | { | 268 | { |
269 | string[] parts = startLoc.Remove(0, 4).Split('&'); | 269 | string[] parts = startLoc.Remove(0, 4).Split('&'); |
270 | string region = parts[0]; | 270 | string region = parts[0]; |
271 | 271 | ||
272 | //////////////////////////////////////////////////// | 272 | //////////////////////////////////////////////////// |
273 | //SimProfile SimInfo = new SimProfile(); | 273 | //SimProfile SimInfo = new SimProfile(); |
274 | //SimInfo = SimInfo.LoadFromGrid(theUser.currentAgent.currentHandle, _config.GridServerURL, _config.GridSendKey, _config.GridRecvKey); | 274 | //SimInfo = SimInfo.LoadFromGrid(theUser.currentAgent.currentHandle, _config.GridServerURL, _config.GridSendKey, _config.GridRecvKey); |
275 | } | 275 | } |
276 | catch (Exception) | 276 | catch (Exception) |
277 | { | 277 | { |
278 | 278 | ||
279 | } | 279 | } |
280 | } | 280 | } |
281 | } | 281 | } |
282 | 282 | ||
283 | // What time did the user login? | 283 | // What time did the user login? |
284 | agent.loginTime = Util.UnixTimeSinceEpoch(); | 284 | agent.loginTime = Util.UnixTimeSinceEpoch(); |
285 | agent.logoutTime = 0; | 285 | agent.logoutTime = 0; |
286 | 286 | ||
287 | // Current location | 287 | // Current location |
288 | agent.regionID = new LLUUID(); // Fill in later | 288 | agent.regionID = new LLUUID(); // Fill in later |
289 | agent.currentRegion = new LLUUID(); // Fill in later | 289 | agent.currentRegion = new LLUUID(); // Fill in later |
290 | 290 | ||
291 | profile.currentAgent = agent; | 291 | profile.currentAgent = agent; |
292 | } | 292 | } |
293 | 293 | ||
294 | /// <summary> | 294 | /// <summary> |
295 | /// Saves a target agent to the database | 295 | /// Saves a target agent to the database |
296 | /// </summary> | 296 | /// </summary> |
297 | /// <param name="profile">The users profile</param> | 297 | /// <param name="profile">The users profile</param> |
298 | /// <returns>Successful?</returns> | 298 | /// <returns>Successful?</returns> |
299 | public bool CommitAgent(ref UserProfileData profile) | 299 | public bool CommitAgent(ref UserProfileData profile) |
300 | { | 300 | { |
301 | // Saves the agent to database | 301 | // Saves the agent to database |
302 | return true; | 302 | return true; |
303 | } | 303 | } |
304 | 304 | ||
305 | #endregion | 305 | #endregion |
306 | 306 | ||
307 | /// <summary> | 307 | /// <summary> |
308 | /// Checks a user against it's password hash | 308 | /// Checks a user against it's password hash |
309 | /// </summary> | 309 | /// </summary> |
310 | /// <param name="profile">The users profile</param> | 310 | /// <param name="profile">The users profile</param> |
311 | /// <param name="password">The supplied password</param> | 311 | /// <param name="password">The supplied password</param> |
312 | /// <returns>Authenticated?</returns> | 312 | /// <returns>Authenticated?</returns> |
313 | public virtual bool AuthenticateUser(UserProfileData profile, string password) | 313 | public virtual bool AuthenticateUser(UserProfileData profile, string password) |
314 | { | 314 | { |
315 | MainLog.Instance.Verbose( | 315 | MainLog.Instance.Verbose( |
316 | "Authenticating " + profile.username + " " + profile.surname); | 316 | "Authenticating " + profile.username + " " + profile.surname); |
317 | 317 | ||
318 | password = password.Remove(0, 3); //remove $1$ | 318 | password = password.Remove(0, 3); //remove $1$ |
319 | 319 | ||
320 | string s = Util.Md5Hash(password + ":" + profile.passwordSalt); | 320 | string s = Util.Md5Hash(password + ":" + profile.passwordSalt); |
321 | 321 | ||
322 | return profile.passwordHash.Equals(s.ToString(), StringComparison.InvariantCultureIgnoreCase); | 322 | return profile.passwordHash.Equals(s.ToString(), StringComparison.InvariantCultureIgnoreCase); |
323 | } | 323 | } |
324 | 324 | ||
325 | #region Xml Response | 325 | #region Xml Response |
326 | 326 | ||
327 | /// <summary> | 327 | /// <summary> |
328 | /// | 328 | /// |
329 | /// </summary> | 329 | /// </summary> |
330 | /// <param name="firstname"></param> | 330 | /// <param name="firstname"></param> |
331 | /// <param name="lastname"></param> | 331 | /// <param name="lastname"></param> |
332 | /// <returns></returns> | 332 | /// <returns></returns> |
333 | public virtual UserProfileData GetTheUser(string firstname, string lastname) | 333 | public virtual UserProfileData GetTheUser(string firstname, string lastname) |
334 | { | 334 | { |
335 | return getUserProfile(firstname, lastname); | 335 | return getUserProfile(firstname, lastname); |
336 | } | 336 | } |
337 | 337 | ||
338 | /// <summary> | 338 | /// <summary> |
339 | /// | 339 | /// |
340 | /// </summary> | 340 | /// </summary> |
341 | /// <returns></returns> | 341 | /// <returns></returns> |
342 | public virtual string GetMessage() | 342 | public virtual string GetMessage() |
343 | { | 343 | { |
344 | return _config.DefaultStartupMsg; | 344 | return _config.DefaultStartupMsg; |
345 | } | 345 | } |
346 | 346 | ||
347 | /// <summary> | 347 | /// <summary> |
348 | /// Customises the login response and fills in missing values. | 348 | /// Customises the login response and fills in missing values. |
349 | /// </summary> | 349 | /// </summary> |
350 | /// <param name="response">The existing response</param> | 350 | /// <param name="response">The existing response</param> |
351 | /// <param name="theUser">The user profile</param> | 351 | /// <param name="theUser">The user profile</param> |
352 | public abstract void CustomiseResponse( LoginResponse response, UserProfileData theUser); | 352 | public abstract void CustomiseResponse( LoginResponse response, UserProfileData theUser); |
353 | 353 | ||
354 | /// <summary> | 354 | /// <summary> |
355 | /// Main user login function | 355 | /// Main user login function |
356 | /// </summary> | 356 | /// </summary> |
357 | /// <param name="request">The XMLRPC request</param> | 357 | /// <param name="request">The XMLRPC request</param> |
358 | /// <returns>The response to send</returns> | 358 | /// <returns>The response to send</returns> |
359 | public XmlRpcResponse XmlRpcLoginMethod(XmlRpcRequest request) | 359 | public XmlRpcResponse XmlRpcLoginMethod(XmlRpcRequest request) |
360 | { | 360 | { |
361 | 361 | ||
362 | System.Console.WriteLine("Attempting login now..."); | 362 | System.Console.WriteLine("Attempting login now..."); |
363 | XmlRpcResponse response = new XmlRpcResponse(); | 363 | XmlRpcResponse response = new XmlRpcResponse(); |
364 | Hashtable requestData = (Hashtable)request.Params[0]; | 364 | Hashtable requestData = (Hashtable)request.Params[0]; |
365 | 365 | ||
366 | bool GoodXML = (requestData.Contains("first") && requestData.Contains("last") && requestData.Contains("passwd")); | 366 | bool GoodXML = (requestData.Contains("first") && requestData.Contains("last") && requestData.Contains("passwd")); |
367 | bool GoodLogin = false; | 367 | bool GoodLogin = false; |
368 | string firstname = ""; | 368 | string firstname = ""; |
369 | string lastname = ""; | 369 | string lastname = ""; |
370 | string passwd = ""; | 370 | string passwd = ""; |
371 | 371 | ||
372 | UserProfileData userProfile; | 372 | UserProfileData userProfile; |
373 | LoginResponse logResponse = new LoginResponse(); | 373 | LoginResponse logResponse = new LoginResponse(); |
374 | 374 | ||
375 | if (GoodXML) | 375 | if (GoodXML) |
376 | { | 376 | { |
377 | firstname = (string)requestData["first"]; | 377 | firstname = (string)requestData["first"]; |
378 | lastname = (string)requestData["last"]; | 378 | lastname = (string)requestData["last"]; |
379 | passwd = (string)requestData["passwd"]; | 379 | passwd = (string)requestData["passwd"]; |
380 | 380 | ||
381 | userProfile = GetTheUser(firstname, lastname); | 381 | userProfile = GetTheUser(firstname, lastname); |
382 | if (userProfile == null) | 382 | if (userProfile == null) |
383 | return logResponse.CreateLoginFailedResponse(); | 383 | return logResponse.CreateLoginFailedResponse(); |
384 | 384 | ||
385 | GoodLogin = AuthenticateUser(userProfile, passwd); | 385 | GoodLogin = AuthenticateUser(userProfile, passwd); |
386 | } | 386 | } |
387 | else | 387 | else |
388 | { | 388 | { |
389 | return logResponse.CreateGridErrorResponse(); | 389 | return logResponse.CreateGridErrorResponse(); |
390 | } | 390 | } |
391 | 391 | ||
392 | if (!GoodLogin) | 392 | if (!GoodLogin) |
393 | { | 393 | { |
394 | return logResponse.CreateLoginFailedResponse(); | 394 | return logResponse.CreateLoginFailedResponse(); |
395 | } | 395 | } |
396 | else | 396 | else |
397 | { | 397 | { |
398 | // If we already have a session... | 398 | // If we already have a session... |
399 | if (userProfile.currentAgent != null && userProfile.currentAgent.agentOnline) | 399 | if (userProfile.currentAgent != null && userProfile.currentAgent.agentOnline) |
400 | { | 400 | { |
401 | // Reject the login | 401 | // Reject the login |
402 | return logResponse.CreateAlreadyLoggedInResponse(); | 402 | return logResponse.CreateAlreadyLoggedInResponse(); |
403 | } | 403 | } |
404 | // Otherwise... | 404 | // Otherwise... |
405 | // Create a new agent session | 405 | // Create a new agent session |
406 | CreateAgent( userProfile, request); | 406 | CreateAgent( userProfile, request); |
407 | 407 | ||
408 | try | 408 | try |
409 | { | 409 | { |
410 | 410 | ||
411 | LLUUID AgentID = userProfile.UUID; | 411 | LLUUID AgentID = userProfile.UUID; |
412 | 412 | ||
413 | // Inventory Library Section | 413 | // Inventory Library Section |
414 | ArrayList AgentInventoryArray = new ArrayList(); | 414 | ArrayList AgentInventoryArray = new ArrayList(); |
415 | Hashtable TempHash; | 415 | Hashtable TempHash; |
416 | 416 | ||
417 | AgentInventory Library = new AgentInventory(); | 417 | AgentInventory Library = new AgentInventory(); |
418 | Library.CreateRootFolder(AgentID, true); | 418 | Library.CreateRootFolder(AgentID, true); |
419 | 419 | ||
420 | foreach (InventoryFolder InvFolder in Library.InventoryFolders.Values) | 420 | foreach (InventoryFolder InvFolder in Library.InventoryFolders.Values) |
421 | { | 421 | { |
422 | TempHash = new Hashtable(); | 422 | TempHash = new Hashtable(); |
423 | TempHash["name"] = InvFolder.FolderName; | 423 | TempHash["name"] = InvFolder.FolderName; |
424 | TempHash["parent_id"] = InvFolder.ParentID.ToStringHyphenated(); | 424 | TempHash["parent_id"] = InvFolder.ParentID.ToStringHyphenated(); |
425 | TempHash["version"] = (Int32)InvFolder.Version; | 425 | TempHash["version"] = (Int32)InvFolder.Version; |
426 | TempHash["type_default"] = (Int32)InvFolder.DefaultType; | 426 | TempHash["type_default"] = (Int32)InvFolder.DefaultType; |
427 | TempHash["folder_id"] = InvFolder.FolderID.ToStringHyphenated(); | 427 | TempHash["folder_id"] = InvFolder.FolderID.ToStringHyphenated(); |
428 | AgentInventoryArray.Add(TempHash); | 428 | AgentInventoryArray.Add(TempHash); |
429 | } | 429 | } |
430 | 430 | ||
431 | Hashtable InventoryRootHash = new Hashtable(); | 431 | Hashtable InventoryRootHash = new Hashtable(); |
432 | InventoryRootHash["folder_id"] = Library.InventoryRoot.FolderID.ToStringHyphenated(); | 432 | InventoryRootHash["folder_id"] = Library.InventoryRoot.FolderID.ToStringHyphenated(); |
433 | ArrayList InventoryRoot = new ArrayList(); | 433 | ArrayList InventoryRoot = new ArrayList(); |
434 | InventoryRoot.Add(InventoryRootHash); | 434 | InventoryRoot.Add(InventoryRootHash); |
435 | 435 | ||
436 | // Circuit Code | 436 | // Circuit Code |
437 | uint circode = (uint)(Util.RandomClass.Next()); | 437 | uint circode = (uint)(Util.RandomClass.Next()); |
438 | 438 | ||
439 | logResponse.Lastname = userProfile.surname; | 439 | logResponse.Lastname = userProfile.surname; |
440 | logResponse.Firstname = userProfile.username; | 440 | logResponse.Firstname = userProfile.username; |
441 | logResponse.AgentID = AgentID.ToStringHyphenated(); | 441 | logResponse.AgentID = AgentID.ToStringHyphenated(); |
442 | logResponse.SessionID = userProfile.currentAgent.sessionID.ToStringHyphenated(); | 442 | logResponse.SessionID = userProfile.currentAgent.sessionID.ToStringHyphenated(); |
443 | logResponse.SecureSessionID = userProfile.currentAgent.secureSessionID.ToStringHyphenated(); | 443 | logResponse.SecureSessionID = userProfile.currentAgent.secureSessionID.ToStringHyphenated(); |
444 | logResponse.InventoryRoot = InventoryRoot; | 444 | logResponse.InventoryRoot = InventoryRoot; |
445 | logResponse.InventorySkeleton = AgentInventoryArray; | 445 | logResponse.InventorySkeleton = AgentInventoryArray; |
446 | logResponse.CircuitCode = (Int32)circode; | 446 | logResponse.CircuitCode = (Int32)circode; |
447 | //logResponse.RegionX = 0; //overwritten | 447 | //logResponse.RegionX = 0; //overwritten |
448 | //logResponse.RegionY = 0; //overwritten | 448 | //logResponse.RegionY = 0; //overwritten |
449 | logResponse.Home = "!!null temporary value {home}!!"; // Overwritten | 449 | logResponse.Home = "!!null temporary value {home}!!"; // Overwritten |
450 | //logResponse.LookAt = "\n[r" + TheUser.homeLookAt.X.ToString() + ",r" + TheUser.homeLookAt.Y.ToString() + ",r" + TheUser.homeLookAt.Z.ToString() + "]\n"; | 450 | //logResponse.LookAt = "\n[r" + TheUser.homeLookAt.X.ToString() + ",r" + TheUser.homeLookAt.Y.ToString() + ",r" + TheUser.homeLookAt.Z.ToString() + "]\n"; |
451 | //logResponse.SimAddress = "127.0.0.1"; //overwritten | 451 | //logResponse.SimAddress = "127.0.0.1"; //overwritten |
452 | //logResponse.SimPort = 0; //overwritten | 452 | //logResponse.SimPort = 0; //overwritten |
453 | logResponse.Message = this.GetMessage(); | 453 | logResponse.Message = this.GetMessage(); |
454 | 454 | ||
455 | try | 455 | try |
456 | { | 456 | { |
457 | this.CustomiseResponse( logResponse, userProfile); | 457 | this.CustomiseResponse( logResponse, userProfile); |
458 | } | 458 | } |
459 | catch (Exception e) | 459 | catch (Exception e) |
460 | { | 460 | { |
461 | System.Console.WriteLine(e.ToString()); | 461 | System.Console.WriteLine(e.ToString()); |
462 | return logResponse.CreateDeadRegionResponse(); | 462 | return logResponse.CreateDeadRegionResponse(); |
463 | //return logResponse.ToXmlRpcResponse(); | 463 | //return logResponse.ToXmlRpcResponse(); |
464 | } | 464 | } |
465 | CommitAgent(ref userProfile); | 465 | CommitAgent(ref userProfile); |
466 | return logResponse.ToXmlRpcResponse(); | 466 | return logResponse.ToXmlRpcResponse(); |
467 | 467 | ||
468 | } | 468 | } |
469 | 469 | ||
470 | catch (Exception E) | 470 | catch (Exception E) |
471 | { | 471 | { |
472 | System.Console.WriteLine(E.ToString()); | 472 | System.Console.WriteLine(E.ToString()); |
473 | } | 473 | } |
474 | //} | 474 | //} |
475 | } | 475 | } |
476 | return response; | 476 | return response; |
477 | 477 | ||
478 | } | 478 | } |
479 | 479 | ||
480 | #endregion | 480 | #endregion |
481 | 481 | ||
482 | /// <summary> | 482 | /// <summary> |
483 | /// Deletes an active agent session | 483 | /// Deletes an active agent session |
484 | /// </summary> | 484 | /// </summary> |
485 | /// <param name="request">The request</param> | 485 | /// <param name="request">The request</param> |
486 | /// <param name="path">The path (eg /bork/narf/test)</param> | 486 | /// <param name="path">The path (eg /bork/narf/test)</param> |
487 | /// <param name="param">Parameters sent</param> | 487 | /// <param name="param">Parameters sent</param> |
488 | /// <returns>Success "OK" else error</returns> | 488 | /// <returns>Success "OK" else error</returns> |
489 | public string RestDeleteUserSessionMethod(string request, string path, string param) | 489 | public string RestDeleteUserSessionMethod(string request, string path, string param) |
490 | { | 490 | { |
491 | // TODO! Important! | 491 | // TODO! Important! |
492 | 492 | ||
493 | return "OK"; | 493 | return "OK"; |
494 | } | 494 | } |
495 | 495 | ||
496 | /// <summary> | 496 | /// <summary> |
497 | /// | 497 | /// |
498 | /// </summary> | 498 | /// </summary> |
499 | /// <param name="user"></param> | 499 | /// <param name="user"></param> |
500 | public void AddUserProfile(string firstName, string lastName, string pass, uint regX, uint regY) | 500 | public void AddUserProfile(string firstName, string lastName, string pass, uint regX, uint regY) |
501 | { | 501 | { |
502 | UserProfileData user = new UserProfileData(); | 502 | UserProfileData user = new UserProfileData(); |
503 | user.homeLocation = new LLVector3(128, 128, 100); | 503 | user.homeLocation = new LLVector3(128, 128, 100); |
504 | user.UUID = LLUUID.Random(); | 504 | user.UUID = LLUUID.Random(); |
505 | user.username = firstName; | 505 | user.username = firstName; |
506 | user.surname = lastName; | 506 | user.surname = lastName; |
507 | user.passwordHash = pass; | 507 | user.passwordHash = pass; |
508 | user.passwordSalt = ""; | 508 | user.passwordSalt = ""; |
509 | user.created = Util.UnixTimeSinceEpoch(); | 509 | user.created = Util.UnixTimeSinceEpoch(); |
510 | user.homeLookAt = new LLVector3(100, 100, 100); | 510 | user.homeLookAt = new LLVector3(100, 100, 100); |
511 | user.homeRegion = Util.UIntsToLong((regX * 256), (regY * 256)); | 511 | user.homeRegion = Util.UIntsToLong((regX * 256), (regY * 256)); |
512 | 512 | ||
513 | foreach (KeyValuePair<string, IUserData> plugin in _plugins) | 513 | foreach (KeyValuePair<string, IUserData> plugin in _plugins) |
514 | { | 514 | { |
515 | try | 515 | try |
516 | { | 516 | { |
517 | plugin.Value.addNewUserProfile(user); | 517 | plugin.Value.addNewUserProfile(user); |
518 | 518 | ||
519 | } | 519 | } |
520 | catch (Exception e) | 520 | catch (Exception e) |
521 | { | 521 | { |
522 | MainLog.Instance.Verbose("Unable to add user via " + plugin.Key + "(" + e.ToString() + ")"); | 522 | MainLog.Instance.Verbose("Unable to add user via " + plugin.Key + "(" + e.ToString() + ")"); |
523 | } | 523 | } |
524 | } | 524 | } |
525 | } | 525 | } |
526 | 526 | ||
527 | /// <summary> | 527 | /// <summary> |
528 | /// Returns an error message that the user could not be found in the database | 528 | /// Returns an error message that the user could not be found in the database |
529 | /// </summary> | 529 | /// </summary> |
530 | /// <returns>XML string consisting of a error element containing individual error(s)</returns> | 530 | /// <returns>XML string consisting of a error element containing individual error(s)</returns> |
531 | public XmlRpcResponse CreateUnknownUserErrorResponse() | 531 | public XmlRpcResponse CreateUnknownUserErrorResponse() |
532 | { | 532 | { |
533 | XmlRpcResponse response = new XmlRpcResponse(); | 533 | XmlRpcResponse response = new XmlRpcResponse(); |
534 | Hashtable responseData = new Hashtable(); | 534 | Hashtable responseData = new Hashtable(); |
535 | responseData["error_type"] = "unknown_user"; | 535 | responseData["error_type"] = "unknown_user"; |
536 | responseData["error_desc"] = "The user requested is not in the database"; | 536 | responseData["error_desc"] = "The user requested is not in the database"; |
537 | 537 | ||
538 | response.Value = responseData; | 538 | response.Value = responseData; |
539 | return response; | 539 | return response; |
540 | } | 540 | } |
541 | 541 | ||
542 | /// <summary> | 542 | /// <summary> |
543 | /// Converts a user profile to an XML element which can be returned | 543 | /// Converts a user profile to an XML element which can be returned |
544 | /// </summary> | 544 | /// </summary> |
545 | /// <param name="profile">The user profile</param> | 545 | /// <param name="profile">The user profile</param> |
546 | /// <returns>A string containing an XML Document of the user profile</returns> | 546 | /// <returns>A string containing an XML Document of the user profile</returns> |
547 | public XmlRpcResponse ProfileToXmlRPCResponse(UserProfileData profile) | 547 | public XmlRpcResponse ProfileToXmlRPCResponse(UserProfileData profile) |
548 | { | 548 | { |
549 | XmlRpcResponse response = new XmlRpcResponse(); | 549 | XmlRpcResponse response = new XmlRpcResponse(); |
550 | Hashtable responseData = new Hashtable(); | 550 | Hashtable responseData = new Hashtable(); |
551 | 551 | ||
552 | // Account information | 552 | // Account information |
553 | responseData["firstname"] = profile.username; | 553 | responseData["firstname"] = profile.username; |
554 | responseData["lastname"] = profile.surname; | 554 | responseData["lastname"] = profile.surname; |
555 | responseData["uuid"] = profile.UUID.ToStringHyphenated(); | 555 | responseData["uuid"] = profile.UUID.ToStringHyphenated(); |
556 | // Server Information | 556 | // Server Information |
557 | responseData["server_inventory"] = profile.userInventoryURI; | 557 | responseData["server_inventory"] = profile.userInventoryURI; |
558 | responseData["server_asset"] = profile.userAssetURI; | 558 | responseData["server_asset"] = profile.userAssetURI; |
559 | // Profile Information | 559 | // Profile Information |
560 | responseData["profile_about"] = profile.profileAboutText; | 560 | responseData["profile_about"] = profile.profileAboutText; |
561 | responseData["profile_firstlife_about"] = profile.profileFirstText; | 561 | responseData["profile_firstlife_about"] = profile.profileFirstText; |
562 | responseData["profile_firstlife_image"] = profile.profileFirstImage.ToStringHyphenated(); | 562 | responseData["profile_firstlife_image"] = profile.profileFirstImage.ToStringHyphenated(); |
563 | responseData["profile_can_do"] = profile.profileCanDoMask.ToString(); | 563 | responseData["profile_can_do"] = profile.profileCanDoMask.ToString(); |
564 | responseData["profile_want_do"] = profile.profileWantDoMask.ToString(); | 564 | responseData["profile_want_do"] = profile.profileWantDoMask.ToString(); |
565 | responseData["profile_image"] = profile.profileImage.ToStringHyphenated(); | 565 | responseData["profile_image"] = profile.profileImage.ToStringHyphenated(); |
566 | responseData["profile_created"] = profile.created.ToString(); | 566 | responseData["profile_created"] = profile.created.ToString(); |
567 | responseData["profile_lastlogin"] = profile.lastLogin.ToString(); | 567 | responseData["profile_lastlogin"] = profile.lastLogin.ToString(); |
568 | // Home region information | 568 | // Home region information |
569 | responseData["home_coordinates_x"] = profile.homeLocation.X.ToString(); | 569 | responseData["home_coordinates_x"] = profile.homeLocation.X.ToString(); |
570 | responseData["home_coordinates_y"] = profile.homeLocation.Y.ToString(); | 570 | responseData["home_coordinates_y"] = profile.homeLocation.Y.ToString(); |
571 | responseData["home_coordinates_z"] = profile.homeLocation.Z.ToString(); | 571 | responseData["home_coordinates_z"] = profile.homeLocation.Z.ToString(); |
572 | 572 | ||
573 | responseData["home_region"] = profile.homeRegion.ToString(); | 573 | responseData["home_region"] = profile.homeRegion.ToString(); |
574 | 574 | ||
575 | responseData["home_look_x"] = profile.homeLookAt.X.ToString(); | 575 | responseData["home_look_x"] = profile.homeLookAt.X.ToString(); |
576 | responseData["home_look_y"] = profile.homeLookAt.Y.ToString(); | 576 | responseData["home_look_y"] = profile.homeLookAt.Y.ToString(); |
577 | responseData["home_look_z"] = profile.homeLookAt.Z.ToString(); | 577 | responseData["home_look_z"] = profile.homeLookAt.Z.ToString(); |
578 | response.Value = responseData; | 578 | response.Value = responseData; |
579 | 579 | ||
580 | return response; | 580 | return response; |
581 | } | 581 | } |
582 | 582 | ||
583 | #region XMLRPC User Methods | 583 | #region XMLRPC User Methods |
584 | //should most likely move out of here and into the grid's userserver sub class | 584 | //should most likely move out of here and into the grid's userserver sub class |
585 | public XmlRpcResponse XmlRPCGetUserMethodName(XmlRpcRequest request) | 585 | public XmlRpcResponse XmlRPCGetUserMethodName(XmlRpcRequest request) |
586 | { | 586 | { |
587 | XmlRpcResponse response = new XmlRpcResponse(); | 587 | XmlRpcResponse response = new XmlRpcResponse(); |
588 | Hashtable requestData = (Hashtable)request.Params[0]; | 588 | Hashtable requestData = (Hashtable)request.Params[0]; |
589 | UserProfileData userProfile; | 589 | UserProfileData userProfile; |
590 | if (requestData.Contains("avatar_name")) | 590 | if (requestData.Contains("avatar_name")) |
591 | { | 591 | { |
592 | userProfile = getUserProfile((string)requestData["avatar_name"]); | 592 | userProfile = getUserProfile((string)requestData["avatar_name"]); |
593 | if (userProfile == null) | 593 | if (userProfile == null) |
594 | { | 594 | { |
595 | return CreateUnknownUserErrorResponse(); | 595 | return CreateUnknownUserErrorResponse(); |
596 | } | 596 | } |
597 | } | 597 | } |
598 | else | 598 | else |
599 | { | 599 | { |
600 | return CreateUnknownUserErrorResponse(); | 600 | return CreateUnknownUserErrorResponse(); |
601 | } | 601 | } |
602 | 602 | ||
603 | return ProfileToXmlRPCResponse(userProfile); | 603 | return ProfileToXmlRPCResponse(userProfile); |
604 | } | 604 | } |
605 | 605 | ||
606 | public XmlRpcResponse XmlRPCGetUserMethodUUID(XmlRpcRequest request) | 606 | public XmlRpcResponse XmlRPCGetUserMethodUUID(XmlRpcRequest request) |
607 | { | 607 | { |
608 | XmlRpcResponse response = new XmlRpcResponse(); | 608 | XmlRpcResponse response = new XmlRpcResponse(); |
609 | Hashtable requestData = (Hashtable)request.Params[0]; | 609 | Hashtable requestData = (Hashtable)request.Params[0]; |
610 | UserProfileData userProfile; | 610 | UserProfileData userProfile; |
611 | System.Console.WriteLine("METHOD BY UUID CALLED"); | 611 | System.Console.WriteLine("METHOD BY UUID CALLED"); |
612 | if (requestData.Contains("avatar_uuid")) | 612 | if (requestData.Contains("avatar_uuid")) |
613 | { | 613 | { |
614 | userProfile = getUserProfile((LLUUID)requestData["avatar_uuid"]); | 614 | userProfile = getUserProfile((LLUUID)requestData["avatar_uuid"]); |
615 | if (userProfile == null) | 615 | if (userProfile == null) |
616 | { | 616 | { |
617 | return CreateUnknownUserErrorResponse(); | 617 | return CreateUnknownUserErrorResponse(); |
618 | } | 618 | } |
619 | } | 619 | } |
620 | else | 620 | else |
621 | { | 621 | { |
622 | return CreateUnknownUserErrorResponse(); | 622 | return CreateUnknownUserErrorResponse(); |
623 | } | 623 | } |
624 | 624 | ||
625 | 625 | ||
626 | return ProfileToXmlRPCResponse(userProfile); | 626 | return ProfileToXmlRPCResponse(userProfile); |
627 | } | 627 | } |
628 | #endregion | 628 | #endregion |
629 | 629 | ||
630 | } | 630 | } |
631 | } | 631 | } |