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.

git-svn-id: file:///srv/svn/repo/suika/trunk@299 f0ae65fe-ee39-954e-97ec-027ff2717ef4
This commit is contained in:
delthas 2020-05-27 21:44:38 +00:00
parent 105e3d19b4
commit e144b62324

View File

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