From 28cf1147e83ca0e76c260f92b9ac07bb75d9c0d2 Mon Sep 17 00:00:00 2001 From: delthas Date: Tue, 8 Sep 2020 19:49:06 +0200 Subject: [PATCH] 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. --- downstream.go | 8 ++++++-- upstream.go | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/downstream.go b/downstream.go index db721db..3b47815 100644 --- a/downstream.go +++ b/downstream.go @@ -75,8 +75,9 @@ var permanentDownstreamCaps = map[string]string{ // needAllDownstreamCaps is the list of downstream capabilities that // require support from all upstreams to be enabled var needAllDownstreamCaps = map[string]string{ - "away-notify": "", - "multi-prefix": "", + "away-notify": "", + "extended-join": "", + "multi-prefix": "", } 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) } diff --git a/upstream.go b/upstream.go index f76f68e..60c2d2b 100644 --- a/upstream.go +++ b/upstream.go @@ -26,6 +26,7 @@ import ( var permanentUpstreamCaps = map[string]bool{ "away-notify": true, "batch": true, + "extended-join": true, "labeled-response": true, "message-tags": true, "multi-prefix": true,