2020-08-10 21:17:13 +03:00
|
|
|
#ifndef TDLIBRECEIVER_H
|
|
|
|
#define TDLIBRECEIVER_H
|
|
|
|
|
|
|
|
#include <QDebug>
|
|
|
|
#include <QThread>
|
2020-08-11 00:37:25 +03:00
|
|
|
#include <QJsonDocument>
|
|
|
|
#include <QJsonObject>
|
2020-08-10 21:17:13 +03:00
|
|
|
#include <td/telegram/td_json_client.h>
|
|
|
|
|
|
|
|
class TDLibReceiver : public QThread
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
void run() Q_DECL_OVERRIDE {
|
|
|
|
receiverLoop();
|
|
|
|
}
|
|
|
|
public:
|
|
|
|
explicit TDLibReceiver(void *tdLibClient, QObject *parent = nullptr);
|
|
|
|
void setActive(const bool &active);
|
|
|
|
|
2020-08-11 00:37:25 +03:00
|
|
|
signals:
|
|
|
|
void versionDetected(const QString &version);
|
|
|
|
void authorizationStateChanged(const QString &authorizationState);
|
|
|
|
|
2020-08-10 21:17:13 +03:00
|
|
|
private:
|
|
|
|
void *tdLibClient;
|
|
|
|
bool isActive;
|
|
|
|
|
|
|
|
void receiverLoop();
|
2020-08-12 11:50:01 +03:00
|
|
|
void processReceivedDocument(const QJsonDocument &receivedJsonDocument);
|
|
|
|
void processUpdateOption(const QVariantMap &receivedInformation);
|
|
|
|
void processUpdateAuthorizationState(const QVariantMap &receivedInformation);
|
2020-08-10 21:17:13 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // TDLIBRECEIVER_H
|