From c1754c2e17f52c2a65bc7aeb0b5c2f1509be8138 Mon Sep 17 00:00:00 2001 From: evgeny Date: Mon, 26 Oct 2026 22:37:39 +0100 Subject: [PATCH] Dispatch correlated edit submissions through shared composer request --- src/chat/chat_core.h | 1 + src/chat/chat_msg.c | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/chat/chat_core.h b/src/chat/chat_core.h index 71dc413ea..9b0ea8c9a 100644 --- a/src/chat/chat_core.h +++ b/src/chat/chat_core.h @@ -74,6 +74,7 @@ struct chat_msg_submit { uint32_t data_len; /* размер data в байтах */ uint64_t timestamp; /* успешная отправка возвращает назначенное время */ uint8_t message_id[32]; /* успешная обычная отправка возвращает общий ID */ + uint64_t expected_ver; /* >0: trampoline редактирует message_id вместо новой отправки. */ uint8_t reply_to[32]; /* общий ID оригинала в этом канале; нули = не ответ */ uint64_t request_id; /* ненулевой ID: trampoline/media отправляет CHAT_EVT_MSG_SUBMITTED */ }; diff --git a/src/chat/chat_msg.c b/src/chat/chat_msg.c index 902fa2fd5..f27c72e10 100644 --- a/src/chat/chat_msg.c +++ b/src/chat/chat_msg.c @@ -184,7 +184,11 @@ done: void chat_core_submit_trampoline(void* arg) { struct chat_msg_submit* req = (struct chat_msg_submit*)arg; if (!req) return; - if (req->media_src[0] != '\0') + if (req->expected_ver) { + int result = chat_core_edit_message(req->inst, req->channel_id, req->message_id, + req->expected_ver, (const char*)req->data, req->data_len); + chat_event_submitted(req->inst, req->request_id, result == 0); + } else if (req->media_src[0] != '\0') chat_core_submit_media_message(req->inst, req); else { int result = chat_core_submit_message(req->inst, req);