Vendor BATCH bouncer-networks type

And add the prefix throughout the spec, to make it clear the unprefixed
version is not to be used.
This commit is contained in:
Simon Ser 2021-05-25 16:56:38 +02:00
parent f37a47cc4e
commit 4cf9804e89
2 changed files with 28 additions and 27 deletions

View file

@ -27,9 +27,9 @@ implementing a compatible work-in-progress version.
## Description ## Description
This document describes the `bouncer-networks` extension. This enables clients This document describes the `soju.im/bouncer-networks` extension. This enables
to discover servers that are bouncers, list and edit upstream networks the clients to discover servers that are bouncers, list and edit upstream networks
bouncer is connected to. the bouncer is connected to.
Each network has a unique per-user ID called "netid". It MUST NOT change during Each network has a unique per-user ID called "netid". It MUST NOT change during
the lifetime of the network. TODO: character restrictions for network IDs. the lifetime of the network. TODO: character restrictions for network IDs.
@ -39,14 +39,15 @@ format. Clients MUST ignore unknown attributes.
## Implementation ## Implementation
The `bouncer-networks` extension defines a new `RPL_ISUPPORT` token and a new The `soju.im/bouncer-networks` extension defines a new `RPL_ISUPPORT` token and
`BOUNCER` command. a new `BOUNCER` command.
The `bouncer-networks` capability MUST be negociated. This allows the server and The `soju.im/bouncer-networks` capability MUST be negociated. This allows the
client to behave differently when the client is aware of the bouncer networks. server and client to behave differently when the client is aware of the bouncer
networks.
The `bouncer-networks-notify` capability MAY be negociated. This allows the The `soju.im/bouncer-networks-notify` capability MAY be negociated. This allows
client to signal that it is capable of receiving and correctly processing the client to signal that it is capable of receiving and correctly processing
bouncer network notifications. bouncer network notifications.
### `RPL_ISUPPORT` token ### `RPL_ISUPPORT` token
@ -54,10 +55,10 @@ bouncer network notifications.
The server can advertise a `BOUNCER_NETID` token in its `RPL_ISUPPORT` message. The server can advertise a `BOUNCER_NETID` token in its `RPL_ISUPPORT` message.
Its optional value is the network ID bound for the current connection. Its optional value is the network ID bound for the current connection.
### `bouncer-networks` batch ### `soju.im/bouncer-networks` batch
The `bouncer-networks` batch does not take any parameter and can only contain The `soju.im/bouncer-networks` batch does not take any parameter and can only
`BOUNCER NETWORK` messages. contain `BOUNCER NETWORK` messages.
### `BOUNCER` command ### `BOUNCER` command
@ -79,8 +80,8 @@ The `LISTNETWORKS` subcommand queries the list of upstream networks.
BOUNCER LISTNETWORKS BOUNCER LISTNETWORKS
The server replies with a `bouncer-networks` batch, containing any number of The server replies with a `soju.im/bouncer-networks` batch, containing any
`BOUNCER NETWORK` messages: number of `BOUNCER NETWORK` messages:
BOUNCER NETWORK <netid> <attributes> BOUNCER NETWORK <netid> <attributes>
@ -134,17 +135,17 @@ On success, the server replies with:
### Network notifications ### Network notifications
If the client has negociated the `bouncer-networks-notify` capability, the If the client has negociated the `soju.im/bouncer-networks-notify` capability,
server MUST send an initial batch of `BOUNCER NETWORK` messages with the current the server MUST send an initial batch of `BOUNCER NETWORK` messages with the
list of network, and MUST send notification messages whenever a network is current list of network, and MUST send notification messages whenever a network
added, updated or removed. is added, updated or removed.
If the client has not negociated the `bouncer-networks-notify` capability, the If the client has not negociated the `soju.im/bouncer-networks-notify`
server MUST NOT send implicit `BOUNCER NETWORK` messages. capability, the server MUST NOT send implicit `BOUNCER NETWORK` messages.
When network attributes are updated, the bouncer MUST broadcast a When network attributes are updated, the bouncer MUST broadcast a
`BOUNCER NETWORK` message with the updated attributes to all connected clients `BOUNCER NETWORK` message with the updated attributes to all connected clients
with the `bouncer-networks-notify` capability enabled: with the `soju.im/bouncer-networks-notify` capability enabled:
BOUNCER NETWORK <netid> <attributes> BOUNCER NETWORK <netid> <attributes>
@ -152,7 +153,7 @@ The notification SHOULD NOT contain attributes that haven't been updated.
When a network is removed, the bouncer MUST broadcast a `BOUNCER NETWORK` When a network is removed, the bouncer MUST broadcast a `BOUNCER NETWORK`
message with the special argument `*` to all connected clients with the message with the special argument `*` to all connected clients with the
`bouncer-networks-notify` capability enabled: `soju.im/bouncer-networks-notify` capability enabled:
BOUNCER NETWORK <netid> * BOUNCER NETWORK <netid> *
@ -250,8 +251,8 @@ Binding to a network:
C: CAP LS 302 C: CAP LS 302
C: NICK emersion C: NICK emersion
C: USER emersion 0 0 :Simon C: USER emersion 0 0 :Simon
S: CAP * LS :sasl=PLAIN bouncer-networks bouncer-networks-notify S: CAP * LS :sasl=PLAIN soju.im/bouncer-networks soju.im/bouncer-networks-notify
C: CAP REQ :sasl bouncer-networks C: CAP REQ :sasl soju.im/bouncer-networks
[SASL authentication] [SASL authentication]
C: BOUNCER BIND 42 C: BOUNCER BIND 42
C: CAP END C: CAP END
@ -259,7 +260,7 @@ Binding to a network:
Listing networks: Listing networks:
C: BOUNCER LISTNETWORKS C: BOUNCER LISTNETWORKS
S: BATCH +asdf bouncer-networks S: BATCH +asdf soju.im/bouncer-networks
S: @batch=asdf BOUNCER NETWORK 42 name=Freenode;state=connected S: @batch=asdf BOUNCER NETWORK 42 name=Freenode;state=connected
S: @batch=asdf BOUNCER NETWORK 43 name=My\sAwesome\sNetwork;state=disconnected S: @batch=asdf BOUNCER NETWORK 43 name=My\sAwesome\sNetwork;state=disconnected
S: BATCH -asdf S: BATCH -asdf

