перенос chat-логики из chatgui/transport в src/chat/
- Создан src/chat/ с chat_event.h/c — система нотификаций - Перенесены chat_core, chat_msg, chat_channel, chat_profile, chat_status - Перенесены chat_sync, member_sync, merkle_sync, db_sync - gui_bridge_post() заменён на chat_event_post() с возможностью регистрации обработчика - chat_event_set_handler() — chatgui регистрирует мост в gui_bridge - Без обработчика: события логируются через DEBUG_DEBUG + log_dump - chat интегрирован в utun_instance.c (при db_path в конфиге) - Обновлены include-пути, Makefile.am, CMakeLists.txt - Из chatgui удалены старые transport/ файлы, обновлён utun_node.cpp
This commit is contained in:
1 parent
4595052b5b
commit
ed6132fcda
25 files changed
+262
-165
No files matched your search
@@ -22,10 +22,11 @@ extern "C" {
|
||||
#include "../lib/memory_pool.h"
|
||||
#include "../lib/debug_config.h"
|
||||
#include "../lib/mem.h"
|
||||
#include "chat_sync.h"
|
||||
#include "chat_core.h"
|
||||
#include "db_sync.h"
|
||||
#include "gui_bridge.h"
|
||||
#include "chat/chat_sync.h"
|
||||
#include "chat/chat_core.h"
|
||||
#include "chat/chat_event.h"
|
||||
#include "db_sync.h"
|
||||
#include "gui_bridge.h"
|
||||
#include "topo_node_sqlite.h"
|
||||
#include "topo_node.h"
|
||||
#include "topo_group.h"
|
||||
@@ -342,9 +343,14 @@ void UtunNode::runLoop() {
|
||||
|
||||
etcp_router_bind(m_instance, ETCP_RT_ID_CHAT, recvCallback);
|
||||
|
||||
/* Bridge chat events to GUI via gui_bridge */
|
||||
chat_event_set_handler([](int type, const uint8_t* data, int len) {
|
||||
gui_bridge_post(type, data, len);
|
||||
});
|
||||
|
||||
/* Initialize chat_core (DB) and chat_sync (channel/message P2P sync) */
|
||||
chat_core_init(m_instance, QString(m_dbPath + "/chats.db").toUtf8().constData());
|
||||
chat_sync_init(m_instance, nullptr);
|
||||
chat_sync_init(m_instance);
|
||||
|
||||
DEBUG_INFO(DEBUG_CATEGORY_DEBUG, "chat_core + chat_sync initialized");
|
||||
DEBUG_INFO(DEBUG_CATEGORY_DEBUG, "utun_node: entering poll loop");
|
||||
|
||||
Reference in new issue
Block a user