Merge pull request 'fix: request latest history' (#54) from shunf4/squawk:fix/correctly_query_history into messageFeed

Reviewed-on: blue/squawk#54
This commit is contained in:
Blue 2021-10-16 15:37:59 +00:00
commit aeaa6b1b28

View File

@ -469,6 +469,14 @@ void Core::Account::onContactNeedHistory(const QString& before, const QString& a
query.setAfter(after); query.setAfter(after);
} }
} }
if (before.size() == 0 && after.size() == 0) {
// https://xmpp.org/extensions/xep-0313.html#sect-idm46556759682304
// To request the page at the end of the archive
// (i.e. the most recent messages), include just an
// empty <before/> element in the RSM part of the query.
// As defined by RSM, this will return the last page of the archive.
query.setBefore("");
}
qDebug() << "Remote query for" << contact->jid << "from" << after << ", to" << before; qDebug() << "Remote query for" << contact->jid << "from" << after << ", to" << before;
} }