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:
parent
fb8c6340c8
commit
43aa3e5529
@ -960,10 +960,23 @@ func (dc *downstreamConn) handleMessageRegistered(msg *irc.Message) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
case "PING":
|
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{
|
dc.SendMessage(&irc.Message{
|
||||||
Prefix: dc.srv.prefix(),
|
Prefix: dc.srv.prefix(),
|
||||||
Command: "PONG",
|
Command: "PONG",
|
||||||
Params: msg.Params,
|
Params: []string{dc.srv.Hostname, source},
|
||||||
})
|
})
|
||||||
return nil
|
return nil
|
||||||
case "USER":
|
case "USER":
|
||||||
|
Loading…
Reference in New Issue
Block a user