Fix downstream PING argument handling

The PONG message should have these arguments:

- Our server name
- The PING message's source name

Closes: https://todo.sr.ht/~emersion/soju/92
This commit is contained in:
Simon Ser 2020-08-26 15:18:57 +02:00
parent fb8c6340c8
commit 43aa3e5529
No known key found for this signature in database
GPG Key ID: 0FDE7BE0E88F5E48

View File

@ -960,10 +960,23 @@ func (dc *downstreamConn) handleMessageRegistered(msg *irc.Message) error {
return err
}
case "PING":
var source, destination string
if err := parseMessageParams(msg, &source); err != nil {
return err
}
if len(msg.Params) > 1 {
destination = msg.Params[1]
}
if destination != "" && destination != dc.srv.Hostname {
return ircError{&irc.Message{
Command: irc.ERR_NOSUCHSERVER,
Params: []string{dc.nick, destination, "No such server"},
}}
}
dc.SendMessage(&irc.Message{
Prefix: dc.srv.prefix(),
Command: "PONG",
Params: msg.Params,
Params: []string{dc.srv.Hostname, source},
})
return nil
case "USER":