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