View file

@ -1068,7 +1068,7 @@ func (dc *downstreamConn) welcome() error {
dc.SendMessage(&irc.Message{ dc.SendMessage(&irc.Message{
Prefix: dc.srv.prefix(), Prefix: dc.srv.prefix(),
Command: "BATCH", Command: "BATCH",
Params: []string{"+networks", "bouncer-networks"}, Params: []string{"+networks", "soju.im/bouncer-networks"},
}) })
dc.user.forEachNetwork(func(network *network) { dc.user.forEachNetwork(func(network *network) {
idStr := fmt.Sprintf("%v", network.ID) idStr := fmt.Sprintf("%v", network.ID)
@ -2047,7 +2047,7 @@ func (dc *downstreamConn) handleMessageRegistered(msg *irc.Message) error {
dc.SendMessage(&irc.Message{ dc.SendMessage(&irc.Message{
Prefix: dc.srv.prefix(), Prefix: dc.srv.prefix(),
Command: "BATCH", Command: "BATCH",
Params: []string{"+networks", "bouncer-networks"}, Params: []string{"+networks", "soju.im/bouncer-networks"},
}) })
dc.user.forEachNetwork(func(network *network) { dc.user.forEachNetwork(func(network *network) {
idStr := fmt.Sprintf("%v", network.ID) idStr := fmt.Sprintf("%v", network.ID)