From 17444b8c8a2e8700ee5ca2b908022b055b2e42a8 Mon Sep 17 00:00:00 2001 From: evgeny Date: Tue, 6 Oct 2026 21:24:14 +0200 Subject: [PATCH] Evaluate delayed answers after their source message arrives --- src/chat/chat_core_priv.h | 3 ++- src/chat/chat_msg.c | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/chat/chat_core_priv.h b/src/chat/chat_core_priv.h index ac67a75b..1183cb32 100644 --- a/src/chat/chat_core_priv.h +++ b/src/chat/chat_core_priv.h @@ -115,7 +115,8 @@ void si_register(struct UTUN_INSTANCE* inst, struct DB_SYNC_INSTANCE* si, const /* ── db_sync callback (chat_msg.c) ── */ -void on_msg_inserted(struct DB_SYNC_INSTANCE* si, uint64_t record_ts, const char* data, size_t len, uint64_t author, int initial_sync, void* arg); +void on_msg_inserted(struct DB_SYNC_INSTANCE* si, const uint8_t message_id[32], uint64_t record_ts, + const char* data, size_t len, uint64_t author, int initial_sync, void* arg); /* ── применить настройку group_autoconnect ко всем CHAT-группам (chat_channel.c) ── */ diff --git a/src/chat/chat_msg.c b/src/chat/chat_msg.c index f5a5e8b3..fa099c06 100644 --- a/src/chat/chat_msg.c +++ b/src/chat/chat_msg.c @@ -7,6 +7,7 @@ #include "chat_core_priv.h" #include "chat_event.h" #include "chat_feedback.h" +#include "chat_poll.h" #include "chat_setting.h" #include "chat_whisper.h" @@ -849,11 +850,13 @@ static int md_auto_download(struct UTUN_INSTANCE* inst, /* ─── db_sync callback ─── */ -void on_msg_inserted(struct DB_SYNC_INSTANCE* si, uint64_t record_ts, const char* data, size_t len, uint64_t author, int initial_sync, void* arg) { +void on_msg_inserted(struct DB_SYNC_INSTANCE* si, const uint8_t message_id[32], uint64_t record_ts, + const char* data, size_t len, uint64_t author, int initial_sync, void* arg) { struct UTUN_INSTANCE* inst = arg; struct chat_core_ctx* cc = CC(inst); if (!cc) return; char ch_id[32]; snprintf(ch_id, sizeof(ch_id), "%llu", (unsigned long long)db_sync_instance_group_id(si)); + chat_feedback_check_message(inst, ch_id, message_id); uint8_t evt[73]; uint8_t cl = (uint8_t)strlen(ch_id); evt[0] = cl; memcpy(evt + 1, ch_id, cl); memcpy(evt + 1 + cl, &author, 8); chat_event_post(inst, CHAT_EVT_MSG_RECEIVED, evt, 1 + cl + 8);