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