mirror of
https://github.com/opensim/opensim.git
synced 2026-08-07 01:35:46 +08:00
Get the full viewer name even if it's (incorrectly) sent in the 'Channel' field
Recent versions of Firestorm and Singularity have started sending the viewer name in the 'Channel' field, leaving only their version number in the 'Viewer' field. So we need to search both of these fields for the viewer name. This resolves http://opensimulator.org/mantis/view.php?id=6952
This commit is contained in:
@@ -2288,6 +2288,38 @@ namespace OpenSim.Framework
|
||||
{
|
||||
return str.Replace("_", "\\_").Replace("%", "\\%");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the name of the user's viewer.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This method handles two ways that viewers specify their name:
|
||||
/// 1. Viewer = "Firestorm-Release 4.4.2.34167", Channel = "(don't care)" -> "Firestorm-Release 4.4.2.34167"
|
||||
/// 2. Viewer = "4.5.1.38838", Channel = "Firestorm-Beta" -> "Firestorm-Beta 4.5.1.38838"
|
||||
/// </remarks>
|
||||
public static string GetViewerName(AgentCircuitData agent)
|
||||
{
|
||||
string name = agent.Viewer;
|
||||
if (name == null)
|
||||
name = "";
|
||||
else
|
||||
name = name.Trim();
|
||||
|
||||
// Check if 'Viewer' is just a version number. If it's *not*, then we
|
||||
// assume that it contains the real viewer name, and we return it.
|
||||
foreach (char c in name)
|
||||
{
|
||||
if (Char.IsLetter(c))
|
||||
return name;
|
||||
}
|
||||
|
||||
// The 'Viewer' string contains just a version number. If there's anything in
|
||||
// 'Channel' then assume that it's the viewer name.
|
||||
if ((agent.Channel != null) && (agent.Channel.Length > 0))
|
||||
name = agent.Channel.Trim() + " " + name;
|
||||
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
||||
public class DoubleQueue<T> where T:class
|
||||
|
||||
Reference in New Issue
Block a user