Return an empty CHATHISTORY TARGETS batch when in multi-upstream

When on an unbound bouncer network downstream, we should return no
targets (there are none, because there are no upstreams at all).

When on a multi-upstream downstream, we should return no targets as we
don't support multi-upstream CHATHISTORY TARGETS.

Before this patch, we returned a misleading error message:
:example.com 403 :Missing network suffix in name
This commit is contained in:
delthas 2021-11-15 19:20:17 +01:00 committed by Simon Ser
parent 4397cd7fc2
commit 37c1b3e29c

View file

@ -2359,6 +2359,12 @@ func (dc *downstreamConn) handleMessageRegistered(msg *irc.Message) error {
return err return err
} }
case "TARGETS": case "TARGETS":
if dc.network == nil {
// Either an unbound bouncer network, in which case we should return no targets,
// or a multi-upstream downstream, but we don't support CHATHISTORY TARGETS for those yet.
dc.SendBatch("draft/chathistory-targets", nil, nil, func(batchRef irc.TagValue) {})
return nil
}
if err := parseMessageParams(msg, nil, &boundsStr[0], &boundsStr[1], &limitStr); err != nil { if err := parseMessageParams(msg, nil, &boundsStr[0], &boundsStr[1], &limitStr); err != nil {
return err return err
} }