From 921f0052f43e0e4553e970a8d560c5635fcd3ca6 Mon Sep 17 00:00:00 2001
From: Oren Hurvitz
Date: Sun, 8 Dec 2013 16:50:24 +0200
Subject: 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
---
OpenSim/Framework/Util.cs | 32 ++++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+)
(limited to 'OpenSim/Framework/Util.cs')
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
{
return str.Replace("_", "\\_").Replace("%", "\\%");
}
+
+ ///
+ /// Returns the name of the user's viewer.
+ ///
+ ///
+ /// 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"
+ ///
+ 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 where T:class
--
cgit v1.1
From 89945f8829dcc1ee889aad1bafd1d6c2938a6cc7 Mon Sep 17 00:00:00 2001
From: Oren Hurvitz
Date: Thu, 31 Oct 2013 13:02:57 +0200
Subject: Refactored: ExternalRepresentationUtils should be the only place
where the "CreatorData" field is calculated, to ensure uniformity
Resolves http://opensimulator.org/mantis/view.php?id=6933
---
OpenSim/Framework/Util.cs | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
(limited to 'OpenSim/Framework/Util.cs')
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index 5805dc8..c2c9698 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -2250,10 +2250,15 @@ namespace OpenSim.Framework
{
string[] parts = firstName.Split(new char[] { '.' });
if (parts.Length == 2)
- return id.ToString() + ";" + agentsURI + ";" + parts[0] + " " + parts[1];
+ return CalcUniversalIdentifier(id, agentsURI, parts[0] + " " + parts[1]);
}
- return id.ToString() + ";" + agentsURI + ";" + firstName + " " + lastName;
+
+ return CalcUniversalIdentifier(id, agentsURI, firstName + " " + lastName);
+ }
+ private static string CalcUniversalIdentifier(UUID id, string agentsURI, string name)
+ {
+ return id.ToString() + ";" + agentsURI + ";" + name;
}
///
--
cgit v1.1