From 570c32ea6705ccf3f9907fa67c78320707e1e8cb Mon Sep 17 00:00:00 2001 From: Bram Matthys Date: Fri, 19 Jun 2026 21:30:47 +0200 Subject: [PATCH] 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. --- src/modules/chathistory.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/chathistory.c b/src/modules/chathistory.c index ed04447df..929677ddd 100644 --- a/src/modules/chathistory.c +++ b/src/modules/chathistory.c @@ -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);