diff --git a/src/Application.cpp b/src/Application.cpp index 2f8c02587..ed657d0c9 100644 --- a/src/Application.cpp +++ b/src/Application.cpp @@ -81,7 +81,7 @@ void Application::initialize(Settings &settings, Paths &paths) this->windows->updateWordTypeMask(); - this->initNm(); + this->initNm(paths); this->initPubsub(); } @@ -103,17 +103,17 @@ void Application::save() } } -void Application::initNm() +void Application::initNm(Paths &paths) { #ifdef Q_OS_WIN # ifdef QT_DEBUG # ifdef C_DEBUG_NM - this->nativeMessaging->registerHost(); - this->nativeMessaging->openGuiMessageQueue(); + registerNmHost(paths); + this->nmServer.start(); # endif # else - this->nativeMessaging->registerHost(); - this->nativeMessaging->openGuiMessageQueue(); + registerNmHost(paths); + this->nmServer.start(); # endif #endif } diff --git a/src/Application.hpp b/src/Application.hpp index 90e2781af..c872a4c62 100644 --- a/src/Application.hpp +++ b/src/Application.hpp @@ -1,6 +1,7 @@ #pragma once #include "common/Singleton.hpp" +#include "singletons/NativeMessaging.hpp" #include #include @@ -78,7 +79,7 @@ public: private: void addSingleton(Singleton *singleton); void initPubsub(); - void initNm(); + void initNm(Paths &paths); template ::value>> @@ -88,6 +89,8 @@ private: this->singletons_.push_back(std::unique_ptr(t)); return *t; } + + NativeMessagingServer nmServer{}; }; Application *getApp(); diff --git a/src/providers/emoji/Emojis.cpp b/src/providers/emoji/Emojis.cpp index 809b7c3d5..25bc4f6c8 100644 --- a/src/providers/emoji/Emojis.cpp +++ b/src/providers/emoji/Emojis.cpp @@ -217,7 +217,6 @@ void Emojis::loadEmojiSet() auto app = getApp(); getSettings()->emojiSet.connect([=](const auto &emojiSet, auto) { - log("Using emoji set {}", emojiSet); this->emojis.each([=](const auto &name, std::shared_ptr &emoji) { QString emojiSetToUse = emojiSet; diff --git a/src/providers/twitch/TwitchBadges.cpp b/src/providers/twitch/TwitchBadges.cpp index 0e515d627..4bd1bd771 100644 --- a/src/providers/twitch/TwitchBadges.cpp +++ b/src/providers/twitch/TwitchBadges.cpp @@ -46,8 +46,6 @@ void TwitchBadges::loadTwitchBadges() // "title" // "clickAction" - log("{} {}", key, vIt.key()); - (*badgeSets)[key][vIt.key()] = std::make_shared(emote); } } diff --git a/src/singletons/NativeMessaging.cpp b/src/singletons/NativeMessaging.cpp index bedfc7387..dc79afddc 100644 --- a/src/singletons/NativeMessaging.cpp +++ b/src/singletons/NativeMessaging.cpp @@ -141,19 +141,18 @@ void NativeMessagingServer::start() void NativeMessagingServer::ReceiverThread::run() { ipc::message_queue::remove("chatterino_gui"); - ipc::message_queue messageQueue(ipc::open_or_create, "chatterino_gui", 100, MESSAGE_SIZE); while (true) { try { - std::unique_ptr buf = std::make_unique(MESSAGE_SIZE); - ipc::message_queue::size_type retSize; - unsigned int priority; + auto buf = std::make_unique(MESSAGE_SIZE); + auto retSize = ipc::message_queue::size_type(); + auto priority = static_cast(0); messageQueue.receive(buf.get(), MESSAGE_SIZE, retSize, priority); - QJsonDocument document = QJsonDocument::fromJson( + auto document = QJsonDocument::fromJson( QByteArray::fromRawData(buf.get(), retSize)); this->handleMessage(document.object()); diff --git a/src/singletons/NativeMessaging.hpp b/src/singletons/NativeMessaging.hpp index 79c90ebd2..f0575b63f 100644 --- a/src/singletons/NativeMessaging.hpp +++ b/src/singletons/NativeMessaging.hpp @@ -2,12 +2,12 @@ #include +namespace chatterino { + class Application; class Paths; -namespace chatterino { - -void registerNmHost(Application &app); +void registerNmHost(Paths &paths); std::string &getNmQueueName(Paths &paths); class NativeMessagingClient final