diff options
author | lbsa71 | 2007-10-30 09:05:31 +0000 |
---|---|---|
committer | lbsa71 | 2007-10-30 09:05:31 +0000 |
commit | 67e12b95ea7b68f4904a7484d77ecfd787d16d0c (patch) | |
tree | 20b00d24c8a7617017960432ec044852e3ad5fa9 /OpenSim/Framework/Communications/UserManagerBase.cs | |
parent | * Deleted .user file (diff) | |
download | opensim-SC-67e12b95ea7b68f4904a7484d77ecfd787d16d0c.zip opensim-SC-67e12b95ea7b68f4904a7484d77ecfd787d16d0c.tar.gz opensim-SC-67e12b95ea7b68f4904a7484d77ecfd787d16d0c.tar.bz2 opensim-SC-67e12b95ea7b68f4904a7484d77ecfd787d16d0c.tar.xz |
* Optimized usings
* Shortened type references
* Removed redundant 'this' qualifier
Diffstat (limited to 'OpenSim/Framework/Communications/UserManagerBase.cs')
-rw-r--r-- | OpenSim/Framework/Communications/UserManagerBase.cs | 49 |
1 files changed, 25 insertions, 24 deletions
diff --git a/OpenSim/Framework/Communications/UserManagerBase.cs b/OpenSim/Framework/Communications/UserManagerBase.cs index 006c8ee..cdc3baf 100644 --- a/OpenSim/Framework/Communications/UserManagerBase.cs +++ b/OpenSim/Framework/Communications/UserManagerBase.cs | |||
@@ -33,18 +33,15 @@ using System.Reflection; | |||
33 | using System.Security.Cryptography; | 33 | using System.Security.Cryptography; |
34 | using libsecondlife; | 34 | using libsecondlife; |
35 | using Nwc.XmlRpc; | 35 | using Nwc.XmlRpc; |
36 | using OpenSim.Framework; | ||
37 | using OpenSim.Framework.Console; | 36 | using OpenSim.Framework.Console; |
38 | using OpenSim.Framework.Data; | ||
39 | using OpenSim.Framework.Interfaces; | 37 | using OpenSim.Framework.Interfaces; |
40 | 38 | ||
41 | |||
42 | namespace OpenSim.Framework.UserManagement | 39 | namespace OpenSim.Framework.UserManagement |
43 | { | 40 | { |
44 | public abstract class UserManagerBase : IUserService | 41 | public abstract class UserManagerBase : IUserService |
45 | { | 42 | { |
46 | public UserConfig _config; | 43 | public UserConfig _config; |
47 | Dictionary<string, IUserData> _plugins = new Dictionary<string, IUserData>(); | 44 | private Dictionary<string, IUserData> _plugins = new Dictionary<string, IUserData>(); |
48 | 45 | ||
49 | /// <summary> | 46 | /// <summary> |
50 | /// Adds a new user server plugin - user servers will be requested in the order they were loaded. | 47 | /// Adds a new user server plugin - user servers will be requested in the order they were loaded. |
@@ -78,11 +75,12 @@ namespace OpenSim.Framework.UserManagement | |||
78 | public void AddPlugin(IUserData plug) | 75 | public void AddPlugin(IUserData plug) |
79 | { | 76 | { |
80 | plug.Initialise(); | 77 | plug.Initialise(); |
81 | this._plugins.Add(plug.getName(), plug); | 78 | _plugins.Add(plug.getName(), plug); |
82 | MainLog.Instance.Verbose( "Userstorage: Added IUserData Interface"); | 79 | MainLog.Instance.Verbose("Userstorage: Added IUserData Interface"); |
83 | } | 80 | } |
84 | 81 | ||
85 | #region Get UserProfile | 82 | #region Get UserProfile |
83 | |||
86 | /// <summary> | 84 | /// <summary> |
87 | /// Loads a user profile from a database by UUID | 85 | /// Loads a user profile from a database by UUID |
88 | /// </summary> | 86 | /// </summary> |
@@ -100,7 +98,7 @@ namespace OpenSim.Framework.UserManagement | |||
100 | } | 98 | } |
101 | catch (Exception e) | 99 | catch (Exception e) |
102 | { | 100 | { |
103 | MainLog.Instance.Verbose( "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); | 101 | MainLog.Instance.Verbose("Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); |
104 | } | 102 | } |
105 | } | 103 | } |
106 | 104 | ||
@@ -126,7 +124,7 @@ namespace OpenSim.Framework.UserManagement | |||
126 | catch (Exception e) | 124 | catch (Exception e) |
127 | { | 125 | { |
128 | System.Console.WriteLine("EEK!"); | 126 | System.Console.WriteLine("EEK!"); |
129 | MainLog.Instance.Verbose( "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); | 127 | MainLog.Instance.Verbose("Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); |
130 | } | 128 | } |
131 | } | 129 | } |
132 | 130 | ||
@@ -145,7 +143,7 @@ namespace OpenSim.Framework.UserManagement | |||
145 | { | 143 | { |
146 | try | 144 | try |
147 | { | 145 | { |
148 | UserProfileData profile = plugin.Value.GetUserByName(fname,lname); | 146 | UserProfileData profile = plugin.Value.GetUserByName(fname, lname); |
149 | 147 | ||
150 | profile.currentAgent = getUserAgent(profile.UUID); | 148 | profile.currentAgent = getUserAgent(profile.UUID); |
151 | 149 | ||
@@ -153,7 +151,7 @@ namespace OpenSim.Framework.UserManagement | |||
153 | } | 151 | } |
154 | catch (Exception e) | 152 | catch (Exception e) |
155 | { | 153 | { |
156 | MainLog.Instance.Verbose( "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); | 154 | MainLog.Instance.Verbose("Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); |
157 | } | 155 | } |
158 | } | 156 | } |
159 | 157 | ||
@@ -170,20 +168,24 @@ namespace OpenSim.Framework.UserManagement | |||
170 | { | 168 | { |
171 | foreach (KeyValuePair<string, IUserData> plugin in _plugins) | 169 | foreach (KeyValuePair<string, IUserData> plugin in _plugins) |
172 | { | 170 | { |
173 | try { | 171 | try |
172 | { | ||
174 | plugin.Value.UpdateUserProfile(data); | 173 | plugin.Value.UpdateUserProfile(data); |
175 | return true; | 174 | return true; |
176 | } catch (Exception e) { | 175 | } |
177 | MainLog.Instance.Verbose( "Unable to set user via " + plugin.Key + "(" + e.ToString() + ")"); | 176 | catch (Exception e) |
177 | { | ||
178 | MainLog.Instance.Verbose("Unable to set user via " + plugin.Key + "(" + e.ToString() + ")"); | ||
178 | } | 179 | } |
179 | } | 180 | } |
180 | 181 | ||
181 | return false; | 182 | return false; |
182 | } | 183 | } |
183 | 184 | ||
184 | #endregion | 185 | #endregion |
185 | 186 | ||
186 | #region Get UserAgent | 187 | #region Get UserAgent |
188 | |||
187 | /// <summary> | 189 | /// <summary> |
188 | /// Loads a user agent by uuid (not called directly) | 190 | /// Loads a user agent by uuid (not called directly) |
189 | /// </summary> | 191 | /// </summary> |
@@ -199,7 +201,7 @@ namespace OpenSim.Framework.UserManagement | |||
199 | } | 201 | } |
200 | catch (Exception e) | 202 | catch (Exception e) |
201 | { | 203 | { |
202 | MainLog.Instance.Verbose( "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); | 204 | MainLog.Instance.Verbose("Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); |
203 | } | 205 | } |
204 | } | 206 | } |
205 | 207 | ||
@@ -221,7 +223,7 @@ namespace OpenSim.Framework.UserManagement | |||
221 | } | 223 | } |
222 | catch (Exception e) | 224 | catch (Exception e) |
223 | { | 225 | { |
224 | MainLog.Instance.Verbose( "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); | 226 | MainLog.Instance.Verbose("Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); |
225 | } | 227 | } |
226 | } | 228 | } |
227 | 229 | ||
@@ -249,11 +251,11 @@ namespace OpenSim.Framework.UserManagement | |||
249 | { | 251 | { |
250 | try | 252 | try |
251 | { | 253 | { |
252 | return plugin.Value.GetAgentByName(fname,lname); | 254 | return plugin.Value.GetAgentByName(fname, lname); |
253 | } | 255 | } |
254 | catch (Exception e) | 256 | catch (Exception e) |
255 | { | 257 | { |
256 | MainLog.Instance.Verbose( "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); | 258 | MainLog.Instance.Verbose("Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); |
257 | } | 259 | } |
258 | } | 260 | } |
259 | 261 | ||
@@ -263,6 +265,7 @@ namespace OpenSim.Framework.UserManagement | |||
263 | #endregion | 265 | #endregion |
264 | 266 | ||
265 | #region CreateAgent | 267 | #region CreateAgent |
268 | |||
266 | /// <summary> | 269 | /// <summary> |
267 | /// Creates and initialises a new user agent - make sure to use CommitAgent when done to submit to the DB | 270 | /// Creates and initialises a new user agent - make sure to use CommitAgent when done to submit to the DB |
268 | /// </summary> | 271 | /// </summary> |
@@ -270,7 +273,7 @@ namespace OpenSim.Framework.UserManagement | |||
270 | /// <param name="request">The users loginrequest</param> | 273 | /// <param name="request">The users loginrequest</param> |
271 | public void CreateAgent(UserProfileData profile, XmlRpcRequest request) | 274 | public void CreateAgent(UserProfileData profile, XmlRpcRequest request) |
272 | { | 275 | { |
273 | Hashtable requestData = (Hashtable)request.Params[0]; | 276 | Hashtable requestData = (Hashtable) request.Params[0]; |
274 | 277 | ||
275 | UserAgentData agent = new UserAgentData(); | 278 | UserAgentData agent = new UserAgentData(); |
276 | 279 | ||
@@ -297,7 +300,7 @@ namespace OpenSim.Framework.UserManagement | |||
297 | // If user specified additional start, use that | 300 | // If user specified additional start, use that |
298 | if (requestData.ContainsKey("start")) | 301 | if (requestData.ContainsKey("start")) |
299 | { | 302 | { |
300 | string startLoc = ((string)requestData["start"]).Trim(); | 303 | string startLoc = ((string) requestData["start"]).Trim(); |
301 | if (!(startLoc == "last" || startLoc == "home")) | 304 | if (!(startLoc == "last" || startLoc == "home")) |
302 | { | 305 | { |
303 | // Format: uri:Ahern&162&213&34 | 306 | // Format: uri:Ahern&162&213&34 |
@@ -312,7 +315,6 @@ namespace OpenSim.Framework.UserManagement | |||
312 | } | 315 | } |
313 | catch (Exception) | 316 | catch (Exception) |
314 | { | 317 | { |
315 | |||
316 | } | 318 | } |
317 | } | 319 | } |
318 | } | 320 | } |
@@ -323,7 +325,7 @@ namespace OpenSim.Framework.UserManagement | |||
323 | 325 | ||
324 | // Current location | 326 | // Current location |
325 | agent.regionID = new LLUUID(); // Fill in later | 327 | agent.regionID = new LLUUID(); // Fill in later |
326 | agent.currentRegion = new LLUUID(); // Fill in later | 328 | agent.currentRegion = new LLUUID(); // Fill in later |
327 | 329 | ||
328 | profile.currentAgent = agent; | 330 | profile.currentAgent = agent; |
329 | } | 331 | } |
@@ -364,7 +366,6 @@ namespace OpenSim.Framework.UserManagement | |||
364 | try | 366 | try |
365 | { | 367 | { |
366 | plugin.Value.AddNewUserProfile(user); | 368 | plugin.Value.AddNewUserProfile(user); |
367 | |||
368 | } | 369 | } |
369 | catch (Exception e) | 370 | catch (Exception e) |
370 | { | 371 | { |
@@ -376,4 +377,4 @@ namespace OpenSim.Framework.UserManagement | |||
376 | public abstract UserProfileData SetupMasterUser(string firstName, string lastName); | 377 | public abstract UserProfileData SetupMasterUser(string firstName, string lastName); |
377 | public abstract UserProfileData SetupMasterUser(string firstName, string lastName, string password); | 378 | public abstract UserProfileData SetupMasterUser(string firstName, string lastName, string password); |
378 | } | 379 | } |
379 | } | 380 | } \ No newline at end of file |