mirror-chatterino2/src/singletons/NativeMessaging.hpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

47 lines
843 B
C++
Raw Normal View History

2018-04-09 22:59:19 +02:00
#pragma once
#include "common/Atomic.hpp"
#include <boost/optional.hpp>
#include <QString>
#include <QThread>
2018-09-17 12:51:16 +02:00
namespace chatterino {
2018-08-02 14:23:27 +02:00
class Application;
class Paths;
2018-09-17 12:51:16 +02:00
void registerNmHost(Paths &paths);
2018-08-02 14:23:27 +02:00
std::string &getNmQueueName(Paths &paths);
Atomic<boost::optional<QString>> &nmIpcError();
namespace nm::client {
2018-08-02 14:23:27 +02:00
void sendMessage(const QByteArray &array);
void writeToCout(const QByteArray &array);
} // namespace nm::client
2018-08-02 14:23:27 +02:00
class NativeMessagingServer final
{
public:
void start();
2018-08-02 14:23:27 +02:00
private:
2018-04-09 22:59:19 +02:00
class ReceiverThread : public QThread
{
public:
void run() override;
private:
void handleMessage(const QJsonObject &root);
void handleSelect(const QJsonObject &root);
void handleDetach(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
};
2018-04-09 22:59:19 +02:00
} // namespace chatterino