Add support for downstream WHOIS nick/network nick/network

Many IRC clients use the query `WHOIS nick nick` rather than
`WHOIS nick` when querying a nick. The former command means to
specifically query the WHOIS on the server to which `nick` is connected,
which is useful to get information that is sometimes not propagated
between servers, such as idle time.

In the case where a downstream sends WHOIS nick/network nick/network in
multi-server mode, we need to unmarshal both fields.

Previously, we did not unmarshal those fields, and upstreams would
receive `WHOIS nick/network nick`, which is incorrect.

This adds support for unmarshaling the target field if it is the same as
the mask field, by simply using the unmarshaled nick that is already
computed from the mask.
This commit is contained in:
delthas 2020-05-11 23:48:07 +02:00 committed by Simon Ser
parent a64e1d6761
commit 791cf4b887
No known key found for this signature in database
GPG Key ID: 0FDE7BE0E88F5E48

View File

@ -1379,7 +1379,11 @@ func (dc *downstreamConn) handleMessageRegistered(msg *irc.Message) error {
var params []string
if target != "" {
if target == mask { // WHOIS nick nick
params = []string{upstreamNick, upstreamNick}
} else {
params = []string{target, upstreamNick}
}
} else {
params = []string{upstreamNick}
}