~emersion/soju-dev

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
1

[PATCH v2] Request invite-notify to upstreams

Details
Message ID
<20210121082215.7082-1-hubert@hirtz.pm>
DKIM signature
pass
Download raw message
Patch: +13 -6
... and do not forward INVITEs to downstreams that do not support the
capability.

The downstream capability can be permanent because there is no way for a
client to get the list of people invited to a channel, thus no state can
be corrupted.

---

Sorry for the stupid v1

Also note: please don't apply the current casemapping patch AND this
patch, i'll send another version since this patch compares two nicknames

 downstream.go | 13 +++++++------
 upstream.go   |  6 ++++++
 2 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/downstream.go b/downstream.go
index 200345f..e2824d2 100644
--- a/downstream.go
+++ b/downstream.go
@@ -64,12 +64,13 @@ const illegalNickChars = " :@!*?"
// permanentDownstreamCaps is the list of always-supported downstream
// capabilities.
var permanentDownstreamCaps = map[string]string{
	"batch":        "",
	"cap-notify":   "",
	"echo-message": "",
	"message-tags": "",
	"sasl":         "PLAIN",
	"server-time":  "",
	"batch":         "",
	"cap-notify":    "",
	"echo-message":  "",
	"invite-notify": "",
	"message-tags":  "",
	"sasl":          "PLAIN",
	"server-time":   "",
}

// needAllDownstreamCaps is the list of downstream capabilities that
diff --git a/upstream.go b/upstream.go
index 6cf035d..9c46c3a 100644
--- a/upstream.go
+++ b/upstream.go
@@ -27,6 +27,7 @@ var permanentUpstreamCaps = map[string]bool{
	"away-notify":      true,
	"batch":            true,
	"extended-join":    true,
	"invite-notify":    true,
	"labeled-response": true,
	"message-tags":     true,
	"multi-prefix":     true,
@@ -1340,7 +1341,12 @@ func (uc *upstreamConn) handleMessage(msg *irc.Message) error {
			return err
		}

		weAreInvited := nick == uc.nick

		uc.forEachDownstream(func(dc *downstreamConn) {
			if !weAreInvited && !dc.caps["invite-notify"] {
				return
			}
			dc.SendMessage(&irc.Message{
				Prefix:  dc.marshalUserPrefix(uc.network, msg.Prefix),
				Command: "INVITE",
-- 
2.30.0
Details
Message ID
<A9rPHoFV0TuAK29EL7I2MIhkYMLp4pd-HZqqRyaNfSj9YRfuB_rIo_o3QwvR21txJz9dRU-oh1vz7nelcT4Y5ilm0SvG_aYZe4Z0u5dlCk4=@emersion.fr>
In-Reply-To
<20210121082215.7082-1-hubert@hirtz.pm> (view parent)
DKIM signature
pass
Download raw message
LGTM and pushed, thanks!
Reply to thread Export thread (mbox)