strip leading v from mirc version

--HG--
branch : nmdc-ircfrontend
This commit is contained in:
. 2016-05-10 18:56:32 +12:00
parent c35062a3df
commit 0df6237005

View File

@ -514,6 +514,7 @@ func (s *Server) SetClientSoftwareVersion(ver string) {
// "AndChat 1.4.3.2 http://www.andchat.net" // "AndChat 1.4.3.2 http://www.andchat.net"
// "liteIRC for Android 1.1.8" // "liteIRC for Android 1.1.8"
// ":Relay:1.0:Android" // ":Relay:1.0:Android"
// "mIRC v7.45"
// A bit long and unwieldy. // A bit long and unwieldy.
// Heuristic: keep the first word, and the the first word containing digits // Heuristic: keep the first word, and the the first word containing digits
@ -531,6 +532,11 @@ func (s *Server) SetClientSoftwareVersion(ver string) {
} }
} }
// Strip leading v from mIRC
if len(version) >= 2 && (version[0] == 'v' || version[0] == 'V') && strings.ContainsAny(string(version[1]), "0123456789") {
version = version[1:]
}
s.verbosef("Replacing client tag with '%s' version '%s'", tag, version) s.verbosef("Replacing client tag with '%s' version '%s'", tag, version)
s.upstreamLauncher.Self.ClientTag = tag s.upstreamLauncher.Self.ClientTag = tag