diff options
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 |