Skip to content

chathistory: add draft/chathistory-end tag#598

Open
emersion wants to merge 2 commits intoircv3:masterfrom
emersion:chathistory-end
Open

chathistory: add draft/chathistory-end tag#598
emersion wants to merge 2 commits intoircv3:masterfrom
emersion:chathistory-end

Conversation

@emersion
Copy link
Copy Markdown
Contributor

@emersion emersion commented Apr 9, 2026

@slingamn
Copy link
Copy Markdown
Contributor

slingamn commented Apr 10, 2026

From #437, should we warn clients that a response with fewer than <limit> messages does not indicate the last page? (To avoid compatibility issues with existing clients, I wouldn't change the Ergo behavior to start sending short non-final pages until ratification.)

@emersion
Copy link
Copy Markdown
Contributor Author

I've pushed a suggestion to that effect. I've chosen to spec that servers SHOULD apply the exact limit, because a server completely ignoring the limit would cause havoc - is that too strong for your taste?

@slingamn
Copy link
Copy Markdown
Contributor

SHOULD does seem a little strong to me because there are conditions where Ergo will predictably violate the limit (for example, relaying stored multiline messages to non-multiline-capable clients). I expect other servers will run into similar conditions.

That said, I don't have very strong feelings, and the current language gives servers explicit permission to deviate.

@emersion
Copy link
Copy Markdown
Contributor Author

If you have ideas for an alternative wording, please feel free to suggest!

MrLenin added a commit to MrLenin/hexchat that referenced this pull request Apr 12, 2026
Parse the draft/chathistory-end tag from BATCH START lines and use it
to set history_exhausted immediately, avoiding an extra empty-batch
round-trip. Existing heuristics (empty batch, stale count) remain as
fallback for servers that don't send the tag.

See ircv3/ircv3-specifications#598

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@slingamn
Copy link
Copy Markdown
Contributor

I think basically just reversing the capitalization:

A limit parameter MUST be a positive integer. Servers should attempt to return exactly limit messages (or as many are available), but MAY return more or fewer due to implementation constraints. The draft/chathistory-end tag indicates whether more messages are available.

@emersion
Copy link
Copy Markdown
Contributor Author

Works for me, I've pushed this wording!

Comment thread extensions/chathistory.md Outdated

A `timestamp` parameter MUST have the format `timestamp=YYYY-MM-DDThh:mm:ss.sssZ`, as in the [server-time][server-time] extension. A `msgid` parameter MUST have the format `msgid=foobar`, as in the [message-ids][message-ids] extension.

A `limit` parameter MUST be a positive integer. Server should attempt to return exactly `limit` messages (or as many as available), but MAY return more or fewer due to implementation constraints. The `draft/chathistory-end` tag indicates whether more messages are available.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Servers" plural, I think

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, fixed!

ValwareIRC added a commit to ValwareIRC/unrealircd that referenced this pull request Apr 27, 2026
…cations#598)

When a CHATHISTORY (or TARGETS) response contains fewer messages than
the requested limit, attach the draft/chathistory-end tag to the BATCH
opener to signal end-of-pagination to the client.

- Register a MessageTagHandler for draft/chathistory-end in the
  chathistory module, tied to the draft/chathistory capability so the
  tag is only delivered to capable clients
- history_send_result() gains an end_of_pagination parameter; when true,
  the tag is attached to the 'BATCH +ID chathistory' opener
- chathistory_targets() attaches the tag to the
  'BATCH +ID draft/chathistory-targets' opener when the target count is
  below the requested limit
- cmd_chathistory() counts logical head-messages in the result and sets
  end_of_pagination when the count is below filter->limit
- Auto-playback callers (chanmodes/history.c, history.c) pass 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants