From 43371bf347dee693d6a6de5294838e605d132770 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Mon, 14 Mar 2022 13:49:01 +0000 Subject: [PATCH] Add the soju.im/no-implicit-names extension 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 7553ac9..4b2fe92 100644 --- a/bridge.go +++ b/bridge.go @@ -37,7 +37,9 @@ func forwardChannel(ctx context.Context, dc *downstreamConn, ch *upstreamChannel } } - sendNames(dc, ch) + if !dc.caps.IsEnabled("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 0000000..4c09ffa --- /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 negotiated, 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 c82f7e8..89f6bc5 100644 --- a/downstream.go +++ b/downstream.go @@ -231,6 +231,7 @@ var permanentDownstreamCaps = map[string]string{ "soju.im/bouncer-networks": "", "soju.im/bouncer-networks-notify": "", + "soju.im/no-implicit-names": "", "soju.im/read": "", }