aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Util.cs
diff options
context:
space:
mode:
authorDiva Canto2011-05-19 16:54:46 -0700
committerDiva Canto2011-05-19 16:54:46 -0700
commitd21e9c755f004d8fe03b11bc57b810dbd401435a (patch)
tree1efd9e48308192d21ca73d8ff12d6a48c186077c /OpenSim/Framework/Util.cs
parentAccidentally committed too early (diff)
downloadopensim-SC-d21e9c755f004d8fe03b11bc57b810dbd401435a.zip
opensim-SC-d21e9c755f004d8fe03b11bc57b810dbd401435a.tar.gz
opensim-SC-d21e9c755f004d8fe03b11bc57b810dbd401435a.tar.bz2
opensim-SC-d21e9c755f004d8fe03b11bc57b810dbd401435a.tar.xz
HG Friends working to some extent: friendships offered and accepted correctly handled. Friends list showing correct foreign names. TODO: GrantRights.
Diffstat (limited to 'OpenSim/Framework/Util.cs')
-rw-r--r--OpenSim/Framework/Util.cs61
1 files changed, 61 insertions, 0 deletions
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index aaa2724..af21cb5 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -1694,5 +1694,66 @@ namespace OpenSim.Framework
1694 return (T)Enum.Parse(typeof(T), value); ; 1694 return (T)Enum.Parse(typeof(T), value); ;
1695 } 1695 }
1696 #endregion 1696 #endregion
1697
1698 #region Universal User Identifiers
1699 /// <summary>
1700 /// </summary>
1701 /// <param name="value">uuid[;endpoint[;name]]</param>
1702 /// <param name="uuid"></param>
1703 /// <param name="url"></param>
1704 /// <param name="firstname"></param>
1705 /// <param name="lastname"></param>
1706 public static bool ParseUniversalUserIdentifier(string value, out UUID uuid, out string url, out string firstname, out string lastname)
1707 {
1708 uuid = UUID.Zero; url = string.Empty; firstname = "Unknown"; lastname = "User";
1709
1710 string[] parts = value.Split(';');
1711 if (parts.Length >= 1)
1712 if (!UUID.TryParse(parts[0], out uuid))
1713 return false;
1714
1715 if (parts.Length >= 2)
1716 url = parts[1];
1717
1718 if (parts.Length >= 3)
1719 {
1720 string[] name = parts[2].Split();
1721 if (name.Length == 2)
1722 {
1723 firstname = name[0];
1724 lastname = name[1];
1725 }
1726 }
1727
1728 return true;
1729 }
1730
1731 /// <summary>
1732 ///
1733 /// </summary>
1734 /// <param name="acircuit"></param>
1735 /// <returns>uuid[;endpoint[;name]]</returns>
1736 public static string ProduceUserUniversalIdentifier(AgentCircuitData acircuit)
1737 {
1738 if (acircuit.ServiceURLs.ContainsKey("HomeURI"))
1739 {
1740 string agentsURI = acircuit.ServiceURLs["HomeURI"].ToString();
1741 if (!agentsURI.EndsWith("/"))
1742 agentsURI += "/";
1743
1744 // This is ugly, but there's no other way, given that the name is changed
1745 // in the agent circuit data for foreigners
1746 if (acircuit.lastname.Contains("@"))
1747 {
1748 string[] parts = acircuit.firstname.Split(new char[] { '.' });
1749 if (parts.Length == 2)
1750 return acircuit.AgentID.ToString() + ";" + agentsURI + ";" + parts[0] + " " + parts[1];
1751 }
1752 return acircuit.AgentID.ToString() + ";" + agentsURI + ";" + acircuit.firstname + " " + acircuit.lastname;
1753 }
1754 else
1755 return acircuit.AgentID.ToString();
1756 }
1757 #endregion
1697 } 1758 }
1698} 1759}