chatgui: pass author node_id in MSG_RECEIVED event, skip sound for own messages

Add author_node_id:8 to GUI_EVT_MSG_RECEIVED data format.
Callback now includes uint64_t author parameter.
SoundManager::play('msg_incoming') only when author != myNodeId.
This commit is contained in:
Evgeny committed 2026-07-24 03:22:10 +03:00
1 parent 37c5fa5607
commit 6ef21613c8
6 files changed
+37 -31

No files matched your search

+7 -6
View File
@@ -31,10 +31,10 @@ extern "C" {
static MainWindow* s_mainWindow = nullptr;
static void onMsgReceivedCallback(const char* ch_id, int ch_id_len) {
static void onMsgReceivedCallback(const char* ch_id, int ch_id_len, uint64_t author) {
Q_UNUSED(ch_id_len);
if (s_mainWindow)
s_mainWindow->onMessageReceived(ch_id);
s_mainWindow->onMessageReceived(ch_id, author);
}
static void onChannelUpdatedCallback(const char* ch_id, int ch_id_len) {
@@ -326,11 +326,12 @@ void MainWindow::showSettings() {
dlg.exec();
}
void MainWindow::onMessageReceived(const char* ch_id) {
void MainWindow::onMessageReceived(const char* ch_id, uint64_t author) {
QString cid = QString::fromUtf8(ch_id);
DEBUG_INFO(DEBUG_CATEGORY_DEBUG, "MainWindow::onMessageReceived ch=%s cur=%s",
qPrintable(cid), qPrintable(m_currentChannelId));
SoundManager::instance()->play("msg_incoming");
DEBUG_INFO(DEBUG_CATEGORY_DEBUG, "MainWindow::onMessageReceived ch=%s author=%llu cur=%s",
qPrintable(cid), (unsigned long long)author, qPrintable(m_currentChannelId));
if (m_db && author != m_db->myNodeId())
SoundManager::instance()->play("msg_incoming");
if (m_messageList) {
if (cid == m_currentChannelId) {
m_messageList->refresh();