From b771e95997f539598fd291ac3bf2ad7b6193414f Mon Sep 17 00:00:00 2001 From: evgeny Date: Mon, 5 Oct 2026 21:28:45 +0200 Subject: [PATCH] Clear legacy GUI bridge and list messages from debug --- tools/chatgui/src/accountlist.cpp | 6 +----- tools/chatgui/src/channellist.cpp | 10 ++++----- tools/chatgui/transport/gui_bridge_impl.cpp | 23 +++++++++++---------- 3 files changed, 18 insertions(+), 21 deletions(-) diff --git a/tools/chatgui/src/accountlist.cpp b/tools/chatgui/src/accountlist.cpp index dc926878..f7d771ba 100644 --- a/tools/chatgui/src/accountlist.cpp +++ b/tools/chatgui/src/accountlist.cpp @@ -96,10 +96,6 @@ AccountList::AccountList(DbManager* db, QWidget *parent) m_listView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); m_listView->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel); m_listView->setContextMenuPolicy(Qt::CustomContextMenu); - DEBUG_DEBUG(DEBUG_CATEGORY_DEBUG, "AccountList: mouse_tracking=%d background=%s hover=%s selected=%s", - m_listView->hasMouseTracking(), qPrintable(m_listView->palette().alternateBase().color().name()), - qPrintable(m_listView->palette().alternateBase().color().lighter(115).name()), - qPrintable(m_listView->palette().highlight().color().name())); m_detailPanel = new QWidget(this); auto* detailLayout = new QVBoxLayout(m_detailPanel); detailLayout->setContentsMargins(0, 0, 0, 0); @@ -286,7 +282,7 @@ void AccountList::showMemberDetail(quint64 nodeId) { void AccountList::requestMemberDetail() { if (m_detailNodeId == 0) return; struct chat_node_arg* arg = (struct chat_node_arg*)u_malloc(sizeof(struct chat_node_arg)); - if (!arg) { DEBUG_WARN(DEBUG_CATEGORY_DEBUG, "AccountList: req alloc failed"); return; } + if (!arg) { DEBUG_WARN(DEBUG_CATEGORY_CONNECTION, "AccountList: req alloc failed"); return; } arg->inst = gui_bridge_get_inst(); arg->node_id = m_detailNodeId; gui_bridge_post_uasync_fn(chat_core_collect_member_detail_trampoline, arg); diff --git a/tools/chatgui/src/channellist.cpp b/tools/chatgui/src/channellist.cpp index a9b21ba4..5759891c 100644 --- a/tools/chatgui/src/channellist.cpp +++ b/tools/chatgui/src/channellist.cpp @@ -295,7 +295,7 @@ void ChannelList::loadChannels() { item->setData(ch.lastMsgAt, ChannelLastMsgAtRole); item->setData(makeChannelIcon(colors[ci % 6], letter), ChannelIconRole); m_model->appendRow(item); - DEBUG_DEBUG(DEBUG_CATEGORY_DEBUG, "ChannelList::loadChannels row=%d cid='%s' name='%s' unread=%d lastMsgAt=%lld", + DEBUG_DEBUG(DEBUG_CATEGORY_CHAT, "ChannelList::loadChannels row=%d cid='%s' name='%s' unread=%d lastMsgAt=%lld", m_model->rowCount()-1, qPrintable(ch.channelId), qPrintable(ch.name), ch.unreadCount, (long long)ch.lastMsgAt); ci++; @@ -325,7 +325,7 @@ void ChannelList::loadChannels() { item->setData(dm.lastTs, ChannelLastMsgAtRole); item->setData(makeChannelIcon(dmColor, letter), ChannelIconRole); m_model->appendRow(item); - DEBUG_DEBUG(DEBUG_CATEGORY_DEBUG, "ChannelList::loadChannels dm row=%d conv='%s' peer='%s'", + DEBUG_DEBUG(DEBUG_CATEGORY_DM, "ChannelList::loadChannels dm row=%d conv='%s' peer='%s'", m_model->rowCount()-1, qPrintable(dm.convId), qPrintable(name)); } } @@ -368,7 +368,7 @@ void ChannelList::setChannelPeersOnline(const QString& channelId, int count) { } } if (!found) - DEBUG_DEBUG(DEBUG_CATEGORY_DEBUG, " NOT FOUND in model"); + DEBUG_DEBUG(DEBUG_CATEGORY_CHAT, "ChannelList: channel=%s not found in model", qPrintable(channelId)); } void ChannelList::setAutoConnectActive(bool active) { @@ -384,14 +384,14 @@ void ChannelList::setChannelUnreadCount(const QString& channelId, int count) { QStandardItem* item = m_model->item(row); if (item && item->data(ChannelChannelIdRole).toString() == channelId) { int old = item->data(ChannelUnreadCountRole).toInt(); - DEBUG_DEBUG(DEBUG_CATEGORY_DEBUG, "ChannelList::setChannelUnreadCount ch=%s %d->%d", + DEBUG_DEBUG(DEBUG_CATEGORY_CHAT, "ChannelList::setChannelUnreadCount ch=%s %d->%d", qPrintable(channelId), old, count); item->setData(count, ChannelUnreadCountRole); emit m_model->dataChanged(m_model->index(row, 0), m_model->index(row, 0)); return; } } - DEBUG_DEBUG(DEBUG_CATEGORY_DEBUG, "ChannelList::setChannelUnreadCount ch=%s not found", qPrintable(channelId)); + DEBUG_DEBUG(DEBUG_CATEGORY_CHAT, "ChannelList::setChannelUnreadCount ch=%s not found", qPrintable(channelId)); } int ChannelList::getChannelUnreadCount(const QString& channelId) const { diff --git a/tools/chatgui/transport/gui_bridge_impl.cpp b/tools/chatgui/transport/gui_bridge_impl.cpp index 05e40089..ed146ca9 100644 --- a/tools/chatgui/transport/gui_bridge_impl.cpp +++ b/tools/chatgui/transport/gui_bridge_impl.cpp @@ -104,10 +104,10 @@ void GuiBridgeReceiver::processPost(int eventType, QByteArray data) { qPrintable(chId), (unsigned long long)author); if (g_msg_received_cb) g_msg_received_cb((const char*)d + 1, chLen, author); } else { - DEBUG_WARN(DEBUG_CATEGORY_DEBUG, "gui_bridge: MSG_RECEIVED invalid data length %d", dlen); + DEBUG_WARN(DEBUG_CATEGORY_CHAT, "gui_bridge: MSG_RECEIVED invalid data length %d", dlen); } } else { - DEBUG_WARN(DEBUG_CATEGORY_DEBUG, "gui_bridge: MSG_RECEIVED data too short %d", dlen); + DEBUG_WARN(DEBUG_CATEGORY_CHAT, "gui_bridge: MSG_RECEIVED data too short %d", dlen); } break; case GUI_EVT_CONNECT_RESULT: @@ -118,7 +118,7 @@ void GuiBridgeReceiver::processPost(int eventType, QByteArray data) { (unsigned long long)nodeId, (unsigned long long)channelId, result); if (g_connect_result_cb) g_connect_result_cb(nodeId, channelId, result); } else { - DEBUG_WARN(DEBUG_CATEGORY_DEBUG, "gui_bridge: CONNECT_RESULT data too short %d", dlen); + DEBUG_WARN(DEBUG_CATEGORY_CONNECTION, "gui_bridge: CONNECT_RESULT data too short %d", dlen); } break; case GUI_EVT_NEW_PEER: @@ -126,7 +126,7 @@ void GuiBridgeReceiver::processPost(int eventType, QByteArray data) { uint64_t nodeId; memcpy(&nodeId, d, 8); DEBUG_INFO(DEBUG_CATEGORY_MEMBER_SYNC, "gui_bridge: NEW_PEER node=0x%016llx", (unsigned long long)nodeId); } else { - DEBUG_WARN(DEBUG_CATEGORY_DEBUG, "gui_bridge: NEW_PEER data too short %d", dlen); + DEBUG_WARN(DEBUG_CATEGORY_CONNECTION, "gui_bridge: NEW_PEER data too short %d", dlen); } break; case GUI_EVT_CHANNEL_UPDATED: @@ -138,7 +138,7 @@ void GuiBridgeReceiver::processPost(int eventType, QByteArray data) { if (g_channel_updated_cb) g_channel_updated_cb((const char*)d + 1, chLen); } } else { - DEBUG_WARN(DEBUG_CATEGORY_DEBUG, "gui_bridge: CHANNEL_UPDATED data too short %d", dlen); + DEBUG_WARN(DEBUG_CATEGORY_CHAT, "gui_bridge: CHANNEL_UPDATED data too short %d", dlen); } break; case GUI_EVT_MY_NODE_ID: @@ -186,7 +186,7 @@ void GuiBridgeReceiver::processPost(int eventType, QByteArray data) { uint64_t nodeId; memcpy(&nodeId, d, 8); DEBUG_INFO(DEBUG_CATEGORY_MEMBER_SYNC, "gui_bridge: NODE_CHANGED node=0x%016llx — pubkey changed, connection closed", (unsigned long long)nodeId); } else { - DEBUG_WARN(DEBUG_CATEGORY_DEBUG, "gui_bridge: NODE_CHANGED data too short %d", dlen); + DEBUG_WARN(DEBUG_CATEGORY_CONNECTION, "gui_bridge: NODE_CHANGED data too short %d", dlen); } break; case GUI_EVT_ATTACHMENT_DOWNLOADED: @@ -194,7 +194,7 @@ void GuiBridgeReceiver::processPost(int eventType, QByteArray data) { uint8_t chLen = d[0]; if (dlen >= 1 + chLen + 8) { int64_t msgId = 0; memcpy(&msgId, d + 1 + chLen, 8); - DEBUG_INFO(DEBUG_CATEGORY_DEBUG, "gui_bridge: ATTACHMENT_DOWNLOADED ch=%.*s msgId=%lld", chLen, (const char*)d + 1, (long long)msgId); + DEBUG_INFO(DEBUG_CATEGORY_MEDIA, "gui_bridge: ATTACHMENT_DOWNLOADED ch=%.*s msgId=%lld", chLen, (const char*)d + 1, (long long)msgId); if (g_attachment_downloaded_cb) g_attachment_downloaded_cb((const char*)d + 1, chLen, msgId); } } @@ -205,7 +205,8 @@ void GuiBridgeReceiver::processPost(int eventType, QByteArray data) { if (dlen >= 1 + chLen + 16) { int64_t msgId = 0; memcpy(&msgId, d + 1 + chLen, 8); int32_t bd = 0, nb = 0; memcpy(&bd, d + 1 + chLen + 8, 4); memcpy(&nb, d + 1 + chLen + 12, 4); - DEBUG_INFO(DEBUG_CATEGORY_DEBUG, "gui_bridge: DOWNLOAD_PROGRESS ch=%.*s msgId=%lld %d/%d", chLen, (const char*)d + 1, (long long)msgId, bd, nb); + DEBUG_DEBUG(DEBUG_CATEGORY_MEDIA, "gui_bridge: DOWNLOAD_PROGRESS ch=%.*s msgId=%lld %d/%d", + chLen, (const char*)d + 1, (long long)msgId, bd, nb); if (g_download_progress_cb) g_download_progress_cb((const char*)d + 1, chLen, msgId, bd, nb); } } @@ -379,7 +380,7 @@ void GuiBridgeReceiver::processPost(int eventType, QByteArray data) { } break; default: - DEBUG_WARN(DEBUG_CATEGORY_DEBUG, "gui_bridge: unknown event type %d", eventType); + DEBUG_WARN(DEBUG_CATEGORY_GENERAL, "gui_bridge: unknown event type %d", eventType); break; } } @@ -407,7 +408,7 @@ struct UTUN_INSTANCE* gui_bridge_get_inst(void) { } void gui_bridge_post(int event_type, const uint8_t* data, int data_len) { - if (!g_receiver) { DEBUG_WARN(DEBUG_CATEGORY_DEBUG, "gui_bridge_post: g_receiver=NULL, dropping event %d", event_type); return; } + if (!g_receiver) { DEBUG_WARN(DEBUG_CATEGORY_GENERAL, "gui_bridge_post: g_receiver=NULL, dropping event %d", event_type); return; } QByteArray d; if (data_len > 0) d = QByteArray((const char*)data, data_len); @@ -420,7 +421,7 @@ void gui_bridge_post(int event_type, const uint8_t* data, int data_len) { void gui_bridge_post_uasync_fn(void (*fn)(void*), void* arg) { if (!g_ua) { - DEBUG_WARN(DEBUG_CATEGORY_DEBUG, "gui_bridge_post_uasync_fn: g_ua=NULL, post dropped"); + DEBUG_WARN(DEBUG_CATEGORY_GENERAL, "gui_bridge_post_uasync_fn: g_ua=NULL, post dropped"); return; } if (!fn) return;