Browse Source

Forward pinned attachment preparation events to Qt

master
evgeny 1 day ago
parent
commit
55b21fdcda
  1. 2
      tools/chatgui/transport/gui_bridge.h
  2. 8
      tools/chatgui/transport/gui_bridge_impl.cpp

2
tools/chatgui/transport/gui_bridge.h

@ -226,6 +226,8 @@ void gui_bridge_set_dm_conv_updated_cb(gui_dm_conv_updated_fn cb);
* data: [conv_id_len:1][conv_id:var][count:2]([dir:1][seq:8][ts:8][author:8][ct_len:1][ct:var][data_len:2][data:var])* */
typedef void (*gui_dm_messages_fn)(const uint8_t* data, int len);
void gui_bridge_set_dm_messages_cb(gui_dm_messages_fn cb);
/* CHAT_EVT_ATTACHMENT_PREPARATION: target + job UUID + state. */
void gui_bridge_set_attachment_preparation_cb(gui_dm_messages_fn cb);
/* uTun nodeinfo callback — registered via utun_add_nodeinfo_cbk, called from uasync thread */
void gui_nodeinfo_cb_impl(struct TOPO_GROUP* group, struct TOPO_GROUP_NODE* nq, void* arg);

8
tools/chatgui/transport/gui_bridge_impl.cpp

@ -61,6 +61,7 @@ static gui_radio_talk_fn g_radio_talk_cb = nullptr;
static gui_dm_msg_received_fn g_dm_msg_received_cb = nullptr;
static gui_dm_conv_updated_fn g_dm_conv_updated_cb = nullptr;
static gui_dm_messages_fn g_dm_messages_cb = nullptr;
static gui_dm_messages_fn g_attachment_preparation_cb = nullptr;
static struct UASYNC* g_ua = nullptr;
static struct UTUN_INSTANCE* g_inst = nullptr;
@ -270,6 +271,9 @@ void GuiBridgeReceiver::processPost(int eventType, QByteArray data) {
case GUI_EVT_DM_MESSAGES:
if (g_dm_messages_cb) g_dm_messages_cb(d, dlen);
break;
case CHAT_EVT_ATTACHMENT_PREPARATION:
if (g_attachment_preparation_cb) g_attachment_preparation_cb(d, dlen);
break;
case GUI_EVT_CALL_INCOMING:
if (dlen >= 1 + 8 + 8) {
uint8_t chLen = d[0];
@ -542,6 +546,10 @@ void gui_bridge_set_dm_messages_cb(gui_dm_messages_fn cb) {
g_dm_messages_cb = cb;
}
void gui_bridge_set_attachment_preparation_cb(gui_dm_messages_fn cb) {
g_attachment_preparation_cb = cb;
}
} /* extern "C" */
/* ── uTun nodeinfo callback (called from uasync thread) ── */

Loading…
Cancel
Save