Line endings
parent
3fa51f66ec
commit
841b4232f6
|
@ -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.
|
||||
/// </summary>
|
||||
/// <param name="newValue"></param>
|
||||
/// <param name="prevValue"></param>
|
||||
/// <param name="newValue"></param>
|
||||
/// <param name="prevValue"></param>
|
||||
/// <returns>subtraction of passed prevValue from current Environment.TickCount</returns>
|
||||
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);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
/// <returns>subtraction of passed prevValue from current Environment.TickCount</returns>
|
||||
public static Int32 EnvironmentTickCountSubtract(Int32 prevValue)
|
||||
{
|
||||
return EnvironmentTickCountSubtract(EnvironmentTickCount(), prevValue);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
/// <returns>subtraction of passed prevValue from current Environment.TickCount</returns>
|
||||
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
|
||||
/// <summary>
|
||||
/// </summary>
|
||||
/// <param name="value">uuid[;endpoint[;first last[;secret]]]</param>
|
||||
/// <param name="uuid">the uuid part</param>
|
||||
/// <param name="url">the endpoint part (e.g. http://foo.com)</param>
|
||||
/// <param name="firstname">the first name part (e.g. Test)</param>
|
||||
/// <param name="lastname">the last name part (e.g User)</param>
|
||||
/// <param name="secret">the secret part</param>
|
||||
/// <param name="value">uuid[;endpoint[;first last[;secret]]]</param>
|
||||
/// <param name="uuid">the uuid part</param>
|
||||
/// <param name="url">the endpoint part (e.g. http://foo.com)</param>
|
||||
/// <param name="firstname">the first name part (e.g. Test)</param>
|
||||
/// <param name="lastname">the last name part (e.g User)</param>
|
||||
/// <param name="secret">the secret part</param>
|
||||
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
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Produces a universal (HG) system-facing identifier given the information
|
||||
/// Produces a universal (HG) system-facing identifier given the information
|
||||
/// </summary>
|
||||
/// <param name="acircuit"></param>
|
||||
/// <returns>uuid[;homeURI[;first last]]</returns>
|
||||
/// <returns>uuid[;homeURI[;first last]]</returns>
|
||||
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();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Produces a universal (HG) system-facing identifier given the information
|
||||
/// </summary>
|
||||
/// <param name="id">UUID of the user</param>
|
||||
/// <param name="firstName">first name (e.g Test)</param>
|
||||
/// <param name="lastName">last name (e.g. User)</param>
|
||||
/// <param name="homeURI">homeURI (e.g. http://foo.com)</param>
|
||||
/// <returns>a string of the form uuid[;homeURI[;first last]]</returns>
|
||||
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;
|
||||
/// <summary>
|
||||
/// Produces a universal (HG) user-facing name given the information
|
||||
/// </summary>
|
||||
/// <param name="firstName"></param>
|
||||
/// <param name="lastName"></param>
|
||||
/// <param name="homeURI"></param>
|
||||
/// <returns>string of the form first.last @foo.com or first last</returns>
|
||||
public static string UniversalName(String firstName, String lastName, String homeURI)
|
||||
{
|
||||
Uri uri = null;
|
||||
try
|
||||
{
|
||||
uri = new Uri(homeURI);
|
||||
/// <summary>
|
||||
/// Produces a universal (HG) system-facing identifier given the information
|
||||
/// </summary>
|
||||
/// <param name="id">UUID of the user</param>
|
||||
/// <param name="firstName">first name (e.g Test)</param>
|
||||
/// <param name="lastName">last name (e.g. User)</param>
|
||||
/// <param name="homeURI">homeURI (e.g. http://foo.com)</param>
|
||||
/// <returns>a string of the form uuid[;homeURI[;first last]]</returns>
|
||||
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;
|
||||
/// <summary>
|
||||
/// Produces a universal (HG) user-facing name given the information
|
||||
/// </summary>
|
||||
/// <param name="firstName"></param>
|
||||
/// <param name="lastName"></param>
|
||||
/// <param name="homeURI"></param>
|
||||
/// <returns>string of the form first.last @foo.com or first last</returns>
|
||||
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
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue