Expose initial synchronization in channel message events
This commit is contained in:
1 parent
e55240605a
commit
72e043d208
3 files changed
+5
-4
No files matched your search
@@ -21,7 +21,7 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
/* Типы событий (совпадают с GUI_EVT_* в gui_bridge.h для прямой совместимости) */
|
||||
#define CHAT_EVT_MSG_RECEIVED 1 /* [ch_id_len:1][ch_id:var][author_node_id:8] */
|
||||
#define CHAT_EVT_MSG_RECEIVED 1 /* [ch_id_len:1][ch_id:var][author_node_id:8][initial_sync:1] */
|
||||
#define CHAT_EVT_CONNECT_RESULT 2 /* [node_id:8][result:4][channel_id:8] */
|
||||
#define CHAT_EVT_NEW_PEER 3 /* [node_id:8] */
|
||||
#define CHAT_EVT_CHANNEL_UPDATED 4 /* [ch_id_len:1][ch_id:var] */
|
||||
|
||||
+2
-1
@@ -859,7 +859,8 @@ void on_msg_inserted(struct DB_SYNC_INSTANCE* si, const uint8_t message_id[32],
|
||||
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);
|
||||
evt[1 + cl + 8] = initial_sync != 0;
|
||||
chat_event_post(inst, CHAT_EVT_MSG_RECEIVED, evt, 1 + cl + 9);
|
||||
|
||||
/* auto-download media if message contains media metadata (live PUSH/local only).
|
||||
initial-sync (SEND_DATA) media докачивается после sync через per-channel backfill. */
|
||||
|
||||
@@ -19,7 +19,7 @@ struct UTUN_INSTANCE;
|
||||
|
||||
/* ── Типы уведомлений uasync→GUI (fire-and-forget) ── */
|
||||
|
||||
#define GUI_EVT_MSG_RECEIVED 1 /* data: [ch_id_len:1][ch_id:var][author_node_id:8] */
|
||||
#define GUI_EVT_MSG_RECEIVED 1 /* data: [ch_id_len:1][ch_id:var][author_node_id:8][initial_sync:1] */
|
||||
#define GUI_EVT_CONNECT_RESULT 2 /* data: [node_id:8][result:4][channel_id:8] */
|
||||
#define GUI_EVT_NEW_PEER 3 /* data: [node_id:8] */
|
||||
#define GUI_EVT_CHANNEL_UPDATED 4 /* data: [ch_id_len:1][ch_id:var] */
|
||||
@@ -93,7 +93,7 @@ typedef void (*gui_connect_result_fn)(uint64_t node_id, uint64_t channel_id, int
|
||||
void gui_bridge_set_connect_result_cb(gui_connect_result_fn cb);
|
||||
|
||||
/* Callback для входящих сообщений (вызывается из GUI-потока) */
|
||||
typedef void (*gui_msg_received_fn)(const char* ch_id, int ch_id_len, uint64_t author);
|
||||
typedef void (*gui_msg_received_fn)(const char* ch_id, int ch_id_len, uint64_t author, int initial_sync);
|
||||
void gui_bridge_set_msg_received_cb(gui_msg_received_fn cb);
|
||||
|
||||
/* Callback для обновления канала (вызывается из GUI-потока) */
|
||||
|
||||
Reference in new issue
Block a user