2019-09-08 22:27:57 +02:00
|
|
|
#pragma once
|
|
|
|
|
2021-05-16 18:51:25 +02:00
|
|
|
#include <QString>
|
2019-09-08 22:27:57 +02:00
|
|
|
#include <QThread>
|
2021-05-16 18:51:25 +02:00
|
|
|
#include <boost/optional.hpp>
|
|
|
|
#include <common/Atomic.hpp>
|
2019-09-08 22:27:57 +02:00
|
|
|
|
|
|
|
namespace chatterino {
|
|
|
|
|
|
|
|
class Application;
|
|
|
|
class Paths;
|
|
|
|
|
|
|
|
void registerNmHost(Paths &paths);
|
|
|
|
std::string &getNmQueueName(Paths &paths);
|
|
|
|
|
2021-05-16 18:51:25 +02:00
|
|
|
Atomic<boost::optional<QString>> &nmIpcError();
|
|
|
|
|
2019-09-08 22:27:57 +02:00
|
|
|
class NativeMessagingClient final
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
void sendMessage(const QByteArray &array);
|
|
|
|
void writeToCout(const QByteArray &array);
|
|
|
|
};
|
|
|
|
|
|
|
|
class NativeMessagingServer final
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
void start();
|
|
|
|
|
|
|
|
private:
|
|
|
|
class ReceiverThread : public QThread
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
void run() override;
|
|
|
|
|
|
|
|
private:
|
|
|
|
void handleMessage(const QJsonObject &root);
|
|
|
|
};
|
|
|
|
|
|
|
|
ReceiverThread thread;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace chatterino
|