~emersion/soju-dev

Add the soju.im/no-implicit-names extension v1 APPLIED

Simon Ser: 1
 Add the soju.im/no-implicit-names extension

 3 files changed, 17 insertions(+), 1 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~emersion/soju-dev/patches/30229/mbox | git am -3
Learn more about email & git

[PATCH] Add the soju.im/no-implicit-names extension Export this patch

References: https://github.com/ircv3/ircv3-ideas/issues/87
---
 bridge.go                    |  4 +++-
 doc/ext/no-implicit-names.md | 13 +++++++++++++
 downstream.go                |  1 +
 3 files changed, 17 insertions(+), 1 deletion(-)
 create mode 100644 doc/ext/no-implicit-names.md

diff --git a/bridge.go b/bridge.go
index fda02ff08212..c05129c6953b 100644
--- a/bridge.go
@@ -37,7 +37,9 @@ func forwardChannel(ctx context.Context, dc *downstreamConn, ch *upstreamChannel
		}
	}

	sendNames(dc, ch)
	if !dc.caps["soju.im/no-implicit-names"] {
		sendNames(dc, ch)
	}
}

func sendTopic(dc *downstreamConn, ch *upstreamChannel) {
diff --git a/doc/ext/no-implicit-names.md b/doc/ext/no-implicit-names.md
new file mode 100644
index 000000000000..68f196369ad9
--- /dev/null
+++ b/doc/ext/no-implicit-names.md
@@ -0,0 +1,13 @@
# no-implicit-names

This is a work-in-progress specification.

## Description

This document describes the `no-implicit-names` extension. This allows clients to opt-out from the implicit `NAMES` reply servers send after `JOIN` messages.

Some clients don't need to query the list of channel members for all joined channels. Omitting this information can reduce the time taken to connect to the server, especially on mobile devices and when a large number of channels are joined.

## Implementation

The `no-implicit-names` extension introduces the `soju.im/no-implicit-names` capability. When negociated, servers MUST NOT send an implicit `NAMES` reply after sending a `JOIN` message. Servers MUST reply to explicit `NAMES` commands sent by the client as usual.
diff --git a/downstream.go b/downstream.go
index 0a2852fd5949..678d088aba92 100644
--- a/downstream.go
+++ b/downstream.go
@@ -232,6 +232,7 @@ var permanentDownstreamCaps = map[string]string{
	"soju.im/bouncer-networks":        "",
	"soju.im/bouncer-networks-notify": "",
	"soju.im/read":                    "",
	"soju.im/no-implicit-names":       "",
}

// needAllDownstreamCaps is the list of downstream capabilities that

base-commit: 9376c8885ce0d4fb37116c93e06740e92142c532
-- 
2.35.1