Add support for the extended-join capability

This simple implementation only advertises extended-join to downstreams
when all upstreams support it.

In the future, it could be modified so that soju buffers incoming
upstream JOINs, sends a WHO, waits for the reply, and sends an extended
join to the downstream; so that soju could advertise that capability
even when some or all upstreams do not support it. This is not the case
in this commit.
This commit is contained in:
delthas 2020-09-08 19:49:06 +02:00 committed by Simon Ser
parent bbe67adf1e
commit 28cf1147e8
2 changed files with 7 additions and 2 deletions

View File

@ -75,8 +75,9 @@ var permanentDownstreamCaps = map[string]string{
// needAllDownstreamCaps is the list of downstream capabilities that // needAllDownstreamCaps is the list of downstream capabilities that
// require support from all upstreams to be enabled // require support from all upstreams to be enabled
var needAllDownstreamCaps = map[string]string{ var needAllDownstreamCaps = map[string]string{
"away-notify": "", "away-notify": "",
"multi-prefix": "", "extended-join": "",
"multi-prefix": "",
} }
type downstreamConn struct { type downstreamConn struct {
@ -281,6 +282,9 @@ func (dc *downstreamConn) SendMessage(msg *irc.Message) {
} }
} }
} }
if msg.Command == "JOIN" && !dc.caps["extended-join"] {
msg.Params = msg.Params[:1]
}
dc.conn.SendMessage(msg) dc.conn.SendMessage(msg)
} }

View File

@ -26,6 +26,7 @@ import (
var permanentUpstreamCaps = map[string]bool{ var permanentUpstreamCaps = map[string]bool{
"away-notify": true, "away-notify": true,
"batch": true, "batch": true,
"extended-join": true,
"labeled-response": true, "labeled-response": true,
"message-tags": true, "message-tags": true,
"multi-prefix": true, "multi-prefix": true,