finally history works in mucs

This commit is contained in:
Blue 2020-05-22 19:28:26 +03:00
parent 6b65910ded
commit 20bcae5ab2

View File

@ -658,7 +658,8 @@ void Core::Account::onContactNeedHistory(const QString& before, const QString& a
{ {
RosterItem* contact = static_cast<RosterItem*>(sender()); RosterItem* contact = static_cast<RosterItem*>(sender());
QString to = contact->jid; QString to;
QString with;
QXmppResultSetQuery query; QXmppResultSetQuery query;
QDateTime start; QDateTime start;
query.setMax(100); 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; 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)); achiveQueries.insert(std::make_pair(q, contact->jid));
} }