From 5e805656db1215518a344d6d5364629a4997fd47 Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Sun, 1 Jul 2007 13:17:27 +0000 Subject: Fixed SimpleApp - aka thankgoditssundaycommit * Updated SimpleApp with various introduced dependencies * Extracted ScenePrescence creation in Scene * removed try-catchall from UserManagerBase (that actually hid a bug) * Refactored RegionInfo * handle is calculated * it will explode upon accessing x,y,ip,port,externalip if not explicitly initialized * Removed superfluous 'ref' keywords * Removed a shitload of 'catch Exception e' that causes build warnings * Lots of small refactorings, renames et c * Ignored some bins --- .../OpenSim.Framework.UserManagement.csproj | 4 +- .../OpenSim.Framework.UserManagement.dll.build | 2 +- OpenSim/Framework/UserManager/UserManagerBase.cs | 60 +++++++++------------- 3 files changed, 28 insertions(+), 38 deletions(-) (limited to 'OpenSim/Framework/UserManager') diff --git a/OpenSim/Framework/UserManager/OpenSim.Framework.UserManagement.csproj b/OpenSim/Framework/UserManager/OpenSim.Framework.UserManagement.csproj index 60c4b2f..02aa3f3 100644 --- a/OpenSim/Framework/UserManager/OpenSim.Framework.UserManagement.csproj +++ b/OpenSim/Framework/UserManager/OpenSim.Framework.UserManagement.csproj @@ -108,10 +108,10 @@ - + Code - + Code diff --git a/OpenSim/Framework/UserManager/OpenSim.Framework.UserManagement.dll.build b/OpenSim/Framework/UserManager/OpenSim.Framework.UserManagement.dll.build index ced9276..3ea339b 100644 --- a/OpenSim/Framework/UserManager/OpenSim.Framework.UserManagement.dll.build +++ b/OpenSim/Framework/UserManager/OpenSim.Framework.UserManagement.dll.build @@ -11,8 +11,8 @@ - + diff --git a/OpenSim/Framework/UserManager/UserManagerBase.cs b/OpenSim/Framework/UserManager/UserManagerBase.cs index d06059e..560752e 100644 --- a/OpenSim/Framework/UserManager/UserManagerBase.cs +++ b/OpenSim/Framework/UserManager/UserManagerBase.cs @@ -43,7 +43,7 @@ using System.Security.Cryptography; namespace OpenSim.Framework.UserManagement { - public class UserManagerBase + public abstract class UserManagerBase { public OpenSim.Framework.Interfaces.UserConfig _config; Dictionary _plugins = new Dictionary(); @@ -142,14 +142,9 @@ namespace OpenSim.Framework.UserManagement try { UserProfileData profile = plugin.Value.getUserByName(fname,lname); - try - { - profile.currentAgent = getUserAgent(profile.UUID); - } - catch (Exception e) - { - // Ignore - } + + profile.currentAgent = getUserAgent(profile.UUID); + return profile; } catch (Exception e) @@ -238,16 +233,14 @@ namespace OpenSim.Framework.UserManagement /// /// The users profile /// The users loginrequest - public void CreateAgent(ref UserProfileData profile, XmlRpcRequest request) + public void CreateAgent(UserProfileData profile, XmlRpcRequest request) { Hashtable requestData = (Hashtable)request.Params[0]; UserAgentData agent = new UserAgentData(); // User connection - agent.agentIP = ""; agent.agentOnline = true; - agent.agentPort = 0; // Generate sessions RNGCryptoServiceProvider rand = new RNGCryptoServiceProvider(); @@ -282,7 +275,7 @@ namespace OpenSim.Framework.UserManagement //SimProfile SimInfo = new SimProfile(); //SimInfo = SimInfo.LoadFromGrid(theUser.currentAgent.currentHandle, _config.GridServerURL, _config.GridSendKey, _config.GridRecvKey); } - catch (Exception e) + catch (Exception) { } @@ -319,7 +312,7 @@ namespace OpenSim.Framework.UserManagement /// The users profile /// The supplied password /// Authenticated? - public virtual bool AuthenticateUser(ref UserProfileData profile, string password) + public virtual bool AuthenticateUser(UserProfileData profile, string password) { OpenSim.Framework.Console.MainLog.Instance.Verbose( "Authenticating " + profile.username + " " + profile.surname); @@ -358,10 +351,7 @@ namespace OpenSim.Framework.UserManagement /// /// The existing response /// The user profile - public virtual void CustomiseResponse(ref LoginResponse response, ref UserProfileData theUser) - { - - } + public abstract void CustomiseResponse( LoginResponse response, UserProfileData theUser); /// /// Main user login function @@ -379,7 +369,7 @@ namespace OpenSim.Framework.UserManagement string lastname = ""; string passwd = ""; - UserProfileData TheUser; + UserProfileData userProfile; LoginResponse logResponse = new LoginResponse(); if (GoodXML) @@ -388,11 +378,11 @@ namespace OpenSim.Framework.UserManagement lastname = (string)requestData["last"]; passwd = (string)requestData["passwd"]; - TheUser = GetTheUser(firstname, lastname); - if (TheUser == null) + userProfile = GetTheUser(firstname, lastname); + if (userProfile == null) return logResponse.CreateLoginFailedResponse(); - GoodLogin = AuthenticateUser(ref TheUser, passwd); + GoodLogin = AuthenticateUser(userProfile, passwd); } else { @@ -406,19 +396,19 @@ namespace OpenSim.Framework.UserManagement else { // If we already have a session... - if (TheUser.currentAgent != null && TheUser.currentAgent.agentOnline) + if (userProfile.currentAgent != null && userProfile.currentAgent.agentOnline) { // Reject the login return logResponse.CreateAlreadyLoggedInResponse(); } // Otherwise... // Create a new agent session - CreateAgent(ref TheUser, request); + CreateAgent( userProfile, request); try { - LLUUID AgentID = TheUser.UUID; + LLUUID AgentID = userProfile.UUID; // Inventory Library Section ArrayList AgentInventoryArray = new ArrayList(); @@ -446,32 +436,32 @@ namespace OpenSim.Framework.UserManagement // Circuit Code uint circode = (uint)(Util.RandomClass.Next()); - logResponse.Lastname = TheUser.surname; - logResponse.Firstname = TheUser.username; + logResponse.Lastname = userProfile.surname; + logResponse.Firstname = userProfile.username; logResponse.AgentID = AgentID.ToStringHyphenated(); - logResponse.SessionID = TheUser.currentAgent.sessionID.ToStringHyphenated(); - logResponse.SecureSessionID = TheUser.currentAgent.secureSessionID.ToStringHyphenated(); + logResponse.SessionID = userProfile.currentAgent.sessionID.ToStringHyphenated(); + logResponse.SecureSessionID = userProfile.currentAgent.secureSessionID.ToStringHyphenated(); logResponse.InventoryRoot = InventoryRoot; logResponse.InventorySkeleton = AgentInventoryArray; logResponse.CircuitCode = (Int32)circode; - logResponse.RegionX = 0; //overwritten - logResponse.RegionY = 0; //overwritten + //logResponse.RegionX = 0; //overwritten + //logResponse.RegionY = 0; //overwritten logResponse.Home = "!!null temporary value {home}!!"; // Overwritten //logResponse.LookAt = "\n[r" + TheUser.homeLookAt.X.ToString() + ",r" + TheUser.homeLookAt.Y.ToString() + ",r" + TheUser.homeLookAt.Z.ToString() + "]\n"; - logResponse.SimAddress = "127.0.0.1"; //overwritten - logResponse.SimPort = 0; //overwritten + //logResponse.SimAddress = "127.0.0.1"; //overwritten + //logResponse.SimPort = 0; //overwritten logResponse.Message = this.GetMessage(); try { - this.CustomiseResponse(ref logResponse, ref TheUser); + this.CustomiseResponse( logResponse, userProfile); } catch (Exception e) { System.Console.WriteLine(e.ToString()); return logResponse.CreateDeadRegionResponse(); } - CommitAgent(ref TheUser); + CommitAgent(ref userProfile); return logResponse.ToXmlRpcResponse(); } -- cgit v1.1