2018-04-09 22:59:19 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <QThread>
|
|
|
|
|
2018-08-02 14:23:27 +02:00
|
|
|
class Application;
|
|
|
|
class Paths;
|
|
|
|
|
2018-04-09 22:59:19 +02:00
|
|
|
namespace chatterino {
|
2018-08-02 14:23:27 +02:00
|
|
|
|
|
|
|
void registerNmHost(Application &app);
|
|
|
|
std::string &getNmQueueName(Paths &paths);
|
|
|
|
|
|
|
|
class NativeMessagingClient final
|
2018-04-09 22:59:19 +02:00
|
|
|
{
|
2018-04-28 15:20:18 +02:00
|
|
|
public:
|
2018-08-02 14:23:27 +02:00
|
|
|
void sendMessage(const QByteArray &array);
|
|
|
|
void writeToCout(const QByteArray &array);
|
|
|
|
};
|
2018-04-09 22:59:19 +02:00
|
|
|
|
2018-08-02 14:23:27 +02:00
|
|
|
class NativeMessagingServer final
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
void start();
|
|
|
|
|
|
|
|
private:
|
2018-04-09 22:59:19 +02:00
|
|
|
class ReceiverThread : public QThread
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
void run() override;
|
2018-04-12 01:17:25 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
void handleMessage(const QJsonObject &root);
|
2018-04-09 22:59:19 +02:00
|
|
|
};
|
|
|
|
|
2018-08-02 14:23:27 +02:00
|
|
|
ReceiverThread thread;
|
2018-04-09 22:59:19 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace chatterino
|