diff options
author | Oren Hurvitz | 2013-12-08 16:50:24 +0200 |
---|---|---|
committer | Oren Hurvitz | 2014-03-24 12:26:52 +0100 |
commit | 921f0052f43e0e4553e970a8d560c5635fcd3ca6 (patch) | |
tree | 10bc5c8041c355adaef139d6d23f6f62e95f6bdf /OpenSim/Framework | |
parent | Better error messages (diff) | |
download | opensim-SC-921f0052f43e0e4553e970a8d560c5635fcd3ca6.zip opensim-SC-921f0052f43e0e4553e970a8d560c5635fcd3ca6.tar.gz opensim-SC-921f0052f43e0e4553e970a8d560c5635fcd3ca6.tar.bz2 opensim-SC-921f0052f43e0e4553e970a8d560c5635fcd3ca6.tar.xz |
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
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r-- | OpenSim/Framework/Util.cs | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index efaed62..5805dc8 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs | |||
@@ -2288,6 +2288,38 @@ namespace OpenSim.Framework | |||
2288 | { | 2288 | { |
2289 | return str.Replace("_", "\\_").Replace("%", "\\%"); | 2289 | return str.Replace("_", "\\_").Replace("%", "\\%"); |
2290 | } | 2290 | } |
2291 | |||
2292 | /// <summary> | ||
2293 | /// Returns the name of the user's viewer. | ||
2294 | /// </summary> | ||
2295 | /// <remarks> | ||
2296 | /// This method handles two ways that viewers specify their name: | ||
2297 | /// 1. Viewer = "Firestorm-Release 4.4.2.34167", Channel = "(don't care)" -> "Firestorm-Release 4.4.2.34167" | ||
2298 | /// 2. Viewer = "4.5.1.38838", Channel = "Firestorm-Beta" -> "Firestorm-Beta 4.5.1.38838" | ||
2299 | /// </remarks> | ||
2300 | public static string GetViewerName(AgentCircuitData agent) | ||
2301 | { | ||
2302 | string name = agent.Viewer; | ||
2303 | if (name == null) | ||
2304 | name = ""; | ||
2305 | else | ||
2306 | name = name.Trim(); | ||
2307 | |||
2308 | // Check if 'Viewer' is just a version number. If it's *not*, then we | ||
2309 | // assume that it contains the real viewer name, and we return it. | ||
2310 | foreach (char c in name) | ||
2311 | { | ||
2312 | if (Char.IsLetter(c)) | ||
2313 | return name; | ||
2314 | } | ||
2315 | |||
2316 | // The 'Viewer' string contains just a version number. If there's anything in | ||
2317 | // 'Channel' then assume that it's the viewer name. | ||
2318 | if ((agent.Channel != null) && (agent.Channel.Length > 0)) | ||
2319 | name = agent.Channel.Trim() + " " + name; | ||
2320 | |||
2321 | return name; | ||
2322 | } | ||
2291 | } | 2323 | } |
2292 | 2324 | ||
2293 | public class DoubleQueue<T> where T:class | 2325 | public class DoubleQueue<T> where T:class |