support bad USER/NICK order for Lite IRC, set realname as the nmdc description
--HG-- branch : nmdc-ircfrontend
This commit is contained in:
parent
f51bd29e07
commit
a6ed910933
@ -23,6 +23,7 @@ Unusable:
|
||||
2016/05/07 22:57:04 <<< :Your nickname is already being used KILL A
|
||||
2016/05/07 22:57:04 >>> 'NICK' [pineapple420]
|
||||
2016/05/07 22:57:04 Broken loop.
|
||||
- some patches in place, needs retesting
|
||||
Yaaic/Atomic
|
||||
- doesn't properly understand/parse the room join
|
||||
Atomic
|
||||
|
17
server.go
17
server.go
@ -306,6 +306,11 @@ func (s *Server) handleCommand(command string, args []string) {
|
||||
if s.upstreamLauncher.Self.Nick == "" {
|
||||
// allow set, as part of the login phase
|
||||
s.upstreamLauncher.Self.Nick = args[0]
|
||||
|
||||
} else if args[0] == s.upstreamLauncher.Self.Nick {
|
||||
// Ignore
|
||||
// Required for compatibility with Lite IRC, which sends USER/NICK in the wrong order
|
||||
|
||||
} else {
|
||||
s.reply(rplKill, "Can't change nicks on this server", "")
|
||||
s.DisconnectClient()
|
||||
@ -322,9 +327,15 @@ func (s *Server) handleCommand(command string, args []string) {
|
||||
}
|
||||
|
||||
if s.upstreamLauncher.Self.Nick == "" {
|
||||
s.reply(rplKill, "Your nickname is already being used", "")
|
||||
s.DisconnectClient()
|
||||
return
|
||||
// Whatever, treat it as a NICK call (non-strict client handshake) and take the username field to be the intended nick
|
||||
// This will allow Lite IRC's bad handshake to log in (as long as the username and the nickname are the same)
|
||||
s.upstreamLauncher.Self.Nick = args[0]
|
||||
}
|
||||
|
||||
// Use the client's {real name} field as an NMDC {description}
|
||||
if len(args) >= 4 && len(args[3]) > 0 && args[3][0] == ':' {
|
||||
realName := strings.Join(args[3:], " ")[1:]
|
||||
s.upstreamLauncher.Self.Description = realName
|
||||
}
|
||||
|
||||
s.reply(rplWelcome)
|
||||
|
Loading…
Reference in New Issue
Block a user