~emersion/soju

43aa3e55295a67c83eddacc7417cefe93d59b1be — Simon Ser 2 months ago fb8c634
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
1 files changed, 14 insertions(+), 1 deletions(-)

M downstream.go
M downstream.go => downstream.go +14 -1
@@ 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":