Secret chat identifer switches to qlonglong

This commit is contained in:
Sebastian Wolf 2020-11-27 19:42:39 +01:00
parent deacb7f0ea
commit 4cf35641c5
7 changed files with 28 additions and 28 deletions

View file

@ -429,7 +429,7 @@ Page {
} }
} }
onSecretChatReceived: { onSecretChatReceived: {
if (secretChatId === chatInformation.type.secret_chat_id.toString()) { if (secretChatId.toString() === chatInformation.type.secret_chat_id.toString()) {
Debug.log("[ChatPage] Received detailed information about this secret chat"); Debug.log("[ChatPage] Received detailed information about this secret chat");
chatPage.secretChatDetails = secretChat; chatPage.secretChatDetails = secretChat;
updateChatPartnerStatusText(); updateChatPartnerStatusText();
@ -437,7 +437,7 @@ Page {
} }
} }
onSecretChatUpdated: { onSecretChatUpdated: {
if (secretChatId === chatInformation.type.secret_chat_id.toString()) { if (secretChatId.toString() === chatInformation.type.secret_chat_id.toString()) {
Debug.log("[ChatPage] Detailed information about this secret chat was updated"); Debug.log("[ChatPage] Detailed information about this secret chat was updated");
chatPage.secretChatDetails = secretChat; chatPage.secretChatDetails = secretChat;
updateChatPartnerStatusText(); updateChatPartnerStatusText();

View file

@ -323,8 +323,8 @@ ChatListModel::ChatListModel(TDLibWrapper *tdLibWrapper) : showHiddenChats(false
connect(tdLibWrapper, SIGNAL(chatNotificationSettingsUpdated(QString, QVariantMap)), this, SLOT(handleChatNotificationSettingsUpdated(QString, QVariantMap))); connect(tdLibWrapper, SIGNAL(chatNotificationSettingsUpdated(QString, QVariantMap)), this, SLOT(handleChatNotificationSettingsUpdated(QString, QVariantMap)));
connect(tdLibWrapper, SIGNAL(superGroupUpdated(qlonglong)), this, SLOT(handleGroupUpdated(qlonglong))); connect(tdLibWrapper, SIGNAL(superGroupUpdated(qlonglong)), this, SLOT(handleGroupUpdated(qlonglong)));
connect(tdLibWrapper, SIGNAL(basicGroupUpdated(qlonglong)), this, SLOT(handleGroupUpdated(qlonglong))); connect(tdLibWrapper, SIGNAL(basicGroupUpdated(qlonglong)), this, SLOT(handleGroupUpdated(qlonglong)));
connect(tdLibWrapper, SIGNAL(secretChatUpdated(QString, QVariantMap)), this, SLOT(handleSecretChatUpdated(QString, QVariantMap))); connect(tdLibWrapper, SIGNAL(secretChatUpdated(qlonglong, QVariantMap)), this, SLOT(handleSecretChatUpdated(qlonglong, QVariantMap)));
connect(tdLibWrapper, SIGNAL(secretChatReceived(QString, QVariantMap)), this, SLOT(handleSecretChatUpdated(QString, QVariantMap))); connect(tdLibWrapper, SIGNAL(secretChatReceived(qlonglong, QVariantMap)), this, SLOT(handleSecretChatUpdated(qlonglong, QVariantMap)));
connect(tdLibWrapper, SIGNAL(chatTitleUpdated(QString, QString)), this, SLOT(handleChatTitleUpdated(QString, QString))); connect(tdLibWrapper, SIGNAL(chatTitleUpdated(QString, QString)), this, SLOT(handleChatTitleUpdated(QString, QString)));
// Don't start the timer until we have at least one chat // Don't start the timer until we have at least one chat
@ -527,7 +527,7 @@ void ChatListModel::updateSecretChatVisibility(const QVariantMap secretChatDetai
if (chat->chatType != TDLibWrapper::ChatTypeSecret) { if (chat->chatType != TDLibWrapper::ChatTypeSecret) {
continue; continue;
} }
if (chat->chatData.value(TYPE).toMap().value(SECRET_CHAT_ID).toString() != secretChatDetails.value(ID).toString()) { if (chat->chatData.value(TYPE).toMap().value(SECRET_CHAT_ID).toLongLong() != secretChatDetails.value(ID).toLongLong()) {
continue; continue;
} }
const QVector<int> changedRoles(chat->updateSecretChat(secretChatDetails)); const QVector<int> changedRoles(chat->updateSecretChat(secretChatDetails));
@ -574,7 +574,7 @@ void ChatListModel::handleChatDiscovered(const QString &, const QVariantMap &cha
} }
if (chat->chatType == TDLibWrapper::ChatTypeSecret) { if (chat->chatType == TDLibWrapper::ChatTypeSecret) {
QVariantMap secretChatDetails = tdLibWrapper->getSecretChatFromCache(chatToBeAdded.value(TYPE).toMap().value(SECRET_CHAT_ID).toString()); QVariantMap secretChatDetails = tdLibWrapper->getSecretChatFromCache(chatToBeAdded.value(TYPE).toMap().value(SECRET_CHAT_ID).toLongLong());
if (!secretChatDetails.isEmpty()) { if (!secretChatDetails.isEmpty()) {
chat->updateSecretChat(secretChatDetails); chat->updateSecretChat(secretChatDetails);
} }
@ -774,7 +774,7 @@ void ChatListModel::handleGroupUpdated(qlonglong groupId)
updateChatVisibility(tdLibWrapper->getGroup(groupId)); updateChatVisibility(tdLibWrapper->getGroup(groupId));
} }
void ChatListModel::handleSecretChatUpdated(const QString &secretChatId, const QVariantMap &secretChat) void ChatListModel::handleSecretChatUpdated(qlonglong secretChatId, const QVariantMap &secretChat)
{ {
LOG("Updating visibility of secret chat " << secretChatId); LOG("Updating visibility of secret chat " << secretChatId);
updateSecretChatVisibility(secretChat); updateSecretChatVisibility(secretChat);

View file

@ -54,7 +54,7 @@ private slots:
void handleMessageSendSucceeded(const QString &messageId, const QString &oldMessageId, const QVariantMap &message); void handleMessageSendSucceeded(const QString &messageId, const QString &oldMessageId, const QVariantMap &message);
void handleChatNotificationSettingsUpdated(const QString &chatId, const QVariantMap &chatNotificationSettings); void handleChatNotificationSettingsUpdated(const QString &chatId, const QVariantMap &chatNotificationSettings);
void handleGroupUpdated(qlonglong groupId); void handleGroupUpdated(qlonglong groupId);
void handleSecretChatUpdated(const QString &secretChatId, const QVariantMap &secretChat); void handleSecretChatUpdated(qlonglong secretChatId, const QVariantMap &secretChat);
void handleChatTitleUpdated(const QString &chatId, const QString &title); void handleChatTitleUpdated(const QString &chatId, const QString &title);
void handleRelativeTimeRefreshTimer(); void handleRelativeTimeRefreshTimer();

View file

@ -531,14 +531,14 @@ void TDLibReceiver::nop(const QVariantMap &)
void TDLibReceiver::processSecretChat(const QVariantMap &receivedInformation) void TDLibReceiver::processSecretChat(const QVariantMap &receivedInformation)
{ {
LOG("Received a secret chat"); LOG("Received a secret chat");
emit secretChat(receivedInformation.value(ID).toString(), receivedInformation); emit secretChat(receivedInformation.value(ID).toLongLong(), receivedInformation);
} }
void TDLibReceiver::processUpdateSecretChat(const QVariantMap &receivedInformation) void TDLibReceiver::processUpdateSecretChat(const QVariantMap &receivedInformation)
{ {
LOG("A secret chat was updated"); LOG("A secret chat was updated");
QVariantMap updatedSecretChat = receivedInformation.value(SECRET_CHAT).toMap(); QVariantMap updatedSecretChat = receivedInformation.value(SECRET_CHAT).toMap();
emit secretChatUpdated(updatedSecretChat.value(ID).toString(), updatedSecretChat); emit secretChatUpdated(updatedSecretChat.value(ID).toLongLong(), updatedSecretChat);
} }
void TDLibReceiver::processImportedContacts(const QVariantMap &receivedInformation) void TDLibReceiver::processImportedContacts(const QVariantMap &receivedInformation)

View file

@ -85,8 +85,8 @@ signals:
void chatPinnedMessageUpdated(qlonglong chatId, qlonglong pinnedMessageId); void chatPinnedMessageUpdated(qlonglong chatId, qlonglong pinnedMessageId);
void usersReceived(const QString &extra, const QVariantList &userIds, int totalUsers); void usersReceived(const QString &extra, const QVariantList &userIds, int totalUsers);
void errorReceived(const int code, const QString &message); void errorReceived(const int code, const QString &message);
void secretChat(const QString &secretChatId, const QVariantMap &secretChat); void secretChat(qlonglong secretChatId, const QVariantMap &secretChat);
void secretChatUpdated(const QString &secretChatId, const QVariantMap &secretChat); void secretChatUpdated(qlonglong secretChatId, const QVariantMap &secretChat);
void contactsImported(const QVariantList &importerCount, const QVariantList &userIds); void contactsImported(const QVariantList &importerCount, const QVariantList &userIds);
private: private:

View file

@ -95,8 +95,8 @@ TDLibWrapper::TDLibWrapper(AppSettings *appSettings, MceInterface *mceInterface,
connect(this->tdLibReceiver, SIGNAL(messagesDeleted(QString, QVariantList)), this, SIGNAL(messagesDeleted(QString, QVariantList))); connect(this->tdLibReceiver, SIGNAL(messagesDeleted(QString, QVariantList)), this, SIGNAL(messagesDeleted(QString, QVariantList)));
connect(this->tdLibReceiver, SIGNAL(chats(QVariantMap)), this, SIGNAL(chatsReceived(QVariantMap))); connect(this->tdLibReceiver, SIGNAL(chats(QVariantMap)), this, SIGNAL(chatsReceived(QVariantMap)));
connect(this->tdLibReceiver, SIGNAL(chat(QVariantMap)), this, SLOT(handleChatReceived(QVariantMap))); connect(this->tdLibReceiver, SIGNAL(chat(QVariantMap)), this, SLOT(handleChatReceived(QVariantMap)));
connect(this->tdLibReceiver, SIGNAL(secretChat(QString, QVariantMap)), this, SLOT(handleSecretChatReceived(QString, QVariantMap))); connect(this->tdLibReceiver, SIGNAL(secretChat(qlonglong, QVariantMap)), this, SLOT(handleSecretChatReceived(qlonglong, QVariantMap)));
connect(this->tdLibReceiver, SIGNAL(secretChatUpdated(QString, QVariantMap)), this, SLOT(handleSecretChatUpdated(QString, QVariantMap))); connect(this->tdLibReceiver, SIGNAL(secretChatUpdated(qlonglong, QVariantMap)), this, SLOT(handleSecretChatUpdated(qlonglong, QVariantMap)));
connect(this->tdLibReceiver, SIGNAL(recentStickersUpdated(QVariantList)), this, SIGNAL(recentStickersUpdated(QVariantList))); connect(this->tdLibReceiver, SIGNAL(recentStickersUpdated(QVariantList)), this, SIGNAL(recentStickersUpdated(QVariantList)));
connect(this->tdLibReceiver, SIGNAL(stickers(QVariantList)), this, SIGNAL(stickersReceived(QVariantList))); connect(this->tdLibReceiver, SIGNAL(stickers(QVariantList)), this, SIGNAL(stickersReceived(QVariantList)));
connect(this->tdLibReceiver, SIGNAL(installedStickerSetsUpdated(QVariantList)), this, SIGNAL(installedStickerSetsUpdated(QVariantList))); connect(this->tdLibReceiver, SIGNAL(installedStickerSetsUpdated(QVariantList)), this, SIGNAL(installedStickerSetsUpdated(QVariantList)));
@ -825,7 +825,7 @@ void TDLibWrapper::getContacts()
this->sendRequest(requestObject); this->sendRequest(requestObject);
} }
void TDLibWrapper::getSecretChat(const QString &secretChatId) void TDLibWrapper::getSecretChat(qlonglong secretChatId)
{ {
LOG("Getting detailed information about secret chat" << secretChatId); LOG("Getting detailed information about secret chat" << secretChatId);
QVariantMap requestObject; QVariantMap requestObject;
@ -834,7 +834,7 @@ void TDLibWrapper::getSecretChat(const QString &secretChatId)
this->sendRequest(requestObject); this->sendRequest(requestObject);
} }
void TDLibWrapper::closeSecretChat(const QString &secretChatId) void TDLibWrapper::closeSecretChat(qlonglong secretChatId)
{ {
LOG("Closing secret chat" << secretChatId); LOG("Closing secret chat" << secretChatId);
QVariantMap requestObject; QVariantMap requestObject;
@ -923,9 +923,9 @@ QVariantMap TDLibWrapper::getChat(const QString &chatId)
return this->chats.value(chatId).toMap(); return this->chats.value(chatId).toMap();
} }
QVariantMap TDLibWrapper::getSecretChatFromCache(const QString &secretChatId) QVariantMap TDLibWrapper::getSecretChatFromCache(qlonglong secretChatId)
{ {
return this->secretChats.value(secretChatId).toMap(); return this->secretChats.value(secretChatId);
} }
QString TDLibWrapper::getOptionString(const QString &optionName) QString TDLibWrapper::getOptionString(const QString &optionName)
@ -1197,13 +1197,13 @@ void TDLibWrapper::handleOpenWithChanged()
} }
} }
void TDLibWrapper::handleSecretChatReceived(const QString &secretChatId, const QVariantMap &secretChat) void TDLibWrapper::handleSecretChatReceived(qlonglong secretChatId, const QVariantMap &secretChat)
{ {
this->secretChats.insert(secretChatId, secretChat); this->secretChats.insert(secretChatId, secretChat);
emit secretChatReceived(secretChatId, secretChat); emit secretChatReceived(secretChatId, secretChat);
} }
void TDLibWrapper::handleSecretChatUpdated(const QString &secretChatId, const QVariantMap &secretChat) void TDLibWrapper::handleSecretChatUpdated(qlonglong secretChatId, const QVariantMap &secretChat)
{ {
this->secretChats.insert(secretChatId, secretChat); this->secretChats.insert(secretChatId, secretChat);
emit secretChatUpdated(secretChatId, secretChat); emit secretChatUpdated(secretChatId, secretChat);

View file

@ -109,7 +109,7 @@ public:
Q_INVOKABLE QVariantMap getBasicGroup(qlonglong groupId) const; Q_INVOKABLE QVariantMap getBasicGroup(qlonglong groupId) const;
Q_INVOKABLE QVariantMap getSuperGroup(qlonglong groupId) const; Q_INVOKABLE QVariantMap getSuperGroup(qlonglong groupId) const;
Q_INVOKABLE QVariantMap getChat(const QString &chatId); Q_INVOKABLE QVariantMap getChat(const QString &chatId);
Q_INVOKABLE QVariantMap getSecretChatFromCache(const QString &secretChatId); Q_INVOKABLE QVariantMap getSecretChatFromCache(qlonglong secretChatId);
Q_INVOKABLE QString getOptionString(const QString &optionName); Q_INVOKABLE QString getOptionString(const QString &optionName);
Q_INVOKABLE void copyFileToDownloads(const QString &filePath); Q_INVOKABLE void copyFileToDownloads(const QString &filePath);
Q_INVOKABLE void openFileOnDevice(const QString &filePath); Q_INVOKABLE void openFileOnDevice(const QString &filePath);
@ -174,8 +174,8 @@ public:
Q_INVOKABLE void joinChatByInviteLink(const QString &inviteLink); Q_INVOKABLE void joinChatByInviteLink(const QString &inviteLink);
Q_INVOKABLE void getDeepLinkInfo(const QString &link); Q_INVOKABLE void getDeepLinkInfo(const QString &link);
Q_INVOKABLE void getContacts(); Q_INVOKABLE void getContacts();
Q_INVOKABLE void getSecretChat(const QString &secretChatId); Q_INVOKABLE void getSecretChat(qlonglong secretChatId);
Q_INVOKABLE void closeSecretChat(const QString &secretChatId); Q_INVOKABLE void closeSecretChat(qlonglong secretChatId);
Q_INVOKABLE void importContacts(const QVariantList &contacts); Q_INVOKABLE void importContacts(const QVariantList &contacts);
// Others (candidates for extraction ;)) // Others (candidates for extraction ;))
@ -221,8 +221,8 @@ signals:
void messagesDeleted(const QString &chatId, const QVariantList &messageIds); void messagesDeleted(const QString &chatId, const QVariantList &messageIds);
void chatsReceived(const QVariantMap &chats); void chatsReceived(const QVariantMap &chats);
void chatReceived(const QVariantMap &chat); void chatReceived(const QVariantMap &chat);
void secretChatReceived(const QString &secretChatId, const QVariantMap &secretChat); void secretChatReceived(qlonglong secretChatId, const QVariantMap &secretChat);
void secretChatUpdated(const QString &secretChatId, const QVariantMap &secretChat); void secretChatUpdated(qlonglong secretChatId, const QVariantMap &secretChat);
void recentStickersUpdated(const QVariantList &stickerIds); void recentStickersUpdated(const QVariantList &stickerIds);
void stickersReceived(const QVariantList &stickers); void stickersReceived(const QVariantList &stickers);
void installedStickerSetsUpdated(const QVariantList &stickerSetIds); void installedStickerSetsUpdated(const QVariantList &stickerSetIds);
@ -262,8 +262,8 @@ public slots:
void handleStickerSets(const QVariantList &stickerSets); void handleStickerSets(const QVariantList &stickerSets);
void handleEmojiSearchCompleted(const QString &queryString, const QVariantList &resultList); void handleEmojiSearchCompleted(const QString &queryString, const QVariantList &resultList);
void handleOpenWithChanged(); void handleOpenWithChanged();
void handleSecretChatReceived(const QString &secretChatId, const QVariantMap &secretChat); void handleSecretChatReceived(qlonglong secretChatId, const QVariantMap &secretChat);
void handleSecretChatUpdated(const QString &secretChatId, const QVariantMap &secretChat); void handleSecretChatUpdated(qlonglong secretChatId, const QVariantMap &secretChat);
void handleStorageOptimizerChanged(); void handleStorageOptimizerChanged();
private: private:
@ -288,7 +288,7 @@ private:
QVariantMap allUsers; QVariantMap allUsers;
QVariantMap allUserNames; QVariantMap allUserNames;
QVariantMap chats; QVariantMap chats;
QVariantMap secretChats; QMap<qlonglong, QVariantMap> secretChats;
QVariantMap unreadMessageInformation; QVariantMap unreadMessageInformation;
QVariantMap unreadChatInformation; QVariantMap unreadChatInformation;
QHash<qlonglong,Group*> basicGroups; QHash<qlonglong,Group*> basicGroups;