You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Added target parameter to metadata batch type
* Added metadata-subs batch type
* Tightened key name restrictions
* Clarifications on connection registration behaviour
* Various other clarifications and examples
Copy file name to clipboardExpand all lines: extensions/metadata.md
+48-15Lines changed: 48 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -67,7 +67,7 @@ On joining a channel, users will get the channel's current metadata sent to them
67
67
68
68
## Relation with other specifications
69
69
70
-
This specification depends on the [`batch`](../extensions/batch.html) capability which MUST be negotiated to use ``draft/metadata-2``. The order of capability negotiation is not significant and MUST not be enforced.
70
+
This specification depends on the [`batch`](../extensions/batch.html) capability which MUST be negotiated to use ``draft/metadata-2``. The order of capability negotiation is not significant and MUST NOT be enforced.
71
71
72
72
This specification also uses the [standard replies](../extensions/standard-replies.html) framework.
73
73
@@ -82,7 +82,7 @@ The ABNF format of the `metadata` capability is:
82
82
capability ::= 'metadata' ['=' tokens]
83
83
tokens ::= token [',' token]*
84
84
token ::= key ['=' value]
85
-
key ::= <sequence of a-zA-Z0-9_./:->
85
+
key ::= <sequence of one or more a-z0-9_./->
86
86
value ::= <utf8>
87
87
88
88
These are the defined tokens:
@@ -96,23 +96,25 @@ Clients MUST silently ignore any unknown tokens.
96
96
97
97
## Keys and Values
98
98
99
-
Key names follow this grammar:
99
+
Key names are restricted to the ranges `a-z`, `0-9`, and `_./-`. The empty string is an invalid value.
100
100
101
-
be restricted to the ranges `A-Z`, `a-z`, `0-9`, and `_./:-` and are case-insensitive. Key names MUST NOT start with a colon (`:`).
102
-
They follow [the same rules as message tag names](../extensions/message-tags.html#rules-for-naming-message-tags).
103
-
104
-
Values can take any form, but MUST be encoded using UTF-8.
101
+
Values can take any form, but MUST be encoded using UTF-8. The empty string is a valid value.
105
102
106
103
The expected handling of individual metadata keys SHOULD be [defined and listed in the IRCv3 extension registry](../registry.html).
107
104
108
-
## Batch type
105
+
## Batch types
106
+
107
+
This specification adds the `metadata` and `metadata-subs` batch types.
109
108
110
-
This specification adds the `metadata` batch type.
109
+
The `metadata` batch type MUST be sent to clients under the following circumstances:
111
110
112
-
This batch MUST be sent to clients on connection and as reply to successful `METADATA GET`, `METADATA LIST`, and `METADATA SYNC` subcommands.
111
+
* To enclose 0 or more `761 RPL_KEYVALUE` responses to `METADATA GET` or `METADATA LIST`
112
+
* To enclose 0 or more `METADATA` commands in response to `METADATA SYNC`
113
+
* To enclose 0 or more `METADATA` commands in response to a metadata-capable client completing connection registration and receiving its own metadata
113
114
114
-
This batch type does not take any parameter, and clients MUST ignore them if any.
115
+
It takes one parameter and clients MUST ignore extra parameters. This parameter contains the target for which the metadata was requested, allowing the client to correctly process empty batches. Since a batch sent in response to `METADATA SYNC` on a channel may contain metadata on users as well as the channel itself, clients MUST NOT assume that all metadata in the batch applies to the entity referenced in the batch parameter.
115
116
117
+
The `metadata-subs` batch type MUST be sent to clients in response to the `SUBS` subcommand, to enclose 0 or more `772 RPL_METADATASUBS` replies. It takes no parameters and clients MUST ignore any parameters sent.
116
118
117
119
## Notifications
118
120
@@ -135,7 +137,7 @@ If a channel/user the client is receiving updates for changes one of the keys th
135
137
136
138
Here are additional cases where clients will receive `METADATA` messages:
137
139
138
-
-Upon requesting the `metadata` capability, clients receive their non-transient metadata (for example, metadata stored by the server or by services) in a `metadata` batch with their own nick as target. If none exists, the server MUST send an empty batch instead.
140
+
-If the `metadata` capability was negotiated during connection registration, clients receive their current metadata (any metadata stored by the server or by services, plus any metadata set by the client during connection registration via `before-connect`) in a `metadata` batch with their own nick as target as part of the registration burst, i.e. before `RPL_ENDOFMOTD` or `ERR_NOMOTD`. If none exists, the server MUST send an empty batch instead.
139
141
- When subscribing to a key, clients SHOULD receive the current value of that key for channels/users they are receiving updates for.
140
142
- Clients SHOULD receive the current values of keys they are subscribed to when they [`MONITOR`](https://ircv3.net/specs/extensions/monitor.html#monitor-command) a user, or when one of their monitored users comes online.
141
143
@@ -171,7 +173,7 @@ The format of the `METADATA` server message is:
171
173
172
174
`Subcommand` is one of the subcommands listed below. The allowed params are described in each subcommand description.
173
175
174
-
Clients MAY use this command during connection registration if the server advertises the `before-connect` token.
176
+
Clients MAY use this command during connection registration if the server advertises the `before-connect` token. Clients that have not completed connection registration MUST use `*` to target themselves, since they have not been assigned a nickname, even if they sent a `NICK` command.
175
177
176
178
### METADATA GET
177
179
@@ -231,7 +233,7 @@ This new value MAY differ from the one sent by the client.
231
233
232
234
METADATA <Target> CLEAR
233
235
234
-
This subcommand removes all metadata from the target, equivalently to using `METADATA SET` on all currently-set keys with an empty value.
236
+
This subcommand removes all metadata from the target, equivalently to using `METADATA SET` on all currently-set keys with no value.
235
237
236
238
If the user cannot clear keys on the given target, the server responds with `FAIL METADATA KEY_NO_PERMISSION` with an asterisk (`*`) in the `<Key>` field and fails the request.
237
239
@@ -286,7 +288,7 @@ Once the server is finished processing keys, it responds with:
286
288
287
289
This subcommand returns which keys the client is currently subscribed to.
288
290
289
-
The server responds with zero or more `RPL_METADATASUBS` numerics. The server MAY return the keys in any order. The server MUST NOT list the same key multiple times in a response to this subcommand.
291
+
The server responds with a `metadata-subs` batch containing zero or more `RPL_METADATASUBS` numerics. The server MAY return the keys in any order. The server MUST NOT list the same key multiple times in a response to this subcommand.
290
292
291
293
### METADATA SYNC
292
294
@@ -706,6 +708,37 @@ Twice:
706
708
707
709
-----
708
710
711
+
### Setting keys and subscribing with `before-connect`
712
+
713
+
C: CAP LS 302
714
+
S: :metadata.test CAP * LS :batch message-tags draft/metadata-2=before-connect,max-subs=100,max-keys=100
715
+
C: CAP REQ :batch message-tags draft/metadata-2
716
+
S: :metadata.test CAP * ACK :batch message-tags draft/metadata-2
717
+
C: METADATA * SUB display-name
718
+
S: :metadata.test 770 * display-name
719
+
C: METADATA * SET display-name :a b c
720
+
S: :metadata.test 761 * * display-name * :a b c
721
+
C: NICK abc
722
+
C: USER u s e r
723
+
C: CAP END
724
+
S: :metadata.test 001 abc :Welcome to the MetadataTesting IRC Network abc
725
+
S: [redacted registration burst messages]
726
+
S: :metadata.test BATCH +1 metadata
727
+
S: @batch=1 :metadata.test METADATA abc display-name * :a b c
728
+
S: :metadata.test BATCH -1
729
+
S: [redacted registration burst messages]
730
+
S: :metadata.test 376 abc :End of MOTD command
731
+
C: METADATA * LIST
732
+
S: :metadata.test BATCH +2 metadata
733
+
S: @batch=2 :metadata.test 761 abc abc display-name * :a b c
734
+
S: :metadata.test BATCH -2
735
+
C: METADATA * SUBS
736
+
S: :metadata.test BATCH +3 metadata-subs
737
+
S: @batch=3 :metadata.test 772 abc display-name
738
+
S: :metadata.test BATCH -3
739
+
740
+
-----
741
+
709
742
### Non-normative examples
710
743
711
744
The following examples describe how an implementation might use certain features.
0 commit comments