Merge pull request #254 from monich/messageApiCleanup

Message API usage cleanup
This commit is contained in:
Sebastian Wolf 2020-12-30 23:07:04 +01:00 committed by GitHub
commit fa0aaf431e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 94 additions and 91 deletions

View file

@ -171,7 +171,7 @@ ListItem {
Connections { Connections {
target: tdLibWrapper target: tdLibWrapper
onReceivedMessage: { onReceivedMessage: {
if (messageId === myMessage.reply_to_message_id.toString()) { if (messageId === myMessage.reply_to_message_id) {
messageInReplyToLoader.inReplyToMessage = message; messageInReplyToLoader.inReplyToMessage = message;
} }
} }

View file

@ -110,7 +110,7 @@ ChatModel::ChatModel(TDLibWrapper *tdLibWrapper) :
this->tdLibWrapper = tdLibWrapper; this->tdLibWrapper = tdLibWrapper;
connect(this->tdLibWrapper, SIGNAL(messagesReceived(QVariantList, int)), this, SLOT(handleMessagesReceived(QVariantList, int))); connect(this->tdLibWrapper, SIGNAL(messagesReceived(QVariantList, int)), this, SLOT(handleMessagesReceived(QVariantList, int)));
connect(this->tdLibWrapper, SIGNAL(newMessageReceived(qlonglong, QVariantMap)), this, SLOT(handleNewMessageReceived(qlonglong, QVariantMap))); connect(this->tdLibWrapper, SIGNAL(newMessageReceived(qlonglong, QVariantMap)), this, SLOT(handleNewMessageReceived(qlonglong, QVariantMap)));
connect(this->tdLibWrapper, SIGNAL(receivedMessage(QString, QVariantMap)), this, SLOT(handleMessageReceived(QString, QVariantMap))); connect(this->tdLibWrapper, SIGNAL(receivedMessage(qlonglong, qlonglong, QVariantMap)), this, SLOT(handleMessageReceived(qlonglong, qlonglong, QVariantMap)));
connect(this->tdLibWrapper, SIGNAL(chatReadInboxUpdated(QString, QString, int)), this, SLOT(handleChatReadInboxUpdated(QString, QString, int))); connect(this->tdLibWrapper, SIGNAL(chatReadInboxUpdated(QString, QString, int)), this, SLOT(handleChatReadInboxUpdated(QString, QString, int)));
connect(this->tdLibWrapper, SIGNAL(chatReadOutboxUpdated(QString, QString)), this, SLOT(handleChatReadOutboxUpdated(QString, QString))); connect(this->tdLibWrapper, SIGNAL(chatReadOutboxUpdated(QString, QString)), this, SLOT(handleChatReadOutboxUpdated(QString, QString)));
connect(this->tdLibWrapper, SIGNAL(messageSendSucceeded(qlonglong, qlonglong, QVariantMap)), this, SLOT(handleMessageSendSucceeded(qlonglong, qlonglong, QVariantMap))); connect(this->tdLibWrapper, SIGNAL(messageSendSucceeded(qlonglong, qlonglong, QVariantMap)), this, SLOT(handleMessageSendSucceeded(qlonglong, qlonglong, QVariantMap)));
@ -365,12 +365,11 @@ void ChatModel::handleNewMessageReceived(qlonglong chatId, const QVariantMap &me
} }
} }
void ChatModel::handleMessageReceived(const QString &messageId, const QVariantMap &message) void ChatModel::handleMessageReceived(qlonglong chatId, qlonglong messageId, const QVariantMap &message)
{ {
const qlonglong messageIdLL = messageId.toLongLong(); if (chatId == this->chatId && messageIndexMap.contains(messageId)) {
if (messageIndexMap.contains(messageIdLL)) {
LOG("Received a message that we already know, let's update it!"); LOG("Received a message that we already know, let's update it!");
const int position = messageIndexMap.value(messageIdLL); const int position = messageIndexMap.value(messageId);
MessageData *messageData = messages.at(position); MessageData *messageData = messages.at(position);
messageData->messageData = message; messageData->messageData = message;
LOG("Message was updated at index" << position); LOG("Message was updated at index" << position);

View file

@ -64,7 +64,7 @@ signals:
private slots: private slots:
void handleMessagesReceived(const QVariantList &messages, int totalCount); void handleMessagesReceived(const QVariantList &messages, int totalCount);
void handleNewMessageReceived(qlonglong chatId, const QVariantMap &message); void handleNewMessageReceived(qlonglong chatId, const QVariantMap &message);
void handleMessageReceived(const QString &messageId, const QVariantMap &message); void handleMessageReceived(qlonglong chatId, qlonglong messageId, const QVariantMap &message);
void handleChatReadInboxUpdated(const QString &chatId, const QString &lastReadInboxMessageId, int unreadCount); void handleChatReadInboxUpdated(const QString &chatId, const QString &lastReadInboxMessageId, int unreadCount);
void handleChatReadOutboxUpdated(const QString &chatId, const QString &lastReadOutboxMessageId); void handleChatReadOutboxUpdated(const QString &chatId, const QString &lastReadOutboxMessageId);
void handleMessageSendSucceeded(qlonglong messageId, qlonglong oldMessageId, const QVariantMap &message); void handleMessageSendSucceeded(qlonglong messageId, qlonglong oldMessageId, const QVariantMap &message);

View file

@ -344,10 +344,10 @@ void TDLibReceiver::processUpdateNewMessage(const QVariantMap &receivedInformati
void TDLibReceiver::processMessage(const QVariantMap &receivedInformation) void TDLibReceiver::processMessage(const QVariantMap &receivedInformation)
{ {
const QString chatId = receivedInformation.value(CHAT_ID).toString(); const qlonglong chatId = receivedInformation.value(CHAT_ID).toLongLong();
const QString messageId = receivedInformation.value(ID).toString(); const qlonglong messageId = receivedInformation.value(ID).toLongLong();
LOG("Received message " << chatId << messageId); LOG("Received message " << chatId << messageId);
emit messageInformation(messageId, receivedInformation); emit messageInformation(chatId, messageId, receivedInformation);
} }
void TDLibReceiver::processMessageSendSucceeded(const QVariantMap &receivedInformation) void TDLibReceiver::processMessageSendSucceeded(const QVariantMap &receivedInformation)

View file

@ -56,7 +56,7 @@ signals:
void chatOnlineMemberCountUpdated(const QString &chatId, int onlineMemberCount); void chatOnlineMemberCountUpdated(const QString &chatId, int onlineMemberCount);
void messagesReceived(const QVariantList &messages, int totalCount); void messagesReceived(const QVariantList &messages, int totalCount);
void newMessageReceived(qlonglong chatId, const QVariantMap &message); void newMessageReceived(qlonglong chatId, const QVariantMap &message);
void messageInformation(const QString &messageId, const QVariantMap &message); void messageInformation(qlonglong chatId, qlonglong messageId, const QVariantMap &message);
void messageSendSucceeded(qlonglong messageId, qlonglong oldMessageId, const QVariantMap &message); void messageSendSucceeded(qlonglong messageId, qlonglong oldMessageId, const QVariantMap &message);
void activeNotificationsUpdated(const QVariantList notificationGroups); void activeNotificationsUpdated(const QVariantList notificationGroups);
void notificationGroupUpdated(const QVariantMap notificationGroupUpdate); void notificationGroupUpdated(const QVariantMap notificationGroupUpdate);

View file

@ -40,6 +40,7 @@ namespace {
const QString STATUS("status"); const QString STATUS("status");
const QString ID("id"); const QString ID("id");
const QString CHAT_ID("chat_id"); const QString CHAT_ID("chat_id");
const QString MESSAGE_ID("message_id");
const QString TYPE("type"); const QString TYPE("type");
const QString LAST_NAME("last_name"); const QString LAST_NAME("last_name");
const QString FIRST_NAME("first_name"); const QString FIRST_NAME("first_name");
@ -90,7 +91,7 @@ TDLibWrapper::TDLibWrapper(AppSettings *appSettings, MceInterface *mceInterface,
connect(this->tdLibReceiver, SIGNAL(chatOnlineMemberCountUpdated(QString, int)), this, SIGNAL(chatOnlineMemberCountUpdated(QString, int))); connect(this->tdLibReceiver, SIGNAL(chatOnlineMemberCountUpdated(QString, int)), this, SIGNAL(chatOnlineMemberCountUpdated(QString, int)));
connect(this->tdLibReceiver, SIGNAL(messagesReceived(QVariantList, int)), this, SIGNAL(messagesReceived(QVariantList, int))); connect(this->tdLibReceiver, SIGNAL(messagesReceived(QVariantList, int)), this, SIGNAL(messagesReceived(QVariantList, int)));
connect(this->tdLibReceiver, SIGNAL(newMessageReceived(qlonglong, QVariantMap)), this, SIGNAL(newMessageReceived(qlonglong, QVariantMap))); connect(this->tdLibReceiver, SIGNAL(newMessageReceived(qlonglong, QVariantMap)), this, SIGNAL(newMessageReceived(qlonglong, QVariantMap)));
connect(this->tdLibReceiver, SIGNAL(messageInformation(QString, QVariantMap)), this, SLOT(handleMessageInformation(QString, QVariantMap))); connect(this->tdLibReceiver, SIGNAL(messageInformation(qlonglong, qlonglong, QVariantMap)), this, SLOT(handleMessageInformation(qlonglong, qlonglong, QVariantMap)));
connect(this->tdLibReceiver, SIGNAL(messageSendSucceeded(qlonglong, qlonglong, QVariantMap)), this, SIGNAL(messageSendSucceeded(qlonglong, qlonglong, QVariantMap))); connect(this->tdLibReceiver, SIGNAL(messageSendSucceeded(qlonglong, qlonglong, QVariantMap)), this, SIGNAL(messageSendSucceeded(qlonglong, qlonglong, QVariantMap)));
connect(this->tdLibReceiver, SIGNAL(activeNotificationsUpdated(QVariantList)), this, SIGNAL(activeNotificationsUpdated(QVariantList))); connect(this->tdLibReceiver, SIGNAL(activeNotificationsUpdated(QVariantList)), this, SIGNAL(activeNotificationsUpdated(QVariantList)));
connect(this->tdLibReceiver, SIGNAL(notificationGroupUpdated(QVariantMap)), this, SIGNAL(notificationGroupUpdated(QVariantMap))); connect(this->tdLibReceiver, SIGNAL(notificationGroupUpdated(QVariantMap)), this, SIGNAL(notificationGroupUpdated(QVariantMap)));
@ -211,9 +212,9 @@ void TDLibWrapper::registerUser(const QString &firstName, const QString &lastNam
{ {
LOG("Register User " << firstName << lastName); LOG("Register User " << firstName << lastName);
QVariantMap requestObject; QVariantMap requestObject;
requestObject.insert("@type", "registerUser"); requestObject.insert(_TYPE, "registerUser");
requestObject.insert("first_name", firstName); requestObject.insert(FIRST_NAME, firstName);
requestObject.insert("last_name", lastName); requestObject.insert(LAST_NAME, lastName);
this->sendRequest(requestObject); this->sendRequest(requestObject);
} }
@ -244,7 +245,7 @@ void TDLibWrapper::openChat(const QString &chatId)
LOG("Opening chat " << chatId); LOG("Opening chat " << chatId);
QVariantMap requestObject; QVariantMap requestObject;
requestObject.insert(_TYPE, "openChat"); requestObject.insert(_TYPE, "openChat");
requestObject.insert("chat_id", chatId); requestObject.insert(CHAT_ID, chatId);
this->sendRequest(requestObject); this->sendRequest(requestObject);
} }
@ -253,7 +254,7 @@ void TDLibWrapper::closeChat(const QString &chatId)
LOG("Closing chat " << chatId); LOG("Closing chat " << chatId);
QVariantMap requestObject; QVariantMap requestObject;
requestObject.insert(_TYPE, "closeChat"); requestObject.insert(_TYPE, "closeChat");
requestObject.insert("chat_id", chatId); requestObject.insert(CHAT_ID, chatId);
this->sendRequest(requestObject); this->sendRequest(requestObject);
} }
@ -262,7 +263,7 @@ void TDLibWrapper::joinChat(const QString &chatId)
LOG("Joining chat " << chatId); LOG("Joining chat " << chatId);
QVariantMap requestObject; QVariantMap requestObject;
requestObject.insert(_TYPE, "joinChat"); requestObject.insert(_TYPE, "joinChat");
requestObject.insert("chat_id", chatId); requestObject.insert(CHAT_ID, chatId);
this->joinChatRequested = true; this->joinChatRequested = true;
this->sendRequest(requestObject); this->sendRequest(requestObject);
} }
@ -272,16 +273,16 @@ void TDLibWrapper::leaveChat(const QString &chatId)
LOG("Leaving chat " << chatId); LOG("Leaving chat " << chatId);
QVariantMap requestObject; QVariantMap requestObject;
requestObject.insert(_TYPE, "leaveChat"); requestObject.insert(_TYPE, "leaveChat");
requestObject.insert("chat_id", chatId); requestObject.insert(CHAT_ID, chatId);
this->sendRequest(requestObject); this->sendRequest(requestObject);
} }
void TDLibWrapper::getChatHistory(qlonglong chatId, const qlonglong &fromMessageId, int offset, int limit, bool onlyLocal) void TDLibWrapper::getChatHistory(qlonglong chatId, qlonglong fromMessageId, int offset, int limit, bool onlyLocal)
{ {
LOG("Retrieving chat history" << chatId << fromMessageId << offset << limit << onlyLocal); LOG("Retrieving chat history" << chatId << fromMessageId << offset << limit << onlyLocal);
QVariantMap requestObject; QVariantMap requestObject;
requestObject.insert(_TYPE, "getChatHistory"); requestObject.insert(_TYPE, "getChatHistory");
requestObject.insert("chat_id", chatId); requestObject.insert(CHAT_ID, chatId);
requestObject.insert("from_message_id", fromMessageId); requestObject.insert("from_message_id", fromMessageId);
requestObject.insert("offset", offset); requestObject.insert("offset", offset);
requestObject.insert("limit", limit); requestObject.insert("limit", limit);
@ -294,7 +295,7 @@ void TDLibWrapper::viewMessage(const QString &chatId, const QString &messageId,
LOG("Mark message as viewed" << chatId << messageId); LOG("Mark message as viewed" << chatId << messageId);
QVariantMap requestObject; QVariantMap requestObject;
requestObject.insert(_TYPE, "viewMessages"); requestObject.insert(_TYPE, "viewMessages");
requestObject.insert("chat_id", chatId); requestObject.insert(CHAT_ID, chatId);
requestObject.insert("force_read", force); requestObject.insert("force_read", force);
QVariantList messageIds; QVariantList messageIds;
messageIds.append(messageId); messageIds.append(messageId);
@ -307,8 +308,8 @@ void TDLibWrapper::pinMessage(const QString &chatId, const QString &messageId, b
LOG("Pin message to chat" << chatId << messageId << disableNotification); LOG("Pin message to chat" << chatId << messageId << disableNotification);
QVariantMap requestObject; QVariantMap requestObject;
requestObject.insert(_TYPE, "pinChatMessage"); requestObject.insert(_TYPE, "pinChatMessage");
requestObject.insert("chat_id", chatId); requestObject.insert(CHAT_ID, chatId);
requestObject.insert("message_id", messageId); requestObject.insert(MESSAGE_ID, messageId);
requestObject.insert("disable_notification", disableNotification); requestObject.insert("disable_notification", disableNotification);
this->sendRequest(requestObject); this->sendRequest(requestObject);
} }
@ -318,8 +319,8 @@ void TDLibWrapper::unpinMessage(const QString &chatId, const QString &messageId)
LOG("Unpin message from chat" << chatId); LOG("Unpin message from chat" << chatId);
QVariantMap requestObject; QVariantMap requestObject;
requestObject.insert(_TYPE, "unpinChatMessage"); requestObject.insert(_TYPE, "unpinChatMessage");
requestObject.insert("chat_id", chatId); requestObject.insert(CHAT_ID, chatId);
requestObject.insert("message_id", messageId); requestObject.insert(MESSAGE_ID, messageId);
requestObject.insert(_EXTRA, "unpinChatMessage:" + chatId); requestObject.insert(_EXTRA, "unpinChatMessage:" + chatId);
this->sendRequest(requestObject); this->sendRequest(requestObject);
} }
@ -341,7 +342,7 @@ void TDLibWrapper::sendTextMessage(const QString &chatId, const QString &message
LOG("Sending text message" << chatId << message << replyToMessageId); LOG("Sending text message" << chatId << message << replyToMessageId);
QVariantMap requestObject; QVariantMap requestObject;
requestObject.insert(_TYPE, "sendMessage"); requestObject.insert(_TYPE, "sendMessage");
requestObject.insert("chat_id", chatId); requestObject.insert(CHAT_ID, chatId);
if (replyToMessageId != "0") { if (replyToMessageId != "0") {
requestObject.insert("reply_to_message_id", replyToMessageId); requestObject.insert("reply_to_message_id", replyToMessageId);
} }
@ -402,7 +403,7 @@ void TDLibWrapper::sendPhotoMessage(const QString &chatId, const QString &filePa
LOG("Sending photo message" << chatId << filePath << message << replyToMessageId); LOG("Sending photo message" << chatId << filePath << message << replyToMessageId);
QVariantMap requestObject; QVariantMap requestObject;
requestObject.insert(_TYPE, "sendMessage"); requestObject.insert(_TYPE, "sendMessage");
requestObject.insert("chat_id", chatId); requestObject.insert(CHAT_ID, chatId);
if (replyToMessageId != "0") { if (replyToMessageId != "0") {
requestObject.insert("reply_to_message_id", replyToMessageId); requestObject.insert("reply_to_message_id", replyToMessageId);
} }
@ -426,7 +427,7 @@ void TDLibWrapper::sendVideoMessage(const QString &chatId, const QString &filePa
LOG("Sending video message" << chatId << filePath << message << replyToMessageId); LOG("Sending video message" << chatId << filePath << message << replyToMessageId);
QVariantMap requestObject; QVariantMap requestObject;
requestObject.insert(_TYPE, "sendMessage"); requestObject.insert(_TYPE, "sendMessage");
requestObject.insert("chat_id", chatId); requestObject.insert(CHAT_ID, chatId);
if (replyToMessageId != "0") { if (replyToMessageId != "0") {
requestObject.insert("reply_to_message_id", replyToMessageId); requestObject.insert("reply_to_message_id", replyToMessageId);
} }
@ -450,7 +451,7 @@ void TDLibWrapper::sendDocumentMessage(const QString &chatId, const QString &fil
LOG("Sending document message" << chatId << filePath << message << replyToMessageId); LOG("Sending document message" << chatId << filePath << message << replyToMessageId);
QVariantMap requestObject; QVariantMap requestObject;
requestObject.insert(_TYPE, "sendMessage"); requestObject.insert(_TYPE, "sendMessage");
requestObject.insert("chat_id", chatId); requestObject.insert(CHAT_ID, chatId);
if (replyToMessageId != "0") { if (replyToMessageId != "0") {
requestObject.insert("reply_to_message_id", replyToMessageId); requestObject.insert("reply_to_message_id", replyToMessageId);
} }
@ -474,7 +475,7 @@ void TDLibWrapper::sendStickerMessage(const QString &chatId, const QString &file
LOG("Sending sticker message" << chatId << fileId << replyToMessageId); LOG("Sending sticker message" << chatId << fileId << replyToMessageId);
QVariantMap requestObject; QVariantMap requestObject;
requestObject.insert(_TYPE, "sendMessage"); requestObject.insert(_TYPE, "sendMessage");
requestObject.insert("chat_id", chatId); requestObject.insert(CHAT_ID, chatId);
if (replyToMessageId != "0") { if (replyToMessageId != "0") {
requestObject.insert("reply_to_message_id", replyToMessageId); requestObject.insert("reply_to_message_id", replyToMessageId);
} }
@ -491,12 +492,12 @@ void TDLibWrapper::sendStickerMessage(const QString &chatId, const QString &file
this->sendRequest(requestObject); this->sendRequest(requestObject);
} }
void TDLibWrapper::sendPollMessage(const QString &chatId, const QString &question, const QVariantList &options, const bool &anonymous, const int &correctOption, const bool &multiple, const QString &replyToMessageId) void TDLibWrapper::sendPollMessage(const QString &chatId, const QString &question, const QVariantList &options, bool anonymous, int correctOption, bool multiple, const QString &replyToMessageId)
{ {
LOG("Sending poll message" << chatId << question << replyToMessageId); LOG("Sending poll message" << chatId << question << replyToMessageId);
QVariantMap requestObject; QVariantMap requestObject;
requestObject.insert(_TYPE, "sendMessage"); requestObject.insert(_TYPE, "sendMessage");
requestObject.insert("chat_id", chatId); requestObject.insert(CHAT_ID, chatId);
if (replyToMessageId != "0") { if (replyToMessageId != "0") {
requestObject.insert("reply_to_message_id", replyToMessageId); requestObject.insert("reply_to_message_id", replyToMessageId);
} }
@ -521,12 +522,12 @@ void TDLibWrapper::sendPollMessage(const QString &chatId, const QString &questio
this->sendRequest(requestObject); this->sendRequest(requestObject);
} }
void TDLibWrapper::forwardMessages(const QString &chatId, const QString &fromChatId, const QVariantList &messageIds, const bool sendCopy, const bool removeCaption) void TDLibWrapper::forwardMessages(const QString &chatId, const QString &fromChatId, const QVariantList &messageIds, bool sendCopy, bool removeCaption)
{ {
LOG("Forwarding messages" << chatId << fromChatId << messageIds); LOG("Forwarding messages" << chatId << fromChatId << messageIds);
QVariantMap requestObject; QVariantMap requestObject;
requestObject.insert(_TYPE, "forwardMessages"); requestObject.insert(_TYPE, "forwardMessages");
requestObject.insert("chat_id", chatId); requestObject.insert(CHAT_ID, chatId);
requestObject.insert("from_chat_id", fromChatId); requestObject.insert("from_chat_id", fromChatId);
requestObject.insert("message_ids", messageIds); requestObject.insert("message_ids", messageIds);
requestObject.insert("send_copy", sendCopy); requestObject.insert("send_copy", sendCopy);
@ -535,14 +536,14 @@ void TDLibWrapper::forwardMessages(const QString &chatId, const QString &fromCha
this->sendRequest(requestObject); this->sendRequest(requestObject);
} }
void TDLibWrapper::getMessage(const QString &chatId, const QString &messageId) void TDLibWrapper::getMessage(qlonglong chatId, qlonglong messageId)
{ {
LOG("Retrieving message" << chatId << messageId); LOG("Retrieving message" << chatId << messageId);
QVariantMap requestObject; QVariantMap requestObject;
requestObject.insert(_TYPE, "getMessage"); requestObject.insert(_TYPE, "getMessage");
requestObject.insert("chat_id", chatId); requestObject.insert(CHAT_ID, chatId);
requestObject.insert("message_id", messageId); requestObject.insert(MESSAGE_ID, messageId);
requestObject.insert(_EXTRA, "getMessage:" + messageId); requestObject.insert(_EXTRA, QString("getMessage:%1:%2").arg(chatId).arg(messageId));
this->sendRequest(requestObject); this->sendRequest(requestObject);
} }
@ -551,18 +552,18 @@ void TDLibWrapper::getCallbackQueryAnswer(const QString &chatId, const QString &
LOG("Getting Callback Query Answer" << chatId << messageId); LOG("Getting Callback Query Answer" << chatId << messageId);
QVariantMap requestObject; QVariantMap requestObject;
requestObject.insert(_TYPE, "getCallbackQueryAnswer"); requestObject.insert(_TYPE, "getCallbackQueryAnswer");
requestObject.insert("chat_id", chatId); requestObject.insert(CHAT_ID, chatId);
requestObject.insert("message_id", messageId); requestObject.insert(MESSAGE_ID, messageId);
requestObject.insert("payload", payload); requestObject.insert("payload", payload);
this->sendRequest(requestObject); this->sendRequest(requestObject);
} }
void TDLibWrapper::getChatPinnedMessage(const qlonglong &chatId) void TDLibWrapper::getChatPinnedMessage(qlonglong chatId)
{ {
LOG("Retrieving pinned message" << chatId); LOG("Retrieving pinned message" << chatId);
QVariantMap requestObject; QVariantMap requestObject;
requestObject.insert(_TYPE, "getChatPinnedMessage"); requestObject.insert(_TYPE, "getChatPinnedMessage");
requestObject.insert("chat_id", chatId); requestObject.insert(CHAT_ID, chatId);
requestObject.insert(_EXTRA, "getChatPinnedMessage:" + QString::number(chatId)); requestObject.insert(_EXTRA, "getChatPinnedMessage:" + QString::number(chatId));
this->sendRequest(requestObject); this->sendRequest(requestObject);
} }
@ -596,7 +597,7 @@ void TDLibWrapper::setChatNotificationSettings(const QString &chatId, const QVar
LOG("Notification settings for chat " << chatId << notificationSettings); LOG("Notification settings for chat " << chatId << notificationSettings);
QVariantMap requestObject; QVariantMap requestObject;
requestObject.insert(_TYPE, "setChatNotificationSettings"); requestObject.insert(_TYPE, "setChatNotificationSettings");
requestObject.insert("chat_id", chatId); requestObject.insert(CHAT_ID, chatId);
requestObject.insert("notification_settings", notificationSettings); requestObject.insert("notification_settings", notificationSettings);
this->sendRequest(requestObject); this->sendRequest(requestObject);
} }
@ -606,8 +607,8 @@ void TDLibWrapper::editMessageText(const QString &chatId, const QString &message
LOG("Editing message text" << chatId << messageId); LOG("Editing message text" << chatId << messageId);
QVariantMap requestObject; QVariantMap requestObject;
requestObject.insert(_TYPE, "editMessageText"); requestObject.insert(_TYPE, "editMessageText");
requestObject.insert("chat_id", chatId); requestObject.insert(CHAT_ID, chatId);
requestObject.insert("message_id", messageId); requestObject.insert(MESSAGE_ID, messageId);
QVariantMap inputMessageContent; QVariantMap inputMessageContent;
inputMessageContent.insert(_TYPE, "inputMessageText"); inputMessageContent.insert(_TYPE, "inputMessageText");
QVariantMap formattedText; QVariantMap formattedText;
@ -622,7 +623,7 @@ void TDLibWrapper::deleteMessages(const QString &chatId, const QVariantList mess
LOG("Deleting some messages" << chatId << messageIds); LOG("Deleting some messages" << chatId << messageIds);
QVariantMap requestObject; QVariantMap requestObject;
requestObject.insert(_TYPE, "deleteMessages"); requestObject.insert(_TYPE, "deleteMessages");
requestObject.insert("chat_id", chatId); requestObject.insert(CHAT_ID, chatId);
requestObject.insert("message_ids", messageIds); requestObject.insert("message_ids", messageIds);
requestObject.insert("revoke", true); requestObject.insert("revoke", true);
this->sendRequest(requestObject); this->sendRequest(requestObject);
@ -646,7 +647,7 @@ void TDLibWrapper::getMapThumbnailFile(const QString &chatId, double latitude, d
requestObject.insert("width", boundsWidth); requestObject.insert("width", boundsWidth);
requestObject.insert("height", boundsHeight); requestObject.insert("height", boundsHeight);
requestObject.insert("scale", 1); // 1-3 requestObject.insert("scale", 1); // 1-3
requestObject.insert("chat_id", chatId); requestObject.insert(CHAT_ID, chatId);
this->sendRequest(requestObject); this->sendRequest(requestObject);
} }
@ -782,7 +783,7 @@ void TDLibWrapper::setChatPermissions(const QString &chatId, const QVariantMap &
QVariantMap requestObject; QVariantMap requestObject;
requestObject.insert(_TYPE, "setChatPermissions"); requestObject.insert(_TYPE, "setChatPermissions");
requestObject.insert(_EXTRA, chatId); requestObject.insert(_EXTRA, chatId);
requestObject.insert("chat_id", chatId); requestObject.insert(CHAT_ID, chatId);
requestObject.insert("permissions", chatPermissions); requestObject.insert("permissions", chatPermissions);
this->sendRequest(requestObject); this->sendRequest(requestObject);
} }
@ -793,7 +794,7 @@ void TDLibWrapper::setChatSlowModeDelay(const QString &chatId, int delay)
LOG("Setting Chat Slow Mode Delay"); LOG("Setting Chat Slow Mode Delay");
QVariantMap requestObject; QVariantMap requestObject;
requestObject.insert(_TYPE, "setChatSlowModeDelay"); requestObject.insert(_TYPE, "setChatSlowModeDelay");
requestObject.insert("chat_id", chatId); requestObject.insert(CHAT_ID, chatId);
requestObject.insert("slow_mode_delay", delay); requestObject.insert("slow_mode_delay", delay);
this->sendRequest(requestObject); this->sendRequest(requestObject);
} }
@ -803,7 +804,7 @@ void TDLibWrapper::setChatDescription(const QString &chatId, const QString &desc
LOG("Setting Chat Description"); LOG("Setting Chat Description");
QVariantMap requestObject; QVariantMap requestObject;
requestObject.insert(_TYPE, "setChatDescription"); requestObject.insert(_TYPE, "setChatDescription");
requestObject.insert("chat_id", chatId); requestObject.insert(CHAT_ID, chatId);
requestObject.insert("description", description); requestObject.insert("description", description);
this->sendRequest(requestObject); this->sendRequest(requestObject);
} }
@ -813,7 +814,7 @@ void TDLibWrapper::setChatTitle(const QString &chatId, const QString &title)
LOG("Setting Chat Title"); LOG("Setting Chat Title");
QVariantMap requestObject; QVariantMap requestObject;
requestObject.insert(_TYPE, "setChatTitle"); requestObject.insert(_TYPE, "setChatTitle");
requestObject.insert("chat_id", chatId); requestObject.insert(CHAT_ID, chatId);
requestObject.insert("title", title); requestObject.insert("title", title);
this->sendRequest(requestObject); this->sendRequest(requestObject);
} }
@ -837,35 +838,35 @@ void TDLibWrapper::toggleSupergroupIsAllHistoryAvailable(const QString &groupId,
this->sendRequest(requestObject); this->sendRequest(requestObject);
} }
void TDLibWrapper::setPollAnswer(const QString &chatId, const qlonglong &messageId, QVariantList optionIds) void TDLibWrapper::setPollAnswer(const QString &chatId, qlonglong messageId, QVariantList optionIds)
{ {
LOG("Setting Poll Answer"); LOG("Setting Poll Answer");
QVariantMap requestObject; QVariantMap requestObject;
requestObject.insert(_TYPE, "setPollAnswer"); requestObject.insert(_TYPE, "setPollAnswer");
requestObject.insert("chat_id", chatId); requestObject.insert(CHAT_ID, chatId);
requestObject.insert("message_id", messageId); requestObject.insert(MESSAGE_ID, messageId);
requestObject.insert("option_ids", optionIds); requestObject.insert("option_ids", optionIds);
this->sendRequest(requestObject); this->sendRequest(requestObject);
} }
void TDLibWrapper::stopPoll(const QString &chatId, const qlonglong &messageId) void TDLibWrapper::stopPoll(const QString &chatId, qlonglong messageId)
{ {
LOG("Stopping Poll"); LOG("Stopping Poll");
QVariantMap requestObject; QVariantMap requestObject;
requestObject.insert(_TYPE, "stopPoll"); requestObject.insert(_TYPE, "stopPoll");
requestObject.insert("chat_id", chatId); requestObject.insert(CHAT_ID, chatId);
requestObject.insert("message_id", messageId); requestObject.insert(MESSAGE_ID, messageId);
this->sendRequest(requestObject); this->sendRequest(requestObject);
} }
void TDLibWrapper::getPollVoters(const QString &chatId, const qlonglong &messageId, const int &optionId, const int &limit, const int &offset, const QString &extra) void TDLibWrapper::getPollVoters(const QString &chatId, qlonglong messageId, int optionId, int limit, int offset, const QString &extra)
{ {
LOG("Retrieving Poll Voters"); LOG("Retrieving Poll Voters");
QVariantMap requestObject; QVariantMap requestObject;
requestObject.insert(_TYPE, "getPollVoters"); requestObject.insert(_TYPE, "getPollVoters");
requestObject.insert(_EXTRA, extra); requestObject.insert(_EXTRA, extra);
requestObject.insert("chat_id", chatId); requestObject.insert(CHAT_ID, chatId);
requestObject.insert("message_id", messageId); requestObject.insert(MESSAGE_ID, messageId);
requestObject.insert("option_id", optionId); requestObject.insert("option_id", optionId);
requestObject.insert("offset", offset); requestObject.insert("offset", offset);
requestObject.insert("limit", limit); //max 50 requestObject.insert("limit", limit); //max 50
@ -878,7 +879,7 @@ void TDLibWrapper::searchPublicChat(const QString &userName)
this->activeChatSearchName = userName; this->activeChatSearchName = userName;
QVariantMap requestObject; QVariantMap requestObject;
requestObject.insert(_TYPE, "searchPublicChat"); requestObject.insert(_TYPE, "searchPublicChat");
requestObject.insert("username", userName); requestObject.insert(USERNAME, userName);
this->sendRequest(requestObject); this->sendRequest(requestObject);
} }
@ -937,12 +938,12 @@ void TDLibWrapper::importContacts(const QVariantList &contacts)
this->sendRequest(requestObject); this->sendRequest(requestObject);
} }
void TDLibWrapper::searchChatMessages(const qlonglong &chatId, const QString &query, const qlonglong fromMessageId) void TDLibWrapper::searchChatMessages(qlonglong chatId, const QString &query, qlonglong fromMessageId)
{ {
LOG("Searching for messages" << chatId << query << fromMessageId); LOG("Searching for messages" << chatId << query << fromMessageId);
QVariantMap requestObject; QVariantMap requestObject;
requestObject.insert(_TYPE, "searchChatMessages"); requestObject.insert(_TYPE, "searchChatMessages");
requestObject.insert("chat_id", chatId); requestObject.insert(CHAT_ID, chatId);
requestObject.insert("query", query); requestObject.insert("query", query);
requestObject.insert("from_message_id", fromMessageId); requestObject.insert("from_message_id", fromMessageId);
requestObject.insert("offset", 0); requestObject.insert("offset", 0);
@ -966,7 +967,7 @@ void TDLibWrapper::readAllChatMentions(qlonglong chatId)
LOG("Read all chat mentions" << chatId); LOG("Read all chat mentions" << chatId);
QVariantMap requestObject; QVariantMap requestObject;
requestObject.insert(_TYPE, "readAllChatMentions"); requestObject.insert(_TYPE, "readAllChatMentions");
requestObject.insert("chat_id", chatId); requestObject.insert(CHAT_ID, chatId);
this->sendRequest(requestObject); this->sendRequest(requestObject);
} }
@ -1203,9 +1204,9 @@ void TDLibWrapper::handleUserUpdated(const QVariantMap &userInformation)
LOG("Own user information updated :)"); LOG("Own user information updated :)");
this->userInformation = userInformation; this->userInformation = userInformation;
} }
LOG("User information updated:" << userInformation.value("username").toString() << userInformation.value("first_name").toString() << userInformation.value("last_name").toString()); LOG("User information updated:" << userInformation.value(USERNAME).toString() << userInformation.value(FIRST_NAME).toString() << userInformation.value(LAST_NAME).toString());
this->allUsers.insert(updatedUserId, userInformation); this->allUsers.insert(updatedUserId, userInformation);
this->allUserNames.insert(userInformation.value("username").toString(), userInformation); this->allUserNames.insert(userInformation.value(USERNAME).toString(), userInformation);
emit userUpdated(updatedUserId, userInformation); emit userUpdated(updatedUserId, userInformation);
} }
@ -1219,7 +1220,7 @@ void TDLibWrapper::handleUserStatusUpdated(const QString &userId, const QVariant
QVariantMap updatedUserInformation = this->allUsers.value(userId).toMap(); QVariantMap updatedUserInformation = this->allUsers.value(userId).toMap();
updatedUserInformation.insert("status", userStatusInformation); updatedUserInformation.insert("status", userStatusInformation);
this->allUsers.insert(userId, updatedUserInformation); this->allUsers.insert(userId, updatedUserInformation);
this->allUserNames.insert(userInformation.value("username").toString(), userInformation); this->allUserNames.insert(userInformation.value(USERNAME).toString(), userInformation);
emit userUpdated(userId, updatedUserInformation); emit userUpdated(userId, updatedUserInformation);
} }
@ -1273,7 +1274,7 @@ void TDLibWrapper::handleUnreadChatCountUpdated(const QVariantMap &chatCountInfo
void TDLibWrapper::handleBasicGroupUpdated(qlonglong groupId, const QVariantMap &groupInformation) void TDLibWrapper::handleBasicGroupUpdated(qlonglong groupId, const QVariantMap &groupInformation)
{ {
emit basicGroupUpdated(updateGroup(groupId, groupInformation, &basicGroups)->groupId); emit basicGroupUpdated(updateGroup(groupId, groupInformation, &basicGroups)->groupId);
if (!this->activeChatSearchName.isEmpty() && this->activeChatSearchName == groupInformation.value("username").toString()) { if (!this->activeChatSearchName.isEmpty() && this->activeChatSearchName == groupInformation.value(USERNAME).toString()) {
LOG("Found basic group for active search" << this->activeChatSearchName); LOG("Found basic group for active search" << this->activeChatSearchName);
this->activeChatSearchName.clear(); this->activeChatSearchName.clear();
this->createBasicGroupChat(groupInformation.value(ID).toString()); this->createBasicGroupChat(groupInformation.value(ID).toString());
@ -1283,7 +1284,7 @@ void TDLibWrapper::handleBasicGroupUpdated(qlonglong groupId, const QVariantMap
void TDLibWrapper::handleSuperGroupUpdated(qlonglong groupId, const QVariantMap &groupInformation) void TDLibWrapper::handleSuperGroupUpdated(qlonglong groupId, const QVariantMap &groupInformation)
{ {
emit superGroupUpdated(updateGroup(groupId, groupInformation, &superGroups)->groupId); emit superGroupUpdated(updateGroup(groupId, groupInformation, &superGroups)->groupId);
if (!this->activeChatSearchName.isEmpty() && this->activeChatSearchName == groupInformation.value("username").toString()) { if (!this->activeChatSearchName.isEmpty() && this->activeChatSearchName == groupInformation.value(USERNAME).toString()) {
LOG("Found supergroup for active search" << this->activeChatSearchName); LOG("Found supergroup for active search" << this->activeChatSearchName);
this->activeChatSearchName.clear(); this->activeChatSearchName.clear();
this->createSupergroupChat(groupInformation.value(ID).toString()); this->createSupergroupChat(groupInformation.value(ID).toString());
@ -1332,21 +1333,24 @@ void TDLibWrapper::handleStorageOptimizerChanged()
setOptionBoolean("use_storage_optimizer", appSettings->storageOptimizer()); setOptionBoolean("use_storage_optimizer", appSettings->storageOptimizer());
} }
void TDLibWrapper::handleErrorReceived(const int code, const QString &message, const QString &extra) void TDLibWrapper::handleErrorReceived(int code, const QString &message, const QString &extra)
{ {
if (code == 404 && extra.startsWith("getMessage:")) { if (!extra.isEmpty()) {
emit messageNotFound(extra.mid(11).toLongLong()); QStringList parts(extra.split(':'));
if (parts.size() == 3 && parts.at(0) == QStringLiteral("getMessage")) {
emit messageNotFound(parts.at(1).toLongLong(), parts.at(2).toLongLong());
}
} }
emit errorReceived(code, message, extra); emit errorReceived(code, message, extra);
} }
void TDLibWrapper::handleMessageInformation(const QString &messageId, const QVariantMap &receivedInformation) void TDLibWrapper::handleMessageInformation(qlonglong chatId, qlonglong messageId, const QVariantMap &receivedInformation)
{ {
QString extraInformation = receivedInformation.value(_EXTRA).toString(); QString extraInformation = receivedInformation.value(_EXTRA).toString();
if (extraInformation.startsWith("getChatPinnedMessage")) { if (extraInformation.startsWith("getChatPinnedMessage:")) {
emit chatPinnedMessageUpdated(receivedInformation.value(CHAT_ID).toLongLong(), messageId.toLongLong()); emit chatPinnedMessageUpdated(chatId, messageId);
} }
emit receivedMessage(messageId, receivedInformation); emit receivedMessage(chatId, messageId, receivedInformation);
} }
void TDLibWrapper::handleMessageIsPinnedUpdated(qlonglong chatId, qlonglong messageId, bool isPinned) void TDLibWrapper::handleMessageIsPinnedUpdated(qlonglong chatId, qlonglong messageId, bool isPinned)

View file

@ -131,7 +131,7 @@ public:
Q_INVOKABLE void closeChat(const QString &chatId); Q_INVOKABLE void closeChat(const QString &chatId);
Q_INVOKABLE void joinChat(const QString &chatId); Q_INVOKABLE void joinChat(const QString &chatId);
Q_INVOKABLE void leaveChat(const QString &chatId); Q_INVOKABLE void leaveChat(const QString &chatId);
Q_INVOKABLE void getChatHistory(qlonglong chatId, const qlonglong &fromMessageId = 0, int offset = -1, int limit = 50, bool onlyLocal = false); Q_INVOKABLE void getChatHistory(qlonglong chatId, qlonglong fromMessageId = 0, int offset = -1, int limit = 50, bool onlyLocal = false);
Q_INVOKABLE void viewMessage(const QString &chatId, const QString &messageId, bool force); Q_INVOKABLE void viewMessage(const QString &chatId, const QString &messageId, bool force);
Q_INVOKABLE void pinMessage(const QString &chatId, const QString &messageId, bool disableNotification = false); Q_INVOKABLE void pinMessage(const QString &chatId, const QString &messageId, bool disableNotification = false);
Q_INVOKABLE void unpinMessage(const QString &chatId, const QString &messageId); Q_INVOKABLE void unpinMessage(const QString &chatId, const QString &messageId);
@ -140,11 +140,11 @@ public:
Q_INVOKABLE void sendVideoMessage(const QString &chatId, const QString &filePath, const QString &message, const QString &replyToMessageId = "0"); Q_INVOKABLE void sendVideoMessage(const QString &chatId, const QString &filePath, const QString &message, const QString &replyToMessageId = "0");
Q_INVOKABLE void sendDocumentMessage(const QString &chatId, const QString &filePath, const QString &message, const QString &replyToMessageId = "0"); Q_INVOKABLE void sendDocumentMessage(const QString &chatId, const QString &filePath, const QString &message, const QString &replyToMessageId = "0");
Q_INVOKABLE void sendStickerMessage(const QString &chatId, const QString &fileId, const QString &replyToMessageId = "0"); Q_INVOKABLE void sendStickerMessage(const QString &chatId, const QString &fileId, const QString &replyToMessageId = "0");
Q_INVOKABLE void sendPollMessage(const QString &chatId, const QString &question, const QVariantList &options, const bool &anonymous, const int &correctOption, const bool &multiple, const QString &replyToMessageId = "0"); Q_INVOKABLE void sendPollMessage(const QString &chatId, const QString &question, const QVariantList &options, bool anonymous, int correctOption, bool multiple, const QString &replyToMessageId = "0");
Q_INVOKABLE void forwardMessages(const QString &chatId, const QString &fromChatId, const QVariantList &messageIds, const bool sendCopy, const bool removeCaption); Q_INVOKABLE void forwardMessages(const QString &chatId, const QString &fromChatId, const QVariantList &messageIds, bool sendCopy, bool removeCaption);
Q_INVOKABLE void getMessage(const QString &chatId, const QString &messageId); Q_INVOKABLE void getMessage(qlonglong chatId, qlonglong messageId);
Q_INVOKABLE void getCallbackQueryAnswer(const QString &chatId, const QString &messageId, const QVariantMap &payload); Q_INVOKABLE void getCallbackQueryAnswer(const QString &chatId, const QString &messageId, const QVariantMap &payload);
Q_INVOKABLE void getChatPinnedMessage(const qlonglong &chatId); Q_INVOKABLE void getChatPinnedMessage(qlonglong chatId);
Q_INVOKABLE void setOptionInteger(const QString &optionName, int optionValue); Q_INVOKABLE void setOptionInteger(const QString &optionName, int optionValue);
Q_INVOKABLE void setOptionBoolean(const QString &optionName, bool optionValue); Q_INVOKABLE void setOptionBoolean(const QString &optionName, bool optionValue);
Q_INVOKABLE void setChatNotificationSettings(const QString &chatId, const QVariantMap &notificationSettings); Q_INVOKABLE void setChatNotificationSettings(const QString &chatId, const QVariantMap &notificationSettings);
@ -169,9 +169,9 @@ public:
Q_INVOKABLE void setChatTitle(const QString &chatId, const QString &title); Q_INVOKABLE void setChatTitle(const QString &chatId, const QString &title);
Q_INVOKABLE void setBio(const QString &bio); Q_INVOKABLE void setBio(const QString &bio);
Q_INVOKABLE void toggleSupergroupIsAllHistoryAvailable(const QString &groupId, bool isAllHistoryAvailable); Q_INVOKABLE void toggleSupergroupIsAllHistoryAvailable(const QString &groupId, bool isAllHistoryAvailable);
Q_INVOKABLE void setPollAnswer(const QString &chatId, const qlonglong &messageId, QVariantList optionIds); Q_INVOKABLE void setPollAnswer(const QString &chatId, qlonglong messageId, QVariantList optionIds);
Q_INVOKABLE void stopPoll(const QString &chatId, const qlonglong &messageId); Q_INVOKABLE void stopPoll(const QString &chatId, qlonglong messageId);
Q_INVOKABLE void getPollVoters(const QString &chatId, const qlonglong &messageId, const int &optionId, const int &limit, const int &offset, const QString &extra); Q_INVOKABLE void getPollVoters(const QString &chatId, qlonglong messageId, int optionId, int limit, int offset, const QString &extra);
Q_INVOKABLE void searchPublicChat(const QString &userName); Q_INVOKABLE void searchPublicChat(const QString &userName);
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);
@ -179,7 +179,7 @@ public:
Q_INVOKABLE void getSecretChat(qlonglong secretChatId); Q_INVOKABLE void getSecretChat(qlonglong secretChatId);
Q_INVOKABLE void closeSecretChat(qlonglong secretChatId); Q_INVOKABLE void closeSecretChat(qlonglong secretChatId);
Q_INVOKABLE void importContacts(const QVariantList &contacts); Q_INVOKABLE void importContacts(const QVariantList &contacts);
Q_INVOKABLE void searchChatMessages(const qlonglong &chatId, const QString &query, const qlonglong fromMessageId = 0); Q_INVOKABLE void searchChatMessages(qlonglong chatId, const QString &query, qlonglong fromMessageId = 0);
Q_INVOKABLE void searchPublicChats(const QString &query); Q_INVOKABLE void searchPublicChats(const QString &query);
Q_INVOKABLE void readAllChatMentions(qlonglong chatId); Q_INVOKABLE void readAllChatMentions(qlonglong chatId);
@ -216,7 +216,7 @@ signals:
void newMessageReceived(qlonglong chatId, const QVariantMap &message); void newMessageReceived(qlonglong chatId, const QVariantMap &message);
void copyToDownloadsSuccessful(const QString &fileName, const QString &filePath); void copyToDownloadsSuccessful(const QString &fileName, const QString &filePath);
void copyToDownloadsError(const QString &fileName, const QString &filePath); void copyToDownloadsError(const QString &fileName, const QString &filePath);
void receivedMessage(const QString &messageId, const QVariantMap &message); void receivedMessage(qlonglong chatId, qlonglong messageId, const QVariantMap &message);
void messageSendSucceeded(qlonglong messageId, qlonglong oldMessageId, const QVariantMap &message); void messageSendSucceeded(qlonglong messageId, qlonglong oldMessageId, const QVariantMap &message);
void activeNotificationsUpdated(const QVariantList notificationGroups); void activeNotificationsUpdated(const QVariantList notificationGroups);
void notificationGroupUpdated(const QVariantMap notificationGroupUpdate); void notificationGroupUpdated(const QVariantMap notificationGroupUpdate);
@ -248,9 +248,9 @@ signals:
void chatTitleUpdated(const QString &chatId, const QString &title); void chatTitleUpdated(const QString &chatId, const QString &title);
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, const QString &extra); void errorReceived(int code, const QString &message, const QString &extra);
void contactsImported(const QVariantList &importerCount, const QVariantList &userIds); void contactsImported(const QVariantList &importerCount, const QVariantList &userIds);
void messageNotFound(const qlonglong messageId); void messageNotFound(qlonglong chatId, qlonglong messageId);
public slots: public slots:
void handleVersionDetected(const QString &version); void handleVersionDetected(const QString &version);
@ -272,8 +272,8 @@ public slots:
void handleSecretChatReceived(qlonglong secretChatId, const QVariantMap &secretChat); void handleSecretChatReceived(qlonglong secretChatId, const QVariantMap &secretChat);
void handleSecretChatUpdated(qlonglong secretChatId, const QVariantMap &secretChat); void handleSecretChatUpdated(qlonglong secretChatId, const QVariantMap &secretChat);
void handleStorageOptimizerChanged(); void handleStorageOptimizerChanged();
void handleErrorReceived(const int code, const QString &message, const QString &extra); void handleErrorReceived(int code, const QString &message, const QString &extra);
void handleMessageInformation(const QString &messageId, const QVariantMap &receivedInformation); void handleMessageInformation(qlonglong chatId, qlonglong messageId, const QVariantMap &receivedInformation);
void handleMessageIsPinnedUpdated(qlonglong chatId, qlonglong messageId, bool isPinned); void handleMessageIsPinnedUpdated(qlonglong chatId, qlonglong messageId, bool isPinned);
private: private: