Browse Source

Evaluate delayed answers after their source message arrives

master
evgeny 7 days ago
parent
commit
17444b8c8a
  1. 3
      src/chat/chat_core_priv.h
  2. 5
      src/chat/chat_msg.c

3
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) ── */

5
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);

Loading…
Cancel
Save