-
Notifications
You must be signed in to change notification settings - Fork 80
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
Add the CHATHISTORY extension specification. #292
Changes from 28 commits
d572c78
ff83973
25c7e8d
577d9c5
e2d46f5
3871fa5
ff2ef80
8ae7bf9
d261046
c4883c0
382968a
ed14f4c
78b39f1
78208a6
f923267
3ae7331
0af7450
77b4a6a
45b3e0a
e5f366b
545f645
89b5299
23cb023
9cc586a
d054b8b
a210bfc
4042cec
8759f86
02aba74
88a3e1b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
--- | ||
title: IRCv3 chathistory extension | ||
layout: spec | ||
work-in-progress: true | ||
copyrights: | ||
- | ||
name: "Evan Magaliff" | ||
period: "2017" | ||
email: "evan@muffinmedic.net" | ||
--- | ||
## Description | ||
This document describes the format of the `chathistory` extension. The `chathistory` extension uses the [chathistory][batch/chathistory] batch type, adding a client-side command for requesting `chathistory` content from the server. | ||
|
||
The `chathistory` extension adds an optional `draft/msgid` to the `chathistory` batch reply. | ||
|
||
Clients MUST support the [`batch`][batch] and [`server-time`][server-time] capabilities. Clients SHOULD support the [`draft/labeled-response`][draft/labeled-response] and [`draft/message-tags`][draft/message-tags] capabilities. | ||
|
||
When a client with the above mentioned capabilities requests `chathistory` content from the server (using the `CHATHISTORY` command outlined below), the server SHOULD return to the client a single batch containing raw IRC lines starting with and exluduing the `start` parameter and up to and including the message at the `end` parameter. The raw IRC lines SHOULD be formatted and returned to the client as they were originally, with the addition of the above capability tags. | ||
|
||
The `server-time` SHOULD be the time at which the message was received from the IRC server and the `batch id` a unique ID for the entire batch. `draft/label` SHOULD be included and MUST be a unique ID used to identify the `chathistory` request and any replies. A `draft/msgid` to identify each individual message MUST be the `draft/msgid` included when each message was first received from the IRC server. | ||
|
||
### `CHATHISTORY` Command | ||
`CHATHISTORY` content can be requested by the client to the server by sending the `CHATHISTORY` command to the server. A `batch` MUST be returned by the server. If no content exists to return, an empty batch SHOULD be returned to avoid the client waiting for a reply. Command support is sent to the client as the RPL_ISUPPORT 005 numeric `:irc.host 005 nick CHATHISTORY=max_message_count :are supported by this server` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Perhaps instead of "an empty batch ..." we could do "CHATHISTORY SUCCESS NOOP" / NO_DATA whatever can be returned |
||
|
||
Both the `message_count` and `max_message_count` MUST be integers. `message_count` MUST be a non-zero and `max_message_count` MUST be greater than or equal to zero. The client SHOULD not request a `message_count` with an absolute value greater than the `max_message_count` parameter sent in the command. | ||
|
||
Both the `start` and `end` parameters support `draft/msgid` and `timestamp`. The `end` parameter also accepts a `message_count`. If the number of lines between the `start` and `end` parameters exceeds the `max_message_count`, the server SHOULD return a number of lines equal to the `max_message_count` and the appropriate warning as described below. A `max_message_count` of 0 indicates that no maximum exists. | ||
|
||
A positive `message_count` or tag `draft/msgid` prepended with a `+` indicates the client is requesting content after the `start`. A negative `message_count` or `draft/msgid` tag prepended with a `-` indicates the client is requested content before the specified `start`. | ||
|
||
The `target` parameter specifies a single channel or query from which history SHOULD be retrieved. Wildcards or multiple targets are not supported. | ||
|
||
#### Format | ||
`chathistory` uses the following generic format: | ||
|
||
@draft/label=ID CHATHISTORY <target> <start> <end> | ||
|
||
The `chathistory` content can requested using timestamps: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this might lead to some timing problems down the line, since the timestamp is not unique per message. A server may receive two messages at the very same time and only one of these make it to a connected client before it disconnects. Then the client will reconnect and ask for messages since the last message it seen which would not include the missing message. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is required to account for certain use cases in which |
||
|
||
@draft/label=ID CHATHISTORY <target> timestamp=YYYY-MM-DDThh:mm:ss.sssZ message_count=<message_count> | ||
|
||
Alternatively, content can be requested using a `draft/msgid`: | ||
|
||
@draft/label=ID CHATHISTORY <target> draft/msgid=<message_id> timestamp=<timestamp> | ||
|
||
Content can also be requested up to a specified timestamp or `draft/msgid` in place of the `message_count`. The start and end parameter types do not have to match: | ||
|
||
@draft/label=ID CHATHISTORY <target> timestamp=<timestamp> +draft/msgid=<message_id> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. timestamp without an There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
#### Errors and Warnings | ||
If the server receives a `CHATHISTORY` command with missing parameters, the `NEED_MORE_PARAMS` error code SHOULD be returned. | ||
|
||
If the number of lines between the `start` and `end` parameters exceeds the `max_message_count`, warn code `MAX_MSG_COUNT_EXCEEDED` SHOULD be returned. The command SHOULD continue to be processed as described above. | ||
|
||
If the target has no `chathistory` content to return or the user does not have permission to view the requested content, `NO_SUCH_NICK` or `NO_SUCH_CHANNEL` SHOULD be returned accordingly. | ||
|
||
### Examples | ||
The examples below are written with `draft/msgid` and `draft/label` tags included. These tags are recommended. | ||
|
||
@draft/label=ID :irc.host BATCH +ID chathistory target | ||
|
||
@batch=ID;draft/msgid=ID;time=YYYY-MM-DDThh:mm:ss.sssZ :nick!ident@host PRIVMSG target :message | ||
|
||
@batch=ID;draft/msgid=ID;time=YYYY-MM-DDThh:mm:ss.sssZ :nick!ident@host NOTICE target :message | ||
|
||
@batch=ID;draft/msgid=ID;time=YYYY-MM-DDThh:mm:ss.sssZ :nick!ident@host PRIVMSG target :ACTION message | ||
|
||
:irc.host BATCH -ID | ||
|
||
@draft/label=ID :nick!ident@host CHATHISTORY ERR ERR_CODE | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Without explicitly mentioning ERR as a verb (and WARN) implementors may think that this is not a constant string and get confused. A reference to some sort of document explaining subcommands may be useful |
||
@draft/label=ID :nick!ident@host CHATHISTORY WARN WARN_CODE | ||
|
||
## Use Cases | ||
The batch type and supporting command are useful for allowing an "infinite scroll" type capability within the client. A client will, upon scrolling to the top of the active window or a manual trigger, may request `chathistory` from the server and, after receiving returned content, append it to the top of the window. Users can repeat this historic scrolling to retrieve prior history until limitations are met (see below). | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wouldn't There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The client is sending a known message as a starting point. If the oldest message a client has is at a particular time, this timestamp will be provided to This works in the forward direction as well, in which the client knows the last message it has and wants to retrieve content from directly after it. Theoretically, this works for any known message as a reference, and could be used to add context if a client wants to "jump" to a message, and then request X lines before and Y lines after. |
||
|
||
## Limitations | ||
Logging of messages and other actions MUST be enabled server-side and can be stored in any format desired, given appropriate software exists to retrieve and format such stored contnet. Scrollback can only be retrieved as far back as logs exist for the requesting user in the specified channel or query. | ||
|
||
A method for securely identifying the requesting user MUST exist to ensure content is sent only to the appropriate users and clients. See below for more information. | ||
|
||
## Security Considerations | ||
Secure identification of users and clients MUST exist in order to ensure that users cannot obtain history they are not authorized to view. Use of account names, internal account identifiers, or certificate fingerprints SHOULD be strongly considered when matching content to users. The server MUST verify the current user's identity matches that of the desired content. This information is not sent as part of the `CHATHISTORY` command and MUST be validated via other means, such as those stated above. Access MUST be checked first and return an `NO_SUCH_NICK` or `NO_SUCH_CHANNEL` error as appropriate. If no authorization error exists, the server can check for returnable content. If no returntable content is found, the server MUST send an `NO_TEXT_TO_SEND` error. The server MUST NOT expose the existence of valid targets to unauthorized users. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. MUST send an |
||
|
||
While a `max_message_count` of 0 MAY be used to indicate no limit exists, servers SHOULD set and enforce a reasonable `max_message_count` and properly throttle `CHATHISTORY` commands to prevent abuse. | ||
|
||
## Current Implementations | ||
A ZNC-module implementation exists as [znc-chathistory](https://github.com/MuffinMedic/znc-chathistory). Client-side support for the ZNC module is in progress. Interest in supporting the batch type and command without ZNC has also been obtained, although specifics are not available at this time. | ||
|
||
Note: This module may be out of date while the specification is reviewed and modified. | ||
|
||
[batch]: http://ircv3.net/specs/extensions/batch-3.2.html | ||
[batch/chathistory]: http://ircv3.net/specs/extensions/batch/chathistory-3.3.html | ||
[server-time]: http://ircv3.net/specs/extensions/server-time-3.2.html | ||
[draft/message-tags]: http://ircv3.net/specs/extensions/message-ids.html | ||
[draft/labeled-response]: http://ircv3.net/specs/extensions/labeled-response.html |
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.
Shouldn't the spec say
draft/CHATHISTORY
command and use that in further examples? Since this spec does keepdraft/msgid
and notmsgid
in all examples.