diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index 26b70708c5..ea1de80250 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs @@ -1758,26 +1758,26 @@ namespace OpenSim.Framework /// and negative every 24.9 days. Subtracts the passed value (previously fetched by /// 'EnvironmentTickCount()') and accounts for any wrapping. /// - /// - /// + /// + /// /// subtraction of passed prevValue from current Environment.TickCount - public static Int32 EnvironmentTickCountSubtract(Int32 newValue, Int32 prevValue) + public static Int32 EnvironmentTickCountSubtract(Int32 newValue, Int32 prevValue) { - Int32 diff = newValue - prevValue; + Int32 diff = newValue - prevValue; return (diff >= 0) ? diff : (diff + EnvironmentTickCountMask + 1); } - /// - /// Environment.TickCount is an int but it counts all 32 bits so it goes positive - /// and negative every 24.9 days. Subtracts the passed value (previously fetched by - /// 'EnvironmentTickCount()') and accounts for any wrapping. - /// - /// subtraction of passed prevValue from current Environment.TickCount - public static Int32 EnvironmentTickCountSubtract(Int32 prevValue) - { - return EnvironmentTickCountSubtract(EnvironmentTickCount(), prevValue); - } - + /// + /// Environment.TickCount is an int but it counts all 32 bits so it goes positive + /// and negative every 24.9 days. Subtracts the passed value (previously fetched by + /// 'EnvironmentTickCount()') and accounts for any wrapping. + /// + /// subtraction of passed prevValue from current Environment.TickCount + public static Int32 EnvironmentTickCountSubtract(Int32 prevValue) + { + return EnvironmentTickCountSubtract(EnvironmentTickCount(), prevValue); + } + // Returns value of Tick Count A - TickCount B accounting for wrapping of TickCount // Assumes both tcA and tcB came from previous calls to Util.EnvironmentTickCount(). // A positive return value indicates A occured later than B @@ -1940,12 +1940,12 @@ namespace OpenSim.Framework #region Universal User Identifiers /// /// - /// uuid[;endpoint[;first last[;secret]]] - /// the uuid part - /// the endpoint part (e.g. http://foo.com) - /// the first name part (e.g. Test) - /// the last name part (e.g User) - /// the secret part + /// uuid[;endpoint[;first last[;secret]]] + /// the uuid part + /// the endpoint part (e.g. http://foo.com) + /// the first name part (e.g. Test) + /// the last name part (e.g User) + /// the secret part public static bool ParseUniversalUserIdentifier(string value, out UUID uuid, out string url, out string firstname, out string lastname, out string secret) { uuid = UUID.Zero; url = string.Empty; firstname = "Unknown"; lastname = "User"; secret = string.Empty; @@ -1974,79 +1974,79 @@ namespace OpenSim.Framework } /// - /// Produces a universal (HG) system-facing identifier given the information + /// Produces a universal (HG) system-facing identifier given the information /// /// - /// uuid[;homeURI[;first last]] + /// uuid[;homeURI[;first last]] public static string ProduceUserUniversalIdentifier(AgentCircuitData acircuit) { if (acircuit.ServiceURLs.ContainsKey("HomeURI")) - return UniversalIdentifier(acircuit.AgentID, acircuit.firstname, acircuit.lastname, acircuit.ServiceURLs["HomeURI"].ToString()); - else - return acircuit.AgentID.ToString(); - } - - /// - /// Produces a universal (HG) system-facing identifier given the information - /// - /// UUID of the user - /// first name (e.g Test) - /// last name (e.g. User) - /// homeURI (e.g. http://foo.com) - /// a string of the form uuid[;homeURI[;first last]] - public static string UniversalIdentifier(UUID id, String firstName, String lastName, String homeURI) - { - string agentsURI = homeURI; - if (!agentsURI.EndsWith("/")) - agentsURI += "/"; - - // This is ugly, but there's no other way, given that the name is changed - // in the agent circuit data for foreigners - if (lastName.Contains("@")) - { - string agentsURI = acircuit.ServiceURLs["HomeURI"].ToString(); - if (!agentsURI.EndsWith("/")) - agentsURI += "/"; - string[] parts = firstName.Split(new char[] { '.' }); - if (parts.Length == 2) - return id.ToString() + ";" + agentsURI + ";" + parts[0] + " " + parts[1]; - } - return id.ToString() + ";" + agentsURI + ";" + firstName + " " + lastName; - - } + return UniversalIdentifier(acircuit.AgentID, acircuit.firstname, acircuit.lastname, acircuit.ServiceURLs["HomeURI"].ToString()); + else + return acircuit.AgentID.ToString(); + } - // This is ugly, but there's no other way, given that the name is changed - // in the agent circuit data for foreigners - if (acircuit.lastname.Contains("@")) - { - string[] parts = acircuit.firstname.Split(new char[] { '.' }); - if (parts.Length == 2) - return acircuit.AgentID.ToString() + ";" + agentsURI + ";" + parts[0] + " " + parts[1]; - } - return acircuit.AgentID.ToString() + ";" + agentsURI + ";" + acircuit.firstname + " " + acircuit.lastname; - /// - /// Produces a universal (HG) user-facing name given the information - /// - /// - /// - /// - /// string of the form first.last @foo.com or first last - public static string UniversalName(String firstName, String lastName, String homeURI) - { - Uri uri = null; - try - { - uri = new Uri(homeURI); + /// + /// Produces a universal (HG) system-facing identifier given the information + /// + /// UUID of the user + /// first name (e.g Test) + /// last name (e.g. User) + /// homeURI (e.g. http://foo.com) + /// a string of the form uuid[;homeURI[;first last]] + public static string UniversalIdentifier(UUID id, String firstName, String lastName, String homeURI) + { + string agentsURI = homeURI; + if (!agentsURI.EndsWith("/")) + agentsURI += "/"; + + // This is ugly, but there's no other way, given that the name is changed + // in the agent circuit data for foreigners + if (lastName.Contains("@")) + { + string agentsURI = acircuit.ServiceURLs["HomeURI"].ToString(); + if (!agentsURI.EndsWith("/")) + agentsURI += "/"; + string[] parts = firstName.Split(new char[] { '.' }); + if (parts.Length == 2) + return id.ToString() + ";" + agentsURI + ";" + parts[0] + " " + parts[1]; } - else - return acircuit.AgentID.ToString(); - } - catch (UriFormatException) - { - return firstName + " " + lastName; - } - return firstName + "." + lastName + " " + "@" + uri.Authority; - } + return id.ToString() + ";" + agentsURI + ";" + firstName + " " + lastName; + + } + + // This is ugly, but there's no other way, given that the name is changed + // in the agent circuit data for foreigners + if (acircuit.lastname.Contains("@")) + { + string[] parts = acircuit.firstname.Split(new char[] { '.' }); + if (parts.Length == 2) + return acircuit.AgentID.ToString() + ";" + agentsURI + ";" + parts[0] + " " + parts[1]; + } + return acircuit.AgentID.ToString() + ";" + agentsURI + ";" + acircuit.firstname + " " + acircuit.lastname; + /// + /// Produces a universal (HG) user-facing name given the information + /// + /// + /// + /// + /// string of the form first.last @foo.com or first last + public static string UniversalName(String firstName, String lastName, String homeURI) + { + Uri uri = null; + try + { + uri = new Uri(homeURI); + } + else + return acircuit.AgentID.ToString(); + } + catch (UriFormatException) + { + return firstName + " " + lastName; + } + return firstName + "." + lastName + " " + "@" + uri.Authority; + } #endregion } }