From 20b773ac592ac60827b6a256beecb42babfdbfe8 Mon Sep 17 00:00:00 2001 From: Sebastian Wolf Date: Mon, 23 Nov 2020 20:53:43 +0100 Subject: [PATCH] Check contacts requested via extra-attribute --- qml/pages/NewChatPage.qml | 1 - src/tdlibwrapper.cpp | 7 +++---- src/tdlibwrapper.h | 1 - 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/qml/pages/NewChatPage.qml b/qml/pages/NewChatPage.qml index 606710d..42b3933 100644 --- a/qml/pages/NewChatPage.qml +++ b/qml/pages/NewChatPage.qml @@ -96,7 +96,6 @@ Page { tertiaryText { maximumLineCount: 1 text: Functions.getChatPartnerStatusText(modelData.status["@type"], modelData.status.was_online); - elide: Text.ElideRight } onClicked: { diff --git a/src/tdlibwrapper.cpp b/src/tdlibwrapper.cpp index 91d5fa0..84634fe 100644 --- a/src/tdlibwrapper.cpp +++ b/src/tdlibwrapper.cpp @@ -44,7 +44,7 @@ namespace { const QString _EXTRA("@extra"); } -TDLibWrapper::TDLibWrapper(AppSettings *appSettings, MceInterface *mceInterface, QObject *parent) : QObject(parent), joinChatRequested(false), contactsRequested(false) +TDLibWrapper::TDLibWrapper(AppSettings *appSettings, MceInterface *mceInterface, QObject *parent) : QObject(parent), joinChatRequested(false) { LOG("Initializing TD Lib..."); this->appSettings = appSettings; @@ -793,9 +793,9 @@ void TDLibWrapper::getDeepLinkInfo(const QString &link) void TDLibWrapper::getContacts() { LOG("Retrieving contacts"); - this->contactsRequested = true; QVariantMap requestObject; requestObject.insert(_TYPE, "getContacts"); + requestObject.insert(_EXTRA, "contactsRequested"); this->sendRequest(requestObject); } @@ -1187,9 +1187,8 @@ void TDLibWrapper::handleOpenWithChanged() void TDLibWrapper::handleUsersReceived(const QString &extra, const QVariantList &userIds, int totalUsers) { - if (this->contactsRequested) { + if (extra == "contactsRequested") { LOG("Received contacts list..."); - this->contactsRequested = false; contacts.clear(); QListIterator userIdIterator(userIds); while (userIdIterator.hasNext()) { diff --git a/src/tdlibwrapper.h b/src/tdlibwrapper.h index 9a0142a..d2d3268 100644 --- a/src/tdlibwrapper.h +++ b/src/tdlibwrapper.h @@ -277,7 +277,6 @@ private: QString activeChatSearchName; bool joinChatRequested; - bool contactsRequested; };