Merge branch 'master' of git://opensimulator.org/git/opensim

user_profiles
Robert Adams 2013-05-21 15:31:13 -07:00
commit ece7b33a96
5 changed files with 207 additions and 63 deletions

View File

@ -2136,7 +2136,7 @@ namespace OpenSim.Framework
/// <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;
uuid = UUID.Zero; url = string.Empty; firstname = "Unknown"; lastname = "UserUPUUI"; secret = string.Empty;
string[] parts = value.Split(';');
if (parts.Length >= 1)

View File

@ -371,7 +371,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
foreach (string fid in outstanding)
{
UUID fromAgentID;
string firstname = "Unknown", lastname = "User";
string firstname = "Unknown", lastname = "UserFMSFOIN";
if (!GetAgentInfo(client.Scene.RegionInfo.ScopeID, fid, out fromAgentID, out firstname, out lastname))
{
m_log.DebugFormat("[FRIENDS MODULE]: skipping malformed friend {0}", fid);
@ -397,7 +397,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
protected virtual bool GetAgentInfo(UUID scopeID, string fid, out UUID agentID, out string first, out string last)
{
first = "Unknown"; last = "User";
first = "Unknown"; last = "UserFMGAI";
if (!UUID.TryParse(fid, out agentID))
return false;

View File

@ -293,7 +293,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
protected override bool GetAgentInfo(UUID scopeID, string fid, out UUID agentID, out string first, out string last)
{
first = "Unknown"; last = "User";
first = "Unknown"; last = "UserHGGAI";
if (base.GetAgentInfo(scopeID, fid, out agentID, out first, out last))
return true;

View File

@ -157,13 +157,16 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
}
else
{
string[] names = GetUserNames(uuid);
string[] names;
bool foundRealName = TryGetUserNames(uuid, out names);
if (names.Length == 2)
{
//m_log.DebugFormat("[XXX] HandleUUIDNameRequest {0} is {1} {2}", uuid, names[0], names[1]);
if (!foundRealName)
m_log.DebugFormat("[USER MANAGEMENT MODULE]: Sending {0} {1} for {2} to {3} since no bound name found", names[0], names[1], uuid, remote_client.Name);
remote_client.SendNameReply(uuid, names[0], names[1]);
}
}
}
@ -246,10 +249,15 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
}
// search the local cache
foreach (UserData data in m_UserCache.Values)
if (users.Find(delegate(UserData d) { return d.Id == data.Id; }) == null &&
(data.FirstName.ToLower().StartsWith(query.ToLower()) || data.LastName.ToLower().StartsWith(query.ToLower())))
users.Add(data);
lock (m_UserCache)
{
foreach (UserData data in m_UserCache.Values)
{
if (users.Find(delegate(UserData d) { return d.Id == data.Id; }) == null &&
(data.FirstName.ToLower().StartsWith(query.ToLower()) || data.LastName.ToLower().StartsWith(query.ToLower())))
users.Add(data);
}
}
AddAdditionalUsers(query, users);
@ -272,17 +280,24 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
}
}
private string[] GetUserNames(UUID uuid)
/// <summary>
/// Try to get the names bound to the given uuid.
/// </summary>
/// <returns>True if the name was found, false if not.</returns>
/// <param name='uuid'></param>
/// <param name='names'>The array of names if found. If not found, then names[0] = "Unknown" and names[1] = "User"</param>
private bool TryGetUserNames(UUID uuid, out string[] names)
{
string[] returnstring = new string[2];
names = new string[2];
lock (m_UserCache)
{
if (m_UserCache.ContainsKey(uuid))
{
returnstring[0] = m_UserCache[uuid].FirstName;
returnstring[1] = m_UserCache[uuid].LastName;
return returnstring;
names[0] = m_UserCache[uuid].FirstName;
names[1] = m_UserCache[uuid].LastName;
return true;
}
}
@ -290,8 +305,8 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
if (account != null)
{
returnstring[0] = account.FirstName;
returnstring[1] = account.LastName;
names[0] = account.FirstName;
names[1] = account.LastName;
UserData user = new UserData();
user.FirstName = account.FirstName;
@ -299,14 +314,16 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
lock (m_UserCache)
m_UserCache[uuid] = user;
return true;
}
else
{
returnstring[0] = "Unknown";
returnstring[1] = "User";
}
names[0] = "Unknown";
names[1] = "UserUMMTGUN";
return returnstring;
return false;
}
}
#region IUserManagement
@ -342,15 +359,17 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
public string GetUserName(UUID uuid)
{
string[] names = GetUserNames(uuid);
string[] names;
TryGetUserNames(uuid, out names);
if (names.Length == 2)
{
string firstname = names[0];
string lastname = names[1];
return firstname + " " + lastname;
}
return "(hippos)";
}
@ -466,12 +485,13 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
//ignore updates without creator data
return;
}
//try update unknown users
//and creator's home URL's
if ((oldUser.FirstName == "Unknown" && !creatorData.Contains ("Unknown")) || (oldUser.HomeURL != null && !creatorData.StartsWith (oldUser.HomeURL)))
{
m_UserCache.Remove (id);
// m_log.DebugFormat("[USER MANAGEMENT MODULE]: Re-adding user with id {0}, creatorData [{1}] and old HomeURL {2}", id, creatorData,oldUser.HomeURL);
m_log.DebugFormat("[USER MANAGEMENT MODULE]: Re-adding user with id {0}, creatorData [{1}] and old HomeURL {2}", id, creatorData, oldUser.HomeURL);
}
else
{
@ -516,7 +536,7 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
else
{
user.FirstName = "Unknown";
user.LastName = "User";
user.LastName = "UserUMMAU";
}
AddUserInternal (user);
@ -547,6 +567,13 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
protected void RegisterConsoleCmds()
{
MainConsole.Instance.Commands.AddCommand("Users", true,
"show name",
"show name <uuid>",
"Show the bindings between a single user UUID and a user name",
String.Empty,
HandleShowUser);
MainConsole.Instance.Commands.AddCommand("Users", true,
"show names",
"show names",
@ -555,26 +582,54 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
HandleShowUsers);
}
private void HandleShowUsers(string module, string[] cmd)
private void HandleShowUser(string module, string[] cmd)
{
lock (m_UserCache)
if (cmd.Length < 3)
{
if (m_UserCache.Count == 0)
{
MainConsole.Instance.Output("No users found");
return;
}
MainConsole.Instance.Output("UUID User Name");
MainConsole.Instance.Output("-----------------------------------------------------------------------------");
foreach (KeyValuePair<UUID, UserData> kvp in m_UserCache)
{
MainConsole.Instance.Output(String.Format("{0} {1} {2} ({3})",
kvp.Key, kvp.Value.FirstName, kvp.Value.LastName, kvp.Value.HomeURL));
}
MainConsole.Instance.OutputFormat("Usage: show name <uuid>");
return;
}
UUID userId;
if (!ConsoleUtil.TryParseConsoleUuid(MainConsole.Instance, cmd[2], out userId))
return;
string[] names;
UserData ud;
lock (m_UserCache)
{
if (!m_UserCache.TryGetValue(userId, out ud))
{
MainConsole.Instance.OutputFormat("No name known for user with id {0}", userId);
return;
}
}
ConsoleDisplayTable cdt = new ConsoleDisplayTable();
cdt.AddColumn("UUID", 36);
cdt.AddColumn("Name", 30);
cdt.AddColumn("HomeURL", 40);
cdt.AddRow(userId, string.Format("{0} {1}", ud.FirstName, ud.LastName), ud.HomeURL);
MainConsole.Instance.Output(cdt.ToString());
}
private void HandleShowUsers(string module, string[] cmd)
{
ConsoleDisplayTable cdt = new ConsoleDisplayTable();
cdt.AddColumn("UUID", 36);
cdt.AddColumn("Name", 30);
cdt.AddColumn("HomeURL", 40);
lock (m_UserCache)
{
foreach (KeyValuePair<UUID, UserData> kvp in m_UserCache)
cdt.AddRow(kvp.Key, string.Format("{0} {1}", kvp.Value.FirstName, kvp.Value.LastName), kvp.Value.HomeURL);
}
MainConsole.Instance.Output(cdt.ToString());
}
}
}

