From fb161f3d24b5416531d286d261c684d5c09ecd5a Mon Sep 17 00:00:00 2001 From: Sebastian Wolf Date: Wed, 6 Jan 2021 16:54:23 +0100 Subject: [PATCH] Take chat list type into account when receiving new chat positions --- src/tdlibreceiver.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/tdlibreceiver.cpp b/src/tdlibreceiver.cpp index d05e395..045e27e 100644 --- a/src/tdlibreceiver.cpp +++ b/src/tdlibreceiver.cpp @@ -289,11 +289,19 @@ void TDLibReceiver::processUpdateChatPosition(const QVariantMap &receivedInforma { const QString chat_id(receivedInformation.value(CHAT_ID).toString()); QVariantMap positionMap = receivedInformation.value(POSITION).toMap(); + + QString updateForChatList = positionMap.value(LIST).toMap().value(TYPE).toString(); const QString order(positionMap.value(ORDER).toString()); bool is_pinned = positionMap.value(IS_PINNED).toBool(); - LOG("Chat position updated for ID" << chat_id << "new order" << order << "is pinned" << is_pinned); - emit chatOrderUpdated(chat_id, order); - emit chatPinnedUpdated(chat_id.toLongLong(), is_pinned); + + // We are only processing main chat list updates at the moment... + if (updateForChatList == "chatListMain") { + LOG("Chat position updated for ID" << chat_id << "new order" << order << "is pinned" << is_pinned); + emit chatOrderUpdated(chat_id, order); + emit chatPinnedUpdated(chat_id.toLongLong(), is_pinned); + } else { + LOG("Received chat position update for uninteresting list" << updateForChatList << "ID" << chat_id << "new order" << order << "is pinned" << is_pinned); + } } void TDLibReceiver::processUpdateChatReadInbox(const QVariantMap &receivedInformation)