-
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 23 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,88 @@ | ||
--- | ||
title: IRCv3 chathistory extension | ||
layout: spec | ||
work-in-progress: true | ||
copyrights: | ||
- | ||
name: "Evan Magaliff" | ||
period: "2017" | ||
email: "evan@muffinmedic.net" | ||
--- | ||
## 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 `CHATHISTORY` command. Instead, implementations SHOULD use the `draft/CHATHISTORY` command to be interoperable with other software implementing a compatible work-in-progress version. | ||
|
||
The final version of the specification will use an unprefixed command. | ||
|
||
## 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/msgid`][draft/msgid] 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 a number of desired raw IRC lines equal to the `message_count` parameter specified, ending directly before the given timestamp for a negative `message_count`, after the number of messages specified for a positive `message_count`, or with the message directly proceeding the one with the specified `draft/msgid`. 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 | ||
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. Shouldn't the spec say |
||
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. Is 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. Yes, it's required. As per #292 (comment), it will be updating such that 0 can be used to indicate no limit exists. |
||
|
||
Both the `message_count` and `max_message_count` MUST be non-zero integers and `max_message_count` MUST be positive. The client should not request a `message_count` with an absolute value greater than the `max_message_count` parameter sent in the command. If the `message_count` absolute value exceeds the `max_message_count`, server should return a number of lines equal to the `max_message_count` and the appropriate warning as described 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.
|
||
|
||
#### Format | ||
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 | ||
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. The format given consistent with the server-time extension. |
||
|
||
Alternatively, content can be requested using a `draft/msgid`: | ||
|
||
@draft/label=ID CHATHISTORY target draft/msgid=ID message_count | ||
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. Can we make this format match that in other IRC specifications for consistency.
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. Also not seeing much clarification on what target can be. Is it a direct target like 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 will specify the target as a single channel or query. The use of wildcards or multiple channels becomes problematic with What would the standard format be for the 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.
Okay if there is no wildcard, I am not sure how a client would know about the unread queries they have opened for individual nicks. Is there anyway a client would be able to load the available chat history targets? znc-playback currently allows the wildcard so that clients can ask for all queries during launch so that they can load the nick queries. 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.
|
||
|
||
If `message_count` is positive, content MUST be retrieved from after and not including the specified timestamp or `draft/msgid`. If the `message_count` is negative, content MUST be retrieved from before the specified timestamp or `draft/msgid`. | ||
|
||
#### Errors and Warnings | ||
If the server receives an improperly formatted `CHATHISTORY` command, the `CMD_INVALID` error code should be returned. | ||
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. What is 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. If target can be multiple targets, is it possible to receive the |
||
|
||
If the absolute value of `message_count` 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 no `chathistory` exists to return, the server should return the appropriate error code. `ACCESS_DENIED` should be sent if the user requests content they do not have permission to view. | ||
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. Where is 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 wil get rid of it due to other privacy concerns. |
||
|
||
### Examples | ||
The examples below are written with `draft/msgid` and `draft/label` tags included. These tags are recommended. | ||
|
||
#### Begin | ||
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. Does each line need a title? |
||
@draft/label=ID :irc.host BATCH +ID chathistory target | ||
#### PRIVMSG | ||
@batch=ID;draft/msgid=ID;time=YYYY-MM-DDThh:mm:ss.sssZ :nick!ident@host PRIVMSG target :message | ||
#### NOTICE | ||
@batch=ID;draft/msgid=ID;time=YYYY-MM-DDThh:mm:ss.sssZ :nick!ident@host NOTICE target :message | ||
#### End | ||
:irc.host BATCH -ID | ||
#### Error | ||
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. You should use a separate example for errors/warnings imo. |
||
@draft/label=ID :nick!ident@host CHATHISTORY ERR ERROR_CODE | ||
#### Warning | ||
@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 that does not belong to them. 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 `ACCESS_DENIED` error as appropriate. If no `ACCESS_DENIED` error exists, the server can check for returnable content. | ||
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'm not sure this is that clear. Some history do not necessarily "belong" to an individual user. Could I not request the chat history for a public channel on a server? If I'm requesting public information I do not think any identification of the user or client needs to exist, only that the client is registered with the 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.
Using the reworded version:
While you can certainly request 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.
What would the point of requesting history if I have already seen the history because I was in the channel? I think this should be down to networks/implementors, as a network might decide that channels without 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 limitation exists to prevent retrieval of content you weren't in the channel for. If you were in there at the time the messages were originally sent, then that qualifies as content "previously available to [you]" 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.
Shouldn't this be a consideration on an IRC server and not rules enforced by the specification? An implementation of 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. Good point. Will update to:
|
||
|
||
## 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/msgid]: https://github.com/ircv3/ircv3-specifications/pull/285 | ||
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. Link can be updated to http://ircv3.net/specs/extensions/message-ids.html |
||
[draft/labeled-response]: https://github.com/ircv3/ircv3-specifications/pull/162 | ||
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 comment
The reason will be displayed to describe this comment to others. Learn more.
By support, does that mean the client should have already negotiated
batch
andserver-time
before sending the command?Should the
CHATHISTORY
command produce some error numeric when these capabilities are not negotiated?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.
draft/msgid
is a message tag and not a capability. To usedraft/msgid
message tag, the capabilitydraft/message-tags
should be enabled. (http://ircv3.net/specs/extensions/message-ids.html#dependencies)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 is that CAPS are negotiated before the ISUPPORT is sent - if the CAPs are not supported (as required by
MUST
), thenCHATHISTORY
should not appear in the 005. This is already standard behavior to my best of my knowledge.Will update capability URL.