Changeset 412 in code for trunk/downstream.go


Ignore:
Timestamp:
Aug 26, 2020, 1:18:57 PM (5 years ago)
Author:
contact
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/downstream.go

    r411 r412  
    961961                }
    962962        case "PING":
     963                var source, destination string
     964                if err := parseMessageParams(msg, &source); err != nil {
     965                        return err
     966                }
     967                if len(msg.Params) > 1 {
     968                        destination = msg.Params[1]
     969                }
     970                if destination != "" && destination != dc.srv.Hostname {
     971                        return ircError{&irc.Message{
     972                                Command: irc.ERR_NOSUCHSERVER,
     973                                Params: []string{dc.nick, destination, "No such server"},
     974                        }}
     975                }
    963976                dc.SendMessage(&irc.Message{
    964977                        Prefix:  dc.srv.prefix(),
    965978                        Command: "PONG",
    966                         Params:  msg.Params,
     979                        Params:  []string{dc.srv.Hostname, source},
    967980                })
    968981                return nil
Note: See TracChangeset for help on using the changeset viewer.