From 20bcae5ab2d4f49faaf1bcfc425cb58229efd68e Mon Sep 17 00:00:00 2001 From: blue Date: Fri, 22 May 2020 19:28:26 +0300 Subject: [PATCH] finally history works in mucs --- core/account.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/core/account.cpp b/core/account.cpp index 0f654fa..2d70876 100644 --- a/core/account.cpp +++ b/core/account.cpp @@ -658,7 +658,8 @@ void Core::Account::onContactNeedHistory(const QString& before, const QString& a { RosterItem* contact = static_cast(sender()); - QString to = contact->jid; + QString to; + QString with; QXmppResultSetQuery query; QDateTime start; query.setMax(100); @@ -680,8 +681,14 @@ void Core::Account::onContactNeedHistory(const QString& before, const QString& a qDebug() << "Remote query for" << contact->jid << "from" << after << ", to" << before; } + if (contact->isMuc()) { + to = contact->jid; + } else { + with = contact->jid; + } - QString q = am->retrieveArchivedMessages(to, "", contact->jid, start, QDateTime(), query); + + QString q = am->retrieveArchivedMessages(to, "", with, start, QDateTime(), query); achiveQueries.insert(std::make_pair(q, contact->jid)); }