View File

@ -79,6 +79,8 @@ namespace OpenSim.Region.Physics.Meshing
private float minSizeForComplexMesh = 0.2f; // prims with all dimensions smaller than this will have a bounding box mesh
private List<List<Vector3>> mConvexHulls = null;
private Dictionary<ulong, Mesh> m_uniqueMeshes = new Dictionary<ulong, Mesh>();
public Meshmerizer(IConfigSource config)
@ -363,6 +365,57 @@ namespace OpenSim.Region.Physics.Meshing
else if (map.ContainsKey("high_lod"))
physicsParms = (OSDMap)map["high_lod"]; // if all else fails, use highest LOD display mesh and hope it works :)
if (map.ContainsKey("physics_convex"))
{ // pull this out also in case physics engine can use it
try
{
OSDMap convexBlock = (OSDMap)map["physics_convex"];
if (convexBlock.ContainsKey("HullList"))
{
byte[] hullList = convexBlock["HullList"].AsBinary();
Vector3 min = new Vector3(-0.5f, -0.5f, -0.5f);
if (convexBlock.ContainsKey("Min")) min = convexBlock["Min"].AsVector3();
Vector3 max = new Vector3(0.5f, 0.5f, 0.5f);
if (convexBlock.ContainsKey("Max")) max = convexBlock["Max"].AsVector3();
// decompress and decode hull points
byte[] posBytes = DecompressOsd(convexBlock["Positions"].AsBinary()).AsBinary();
List<List<Vector3>> hulls = new List<List<Vector3>>();
int posNdx = 0;
foreach (byte cnt in hullList)
{
int count = cnt == 0 ? 256 : cnt;
List<Vector3> hull = new List<Vector3>();
for (int i = 0; i < count; i++)
{
ushort uX = Utils.BytesToUInt16(posBytes, posNdx); posNdx += 2;
ushort uY = Utils.BytesToUInt16(posBytes, posNdx); posNdx += 2;
ushort uZ = Utils.BytesToUInt16(posBytes, posNdx); posNdx += 2;
Vector3 pos = new Vector3(
Utils.UInt16ToFloat(uX, min.X, max.X),
Utils.UInt16ToFloat(uY, min.Y, max.Y),
Utils.UInt16ToFloat(uZ, min.Z, max.Z)
);
hull.Add(pos);
}
hulls.Add(hull);
}
mConvexHulls = hulls;
}
}
catch (Exception e)
{
m_log.WarnFormat("[MESH]: exception decoding convex block: {0}", e.Message);
}
}
if (physicsParms == null)
{
m_log.WarnFormat("[MESH]: No recognized physics mesh found in mesh asset for {0}", primName);
@ -381,27 +434,7 @@ namespace OpenSim.Region.Physics.Meshing
// byte[] decompressed = new byte[physSize * 5];
try
{
using (MemoryStream inMs = new MemoryStream(meshBytes))
{
using (MemoryStream outMs = new MemoryStream())
{
using (ZOutputStream zOut = new ZOutputStream(outMs))
{
byte[] readBuffer = new byte[2048];
int readLen = 0;
while ((readLen = inMs.Read(readBuffer, 0, readBuffer.Length)) > 0)
{
zOut.Write(readBuffer, 0, readLen);
}
zOut.Flush();
outMs.Seek(0, SeekOrigin.Begin);
byte[] decompressedBuf = outMs.GetBuffer();
decodedMeshOsd = OSDParser.DeserializeLLSDBinary(decompressedBuf);
}
}
}
decodedMeshOsd = DecompressOsd(meshBytes);
}
catch (Exception e)
{
@ -428,6 +461,41 @@ namespace OpenSim.Region.Physics.Meshing
return true;
}
/// <summary>
/// decompresses a gzipped OSD object
/// </summary>
/// <param name="decodedOsd"></param> the OSD object
/// <param name="meshBytes"></param>
/// <returns></returns>
private static OSD DecompressOsd(byte[] meshBytes)
{
OSD decodedOsd = null;
using (MemoryStream inMs = new MemoryStream(meshBytes))
{
using (MemoryStream outMs = new MemoryStream())
{
using (ZOutputStream zOut = new ZOutputStream(outMs))
{
byte[] readBuffer = new byte[2048];
int readLen = 0;
while ((readLen = inMs.Read(readBuffer, 0, readBuffer.Length)) > 0)
{
zOut.Write(readBuffer, 0, readLen);
}
zOut.Flush();
outMs.Seek(0, SeekOrigin.Begin);
byte[] decompressedBuf = outMs.GetBuffer();
decodedOsd = OSDParser.DeserializeLLSDBinary(decompressedBuf);
}
}
}
return decodedOsd;
}
/// <summary>
/// Generate the co-ords and faces necessary to construct a mesh from the sculpt data the accompanies a prim.
/// </summary>
@ -704,6 +772,27 @@ namespace OpenSim.Region.Physics.Meshing
return true;
}
/// <summary>
/// temporary prototype code - please do not use until the interface has been finalized!
/// </summary>
/// <param name="size">value to scale the hull points by</param>
/// <returns>a list of hulls if they exist and have been successfully decoded, otherwise null</returns>
public List<List<Vector3>> GetConvexHulls(Vector3 size)
{
if (mConvexHulls == null)
return null;
List<List<Vector3>> hulls = new List<List<Vector3>>();
foreach (var hull in mConvexHulls)
{
List<Vector3> verts = new List<Vector3>();
foreach (var vert in hull)
verts.Add(vert * size);
}
return hulls;
}
public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod)
{
return CreateMesh(primName, primShape, size, lod, false, true);