From d21e9c755f004d8fe03b11bc57b810dbd401435a Mon Sep 17 00:00:00 2001
From: Diva Canto
Date: Thu, 19 May 2011 16:54:46 -0700
Subject: HG Friends working to some extent: friendships offered and accepted
correctly handled. Friends list showing correct foreign names. TODO:
GrantRights.
---
OpenSim/Framework/AgentCircuitData.cs | 1 +
OpenSim/Framework/AssetBase.cs | 6 ++++
OpenSim/Framework/Util.cs | 61 +++++++++++++++++++++++++++++++++++
3 files changed, 68 insertions(+)
(limited to 'OpenSim/Framework')
diff --git a/OpenSim/Framework/AgentCircuitData.cs b/OpenSim/Framework/AgentCircuitData.cs
index dbd47d3..125910e 100644
--- a/OpenSim/Framework/AgentCircuitData.cs
+++ b/OpenSim/Framework/AgentCircuitData.cs
@@ -345,6 +345,7 @@ namespace OpenSim.Framework
}
}
}
+
}
diff --git a/OpenSim/Framework/AssetBase.cs b/OpenSim/Framework/AssetBase.cs
index 53d28be..5f68cda 100644
--- a/OpenSim/Framework/AssetBase.cs
+++ b/OpenSim/Framework/AssetBase.cs
@@ -215,6 +215,12 @@ namespace OpenSim.Framework
set { m_metadata.Temporary = value; }
}
+ public string CreatorID
+ {
+ get { return m_metadata.CreatorID; }
+ set { m_metadata.CreatorID = value; }
+ }
+
public AssetFlags Flags
{
get { return m_metadata.Flags; }
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
return (T)Enum.Parse(typeof(T), value); ;
}
#endregion
+
+ #region Universal User Identifiers
+ ///
+ ///
+ /// uuid[;endpoint[;name]]
+ ///
+ ///
+ ///
+ ///
+ public static bool ParseUniversalUserIdentifier(string value, out UUID uuid, out string url, out string firstname, out string lastname)
+ {
+ uuid = UUID.Zero; url = string.Empty; firstname = "Unknown"; lastname = "User";
+
+ string[] parts = value.Split(';');
+ if (parts.Length >= 1)
+ if (!UUID.TryParse(parts[0], out uuid))
+ return false;
+
+ if (parts.Length >= 2)
+ url = parts[1];
+
+ if (parts.Length >= 3)
+ {
+ string[] name = parts[2].Split();
+ if (name.Length == 2)
+ {
+ firstname = name[0];
+ lastname = name[1];
+ }
+ }
+
+ return true;
+ }
+
+ ///
+ ///
+ ///
+ ///
+ /// uuid[;endpoint[;name]]
+ public static string ProduceUserUniversalIdentifier(AgentCircuitData acircuit)
+ {
+ if (acircuit.ServiceURLs.ContainsKey("HomeURI"))
+ {
+ string agentsURI = acircuit.ServiceURLs["HomeURI"].ToString();
+ 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 (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;
+ }
+ else
+ return acircuit.AgentID.ToString();
+ }
+ #endregion
}
}
--
cgit v1.1