1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-07-04 17:53:11 +02:00

Fix CHATHISTORY TARGETS sending one target too little if limit is hit

And attach draft/chathistory-end when exactly 'limit' targets exist
and nothing more.
This commit is contained in:
Bram Matthys
2026-06-19 21:30:47 +02:00
parent 37977fcfe6
commit 570c32ea67
+2 -2
View File
@@ -219,7 +219,7 @@ void chathistory_targets(Client *client, HistoryFilter *filter, int limit)
/* Start a new batch */
MessageTag *batch_open_mtags = NULL;
generate_batch_id(batch);
if (sent < limit)
if (sent <= limit)
{
batch_open_mtags = safe_alloc(sizeof(MessageTag));
safe_strdup(batch_open_mtags->name, "draft/chathistory-end");
@@ -233,7 +233,7 @@ void chathistory_targets(Client *client, HistoryFilter *filter, int limit)
for (; targets; targets = targets_next)
{
targets_next = targets->next;
if (++sent < limit)
if (sent++ < limit)
chathistory_targets_send_line(client, targets, batch);
safe_free(targets->datetime);
safe_free(targets->object);