-
Notifications
You must be signed in to change notification settings - Fork 85
Add user query extension #569
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
emersion
wants to merge
1
commit into
ircv3:master
Choose a base branch
from
emersion:user-query
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,116 @@ | ||
| --- | ||
| title: User query | ||
| layout: spec | ||
| work-in-progress: true | ||
| copyrights: | ||
| - | ||
| name: "Simon Ser" | ||
| period: "2025" | ||
| email: "contact@emersion.fr" | ||
| --- | ||
|
|
||
| ## Notes for implementing work-in-progress version | ||
|
|
||
| This is a work-in-progress specification. | ||
|
|
||
| Software implementing this work-in-progress specification MUST NOT use the unprefixed `user-query` CAP name. Instead, implementations SHOULD use the `draft/user-query` CAP name to be interoperable with other software implementing a compatible work-in-progress version. The final version of the specification will use unprefixed CAP names. | ||
|
|
||
| ## Description | ||
|
|
||
| This document describes the format of the `user-query` extension. This extension enables several clients of the same user connected to a server or bouncer to tell each other about which user queries (conversations between two users) are currently opened. | ||
|
|
||
| Some servers or bouncers remember the channels joined by a user and restore them after connection registration. This can be used by clients to synchronize channels, but doesn't work for user queries. If another client opens or closes a user query, there is no way for other clients to become aware of this action. This extension fills this gap. | ||
|
|
||
| The user queries opened by a user MUST NOT be disclosed to other users by the server without an explicit opt-in. | ||
|
|
||
| ## Implementation | ||
|
|
||
| The `user-query` extension uses the `draft/user-query` capability, introduces a new `USERQUERY` command and a `draft/user-query-list` batch type. | ||
|
|
||
| The `draft/user-query` capability MUST be negotiated before using the `USERQUERY` command, and affects which messages are sent by the server as specified below. | ||
|
|
||
| ### `USERQUERY LIST` sub-command | ||
|
|
||
| The `USERQUERY LIST` sub-command can be sent by clients to request a list of all opened user queries. | ||
|
|
||
| This sub-command has the following client syntax: | ||
|
|
||
| USERQUERY LIST | ||
|
|
||
| The server MUST reply to a successful `USERQUERY LIST` sub-command with a `draft/user-query-list` batch if the `batch` capability has been negotiated. The batch MUST contain any number of `USERQUERY LIST` replies with the following server syntax: | ||
|
|
||
| USERQUERY LIST <nick> | ||
|
|
||
| The `nick` parameter specifies a single nickname. | ||
|
|
||
| ### `USERQUERY OPEN` sub-command | ||
|
|
||
| The `USERQUERY OPEN` sub-command can be sent by both clients and servers. | ||
|
|
||
| This sub-command has the following general syntax: | ||
|
|
||
| USERQUERY OPEN <nick> | ||
|
|
||
| The `nick` parameter specifies a single nickname. | ||
|
|
||
| When sent from a client, this sub-command signals to the server that the user has opened a query with the specified user. The server MUST reply to a successful `USERQUERY OPEN` client set command using a `USERQUERY OPEN` server sub-command, or using an error message. | ||
|
|
||
| When sent from a server, the `USERQUERY OPEN` command signals to the client that the user has a query opened with the specified user. If a `PRIVMSG` is sent to the user while no user query is opened, the server automatically opens a user query before dispatching the message. Servers SHOULD broadcast the `USERQUERY OPEN` notification to all clients connected under the same account. | ||
|
|
||
| TODO: interactions with MONITOR? | ||
|
|
||
| ### `USERQUERY CLOSE` sub-command | ||
|
|
||
| The `USERQUERY CLOSE` sub-command can be sent by both clients and servers. | ||
|
|
||
| This sub-command has the following general syntax: | ||
|
|
||
| USERQUERY CLOSE <nick> | ||
|
|
||
| This command has the same syntax and behavior as `USERQUERY OPEN`, but indicates that the user has closed a user query. | ||
|
|
||
| ### Errors and Warnings | ||
|
|
||
| Errors are returned using the standard replies syntax. | ||
|
|
||
| If the server receives a syntactically invalid `USERQUERY` command, e.g., an unknown subcommand, missing parameters, excess parameters, parameters that cannot be parsed, or invalid nickname, the `INVALID_PARAMS` error code SHOULD be returned: | ||
|
|
||
| FAIL USERQUERY <subcommand> INVALID_PARAMS [invalid_parameters] :Invalid parameters | ||
|
|
||
| If `USERQUERY OPEN` was sent while the user query was already opened, the `ALREADY_OPENED` error code MUST be returned. If `USERQUERY CLOSE` was sent while the user query was already closed, the `ALREADY_CLOSED` error code MUST be returned. | ||
|
|
||
| FAIL USERQUERY OPEN ALREADY_OPENED <nick> :This user query was already opened | ||
| FAIL USERQUERY CLOSE ALREADY_CLOSED <nick> :This user query was already closed | ||
|
|
||
| If the user query cannot be opened or closed due to an error, the `INTERNAL_ERROR` error code SHOULD be returned. | ||
|
|
||
| FAIL USERQUERY <subcommand> INTERNAL_ERROR <nick> :The user query could not be opened or closed | ||
|
|
||
| ### Implementation considerations | ||
|
|
||
| Servers SHOULD automatically close old user queries to prevent the list of user queries from growing unbounded. For instance, this can be achieved by closing old user queries when the number of opened user queries reaches a limit, or closing user queries after an expiration timeout. | ||
|
|
||
| ### Examples | ||
|
|
||
| Querying the list of opened user queries: | ||
|
|
||
| C: USERQUERY LIST | ||
| S: BATCH +foo draft/user-query-list | ||
| S: @batch=foo USERQUERY LIST gustave | ||
| S: @batch=foo USERQUERY LIST aline | ||
| S: BATCH -foo | ||
|
|
||
| Opening a new user query: | ||
|
|
||
| C: USERQUERY OPEN sophie | ||
| S: :irc.example.org USERQUERY OPEN sophie | ||
|
|
||
| Closing an existing user query: | ||
|
|
||
| C: USERQUERY CLOSE sophie | ||
| S: :irc.example.org USERQUERY CLOSE sophie | ||
|
|
||
| The server automatically opens a user query when receiving a message: | ||
|
|
||
| S: :irc.example.org USERQUERY OPEN sophie | ||
| S: :sophie!so@example.com PRIVMSG yannick :Hi there! | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My understanding of the state of discussion here is that we concluded that when combined with server-side pruning, this (auto-opening queries) becomes a DoS vector. But I don't remember the state of the discussion for alternative strategies.