2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-09-04 16:45:12 +00:00

Load dialogs list in ApiWrap and Data::Session.

This commit is contained in:
John Preston
2019-04-16 20:28:41 +04:00
parent 927735dff2
commit 305a611211
10 changed files with 311 additions and 247 deletions

View File

@@ -1813,7 +1813,7 @@ void DialogsInner::applyDialog(const MTPDdialog &dialog) {
if (!history->useProxyPromotion() && !history->isPinnedDialog()) {
const auto date = history->chatListTimeId();
if (date != 0) {
addSavedPeersAfter(ParseDateTime(date));
session().data().addSavedPeersAfter(ParseDateTime(date));
}
}
if (const auto from = history->peer->migrateFrom()) {
@@ -1834,27 +1834,11 @@ void DialogsInner::applyFolderDialog(const MTPDdialogFolder &dialog) {
if (!folder->useProxyPromotion() && !folder->isPinnedDialog()) {
const auto date = folder->chatListTimeId();
if (date != 0) {
addSavedPeersAfter(ParseDateTime(date));
session().data().addSavedPeersAfter(ParseDateTime(date));
}
}
}
void DialogsInner::addSavedPeersAfter(const QDateTime &date) {
auto &saved = cRefSavedPeersByTime();
while (!saved.isEmpty() && (date.isNull() || date < saved.lastKey())) {
const auto lastDate = saved.lastKey();
const auto lastPeer = saved.last();
saved.remove(lastDate, lastPeer);
const auto history = session().data().history(lastPeer);
history->setChatListTimeId(ServerTimeFromParsed(lastDate));
}
}
void DialogsInner::addAllSavedPeers() {
addSavedPeersAfter(QDateTime());
}
bool DialogsInner::uniqueSearchResults() const {
return session().supportMode()
&& !session().settings().supportAllSearchResults()