From bf8b5844f24d294c459f54147bd511e7112288bf Mon Sep 17 00:00:00 2001 From: Jeff Ames Date: Tue, 18 Mar 2008 14:51:42 +0000 Subject: Formatting cleanup. Minor refactoring. --- OpenSim/Framework/Communications/LoginResponse.cs | 10 +++-- OpenSim/Framework/Communications/LoginService.cs | 7 +++- OpenSim/Framework/Data.DB4o/DB4oGridData.cs | 1 + OpenSim/Framework/Data.MSSQL/MSSQLGridData.cs | 7 +--- OpenSim/Framework/Data.MySQL/MySQLGridData.cs | 2 +- OpenSim/Framework/Data.SQLite/SQLiteGridData.cs | 7 +--- OpenSim/Framework/Data/RegionProfileData.cs | 9 +--- OpenSim/Framework/Util.cs | 50 ++++++++--------------- 8 files changed, 36 insertions(+), 57 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Communications/LoginResponse.cs b/OpenSim/Framework/Communications/LoginResponse.cs index a815662..4a31986 100644 --- a/OpenSim/Framework/Communications/LoginResponse.cs +++ b/OpenSim/Framework/Communications/LoginResponse.cs @@ -170,7 +170,6 @@ namespace OpenSim.Framework.UserManagement AddClassifiedCategory((Int32) 8, "Service"); AddClassifiedCategory((Int32) 9, "Personal"); - SessionID = LLUUID.Random(); SecureSessionID = LLUUID.Random(); AgentID = LLUUID.Random(); @@ -244,7 +243,10 @@ namespace OpenSim.Framework.UserManagement { return (GenerateFailureResponse("presence", - "You appear to be already logged in, if this is not the case please wait for your session to timeout, if this takes longer than a few minutes please contact the grid owner. Please wait 5 minutes if you are going to connect to a region nearby to the region you were at previously.", + "You appear to be already logged in. " + + "If this is not the case please wait for your session to timeout. " + + "If this takes longer than a few minutes please contact the grid owner. " + + "Please wait 5 minutes if you are going to connect to a region nearby to the region you were at previously.", "false")); } @@ -252,7 +254,9 @@ namespace OpenSim.Framework.UserManagement { return GenerateFailureResponseLLSD( "presence", - "You appear to be already logged in, if this is not the case please wait for your session to timeout, if this takes longer than a few minutes please contact the grid owner", + "You appear to be already logged in. " + + "If this is not the case please wait for your session to timeout. " + + "If this takes longer than a few minutes please contact the grid owner", "false"); } diff --git a/OpenSim/Framework/Communications/LoginService.cs b/OpenSim/Framework/Communications/LoginService.cs index 72b408b..be47258 100644 --- a/OpenSim/Framework/Communications/LoginService.cs +++ b/OpenSim/Framework/Communications/LoginService.cs @@ -121,6 +121,7 @@ namespace OpenSim.Framework.UserManagement return logResponse.CreateLoginFailedResponse(); } + if (requestData.Contains("passwd")) { string passwd = (string)requestData["passwd"]; @@ -494,8 +495,8 @@ namespace OpenSim.Framework.UserManagement } public string GetLoginForm(string firstname, string lastname, string location, string region, - string grid, string channel, string version, string lang, - string password, string errormessages) + string grid, string channel, string version, string lang, + string password, string errormessages) { // inject our values in the form at the markers @@ -522,6 +523,7 @@ namespace OpenSim.Framework.UserManagement loginform = loginform.Replace("[$lang]", lang); loginform = loginform.Replace("[$password]", password); loginform = loginform.Replace("[$errors]", errormessages); + return loginform; } @@ -588,6 +590,7 @@ namespace OpenSim.Framework.UserManagement responseString += ""; responseString += ""; responseString += ""; + return responseString; } diff --git a/OpenSim/Framework/Data.DB4o/DB4oGridData.cs b/OpenSim/Framework/Data.DB4o/DB4oGridData.cs index 999d4f8..9320ef9 100644 --- a/OpenSim/Framework/Data.DB4o/DB4oGridData.cs +++ b/OpenSim/Framework/Data.DB4o/DB4oGridData.cs @@ -103,6 +103,7 @@ namespace OpenSim.Framework.Data.DB4o throw new Exception("GetProfileByString Not supported in DB4oGridData"); //return null; } + /// /// Adds a new specified region to the database /// diff --git a/OpenSim/Framework/Data.MSSQL/MSSQLGridData.cs b/OpenSim/Framework/Data.MSSQL/MSSQLGridData.cs index 38a1d08..5a0f3f5 100644 --- a/OpenSim/Framework/Data.MSSQL/MSSQLGridData.cs +++ b/OpenSim/Framework/Data.MSSQL/MSSQLGridData.cs @@ -180,7 +180,6 @@ namespace OpenSim.Framework.Data.MSSQL return row; } - /// /// Returns a sim profile from it's Region name string /// @@ -222,7 +221,6 @@ namespace OpenSim.Framework.Data.MSSQL } } - /// /// Adds a new specified region to the database /// @@ -242,7 +240,7 @@ namespace OpenSim.Framework.Data.MSSQL System.Console.WriteLine("No regions found. Create new one."); } - if ( insertRegionRow(profile)) + if (insertRegionRow(profile)) { return DataResponse.RESPONSE_OK; } @@ -252,7 +250,6 @@ namespace OpenSim.Framework.Data.MSSQL } } - /// /// Creates a new region in the database /// @@ -324,7 +321,7 @@ namespace OpenSim.Framework.Data.MSSQL } /// - /// DEPRECIATED. Attempts to authenticate a region by comparing a shared secret. + /// DEPRECATED. Attempts to authenticate a region by comparing a shared secret. /// /// The UUID of the challenger /// The attempted regionHandle of the challenger diff --git a/OpenSim/Framework/Data.MySQL/MySQLGridData.cs b/OpenSim/Framework/Data.MySQL/MySQLGridData.cs index 3855d99..0cba9f0 100644 --- a/OpenSim/Framework/Data.MySQL/MySQLGridData.cs +++ b/OpenSim/Framework/Data.MySQL/MySQLGridData.cs @@ -331,7 +331,7 @@ namespace OpenSim.Framework.Data.MySQL } /// - /// DEPRECIATED. Attempts to authenticate a region by comparing a shared secret. + /// DEPRECATED. Attempts to authenticate a region by comparing a shared secret. /// /// The UUID of the challenger /// The attempted regionHandle of the challenger diff --git a/OpenSim/Framework/Data.SQLite/SQLiteGridData.cs b/OpenSim/Framework/Data.SQLite/SQLiteGridData.cs index 4d42f19..397ef82 100644 --- a/OpenSim/Framework/Data.SQLite/SQLiteGridData.cs +++ b/OpenSim/Framework/Data.SQLite/SQLiteGridData.cs @@ -114,13 +114,12 @@ namespace OpenSim.Framework.Data.SQLite /// /// Returns a sim profile from it's Region name string /// - /// The region name search query + /// The region name search query /// The sim profile public RegionProfileData GetProfileByString(string regionName) { if (regionName.Length > 2) { - Dictionary param = new Dictionary(); // Add % because this is a like query. param["?regionName"] = regionName + "%"; @@ -133,7 +132,6 @@ namespace OpenSim.Framework.Data.SQLite result.Dispose(); return row; - } else { @@ -142,7 +140,6 @@ namespace OpenSim.Framework.Data.SQLite } } - /// /// Returns a sim profile from it's UUID /// @@ -191,7 +188,7 @@ namespace OpenSim.Framework.Data.SQLite } /// - /// DEPRECIATED. Attempts to authenticate a region by comparing a shared secret. + /// DEPRECATED. Attempts to authenticate a region by comparing a shared secret. /// /// The UUID of the challenger /// The attempted regionHandle of the challenger diff --git a/OpenSim/Framework/Data/RegionProfileData.cs b/OpenSim/Framework/Data/RegionProfileData.cs index f736571..84713b4 100644 --- a/OpenSim/Framework/Data/RegionProfileData.cs +++ b/OpenSim/Framework/Data/RegionProfileData.cs @@ -56,7 +56,6 @@ namespace OpenSim.Framework.Data /// Coordinates of the region /// public uint regionLocX; - public uint regionLocY; public uint regionLocZ; // Reserved (round-robin, layers, etc) @@ -65,7 +64,6 @@ namespace OpenSim.Framework.Data /// /// Not very secure, needs improvement. public string regionSendKey = String.Empty; - public string regionRecvKey = String.Empty; public string regionSecret = String.Empty; @@ -78,7 +76,6 @@ namespace OpenSim.Framework.Data /// Information about the server that the region is currently hosted on /// public string serverIP = String.Empty; - public uint serverPort; public string serverURI = String.Empty; @@ -90,7 +87,6 @@ namespace OpenSim.Framework.Data /// Set of optional overrides. Can be used to create non-eulicidean spaces. /// public ulong regionNorthOverrideHandle; - public ulong regionSouthOverrideHandle; public ulong regionEastOverrideHandle; public ulong regionWestOverrideHandle; @@ -133,7 +129,6 @@ namespace OpenSim.Framework.Data /// public LLUUID originUUID; - /// /// Get Sim profile data from grid server when in grid mode /// @@ -184,7 +179,7 @@ namespace OpenSim.Framework.Data /// /// The sim profile. Null if there was a request failure public static RegionProfileData RequestSimProfileData(ulong region_handle, string gridserver_url, - string gridserver_sendkey, string gridserver_recvkey) + string gridserver_sendkey, string gridserver_recvkey) { Hashtable requestData = new Hashtable(); requestData["region_handle"] = region_handle.ToString(); @@ -226,7 +221,7 @@ namespace OpenSim.Framework.Data /// /// The sim profile. Null if there was a request failure public static RegionProfileData RequestSimProfileData(string regionName, string gridserver_url, - string gridserver_sendkey, string gridserver_recvkey) + string gridserver_sendkey, string gridserver_recvkey) { Hashtable requestData = new Hashtable(); requestData["region_name_search"] = regionName; diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index 37ddb3e..e16d15e 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs @@ -52,7 +52,6 @@ namespace OpenSim.Framework // Get a list of invalid file characters (OS dependent) private static string regexInvalidFileChars = "[" + new String(Path.GetInvalidFileNameChars()) + "]"; - #region Vector Equasions /// /// Get the distance between two 3d vectors @@ -106,6 +105,7 @@ namespace OpenSim.Framework return false; } + # endregion public static ulong UIntsToLong(uint X, uint Y) @@ -384,8 +384,6 @@ namespace OpenSim.Framework return System.Text.RegularExpressions.Regex.Replace(filename, @regexInvalidFileChars, string.Empty); ; } - - // // directory locations // @@ -411,23 +409,17 @@ namespace OpenSim.Framework public static string configDir() { - string temp; - temp = "."; - return temp; + return "."; } public static string dataDir() { - string temp; - temp = "."; - return temp; + return "."; } public static string logDir() { - string temp; - temp = "."; - return temp; + return "."; } public static string GetCapsURL(LLUUID userID) @@ -549,8 +541,8 @@ namespace OpenSim.Framework try { stream = new FileStream( - filename, FileMode.Create, - FileAccess.Write, FileShare.None); + filename, FileMode.Create, + FileAccess.Write, FileShare.None); formatter.Serialize(stream, obj); } @@ -577,8 +569,8 @@ namespace OpenSim.Framework try { stream = new FileStream( - filename, FileMode.Open, - FileAccess.Read, FileShare.None); + filename, FileMode.Open, + FileAccess.Read, FileShare.None); ret = formatter.Deserialize(stream); } @@ -597,6 +589,7 @@ namespace OpenSim.Framework return ret; } + public static string[] ParseStartLocationRequest(string startLocationRequest) { string[] returnstring = new string[4]; @@ -617,33 +610,22 @@ namespace OpenSim.Framework if (splitstr.GetLength(0) == 2) { - string[] splitstr2 = splitstr[1].Split('&');//, 4, StringSplitOptions.RemoveEmptyEntries); //System.Console.WriteLine("Found " + splitstr2.GetLength(0) + " elements in 2nd split result"); - if (splitstr2.GetLength(0) >= 1) - { - returnstring[0] = splitstr2[0]; - } - if (splitstr2.GetLength(0) >= 2) - { - returnstring[1] = splitstr2[1]; - } - if (splitstr2.GetLength(0) >= 3) - { - returnstring[2] = splitstr2[2]; - } - if (splitstr2.GetLength(0) >= 4) + int len = Math.Min(splitstr2.GetLength(0), 4); + + for (int i = 0; i < 4; ++i) { - returnstring[3] = splitstr2[3]; + if (len > i) + { + returnstring[i] = splitstr2[i]; + } } } - } return returnstring; - - } } } -- cgit v1.1