From 53d56278edfaf0542a2b3e67ca59403e7cf58f27 Mon Sep 17 00:00:00 2001 From: shunf4 Date: Sun, 11 Jul 2021 19:07:49 +0800 Subject: [PATCH] gen id for message without id --- core/account.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/core/account.cpp b/core/account.cpp index 094fd3c..ab7403b 100644 --- a/core/account.cpp +++ b/core/account.cpp @@ -19,6 +19,7 @@ #include "account.h" #include #include +#include "shared/utils.h" using namespace Core; @@ -405,9 +406,13 @@ void Core::Account::sendMessage(const Shared::Message& data) { void Core::Account::sendMessage(const Shared::Message& data, const QString& path) { mh->sendMessage(data, path);} -void Core::Account::onMamMessageReceived(const QString& queryId, const QXmppMessage& msg) +void Core::Account::onMamMessageReceived(const QString& queryId, const QXmppMessage& msgConst) { - if (msg.id().size() > 0 && (msg.body().size() > 0 || msg.outOfBandUrl().size() > 0)) { + QXmppMessage msg(msgConst); + if (msg.id().size() == 0) { + msg.setId(Shared::generateUUID() + QStringLiteral("-squawkgenerated")); + } + if ((msg.body().size() > 0 || msg.outOfBandUrl().size() > 0)) { std::map::const_iterator itr = archiveQueries.find(queryId); if (itr != archiveQueries.end()) { QString jid = itr->second;