Adapt handling of sponsored messages to the new format

This commit is contained in:
Slava Monich 2022-03-27 21:50:17 +03:00
parent 3c5bf563a6
commit 5f16156f01
2 changed files with 1 additions and 13 deletions

View file

@ -346,17 +346,6 @@ void TDLibWrapper::viewMessage(qlonglong chatId, qlonglong messageId, bool force
this->sendRequest(requestObject); this->sendRequest(requestObject);
} }
void TDLibWrapper::viewSponsoredMessage(qlonglong chatId, qlonglong messageId)
{
LOG("Mark sponsored message as viewed" << chatId << messageId);
QVariantMap requestObject;
requestObject.insert(_TYPE, "viewSponsoredMessage");
requestObject.insert(CHAT_ID, chatId);
requestObject.insert("sponsored_message_id", messageId);
requestObject.insert(_EXTRA, "viewSponsoredMessage");
this->sendRequest(requestObject);
}
void TDLibWrapper::pinMessage(const QString &chatId, const QString &messageId, bool disableNotification) void TDLibWrapper::pinMessage(const QString &chatId, const QString &messageId, bool disableNotification)
{ {
LOG("Pin message to chat" << chatId << messageId << disableNotification); LOG("Pin message to chat" << chatId << messageId << disableNotification);
@ -1890,7 +1879,7 @@ void TDLibWrapper::handleSponsoredMessage(qlonglong chatId, const QVariantMap &m
break; break;
case AppSettings::SponsoredMessAutoView: case AppSettings::SponsoredMessAutoView:
LOG("Auto-viewing sponsored message"); LOG("Auto-viewing sponsored message");
viewSponsoredMessage(chatId, message.value(ID).toULongLong()); viewMessage(chatId, message.value(MESSAGE_ID).toULongLong(), false);
break; break;
case AppSettings::SponsoredMessIgnore: case AppSettings::SponsoredMessIgnore:
LOG("Ignoring sponsored message"); LOG("Ignoring sponsored message");

View file

@ -159,7 +159,6 @@ public:
Q_INVOKABLE void deleteChat(qlonglong chatId); Q_INVOKABLE void deleteChat(qlonglong chatId);
Q_INVOKABLE void getChatHistory(qlonglong chatId, 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(qlonglong chatId, qlonglong messageId, bool force); Q_INVOKABLE void viewMessage(qlonglong chatId, qlonglong messageId, bool force);
Q_INVOKABLE void viewSponsoredMessage(qlonglong chatId, qlonglong messageId);
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);
Q_INVOKABLE void sendTextMessage(const QString &chatId, const QString &message, const QString &replyToMessageId = "0"); Q_INVOKABLE void sendTextMessage(const QString &chatId, const QString &message, const QString &replyToMessageId = "0");