Enable Telegram Notification API

This commit is contained in:
Sebastian J. Wolf 2020-09-01 23:14:59 +02:00
parent d35d15a7e0
commit 436bce0966
2 changed files with 15 additions and 0 deletions

View file

@ -67,6 +67,7 @@ TDLibWrapper::TDLibWrapper(QObject *parent) : QObject(parent)
this->tdLibReceiver->start();
this->setLogVerbosityLevel();
this->setOptionInteger("notification_group_count_max", 5);
}
TDLibWrapper::~TDLibWrapper()
@ -218,6 +219,19 @@ void TDLibWrapper::getMessage(const QString &chatId, const QString &messageId)
this->sendRequest(requestObject);
}
void TDLibWrapper::setOptionInteger(const QString &optionName, const int &optionValue)
{
qDebug() << "[TDLibWrapper] Setting integet option " << optionName << optionValue;
QVariantMap requestObject;
requestObject.insert("@type", "setOption");
requestObject.insert("name", optionName);
QVariantMap optionValueMap;
optionValueMap.insert("@type", "optionValueInteger");
optionValueMap.insert("value", optionValue);
requestObject.insert("value", optionValueMap);
this->sendRequest(requestObject);
}
QVariantMap TDLibWrapper::getUserInformation()
{
return this->userInformation;

View file

@ -83,6 +83,7 @@ public:
Q_INVOKABLE void viewMessage(const QString &chatId, const QString &messageId);
Q_INVOKABLE void sendTextMessage(const QString &chatId, const QString &message, const QString &replyToMessageId = "0");
Q_INVOKABLE void getMessage(const QString &chatId, const QString &messageId);
Q_INVOKABLE void setOptionInteger(const QString &optionName, const int &optionValue);
signals:
void versionDetected(const QString &version);