From 0f22d9d0024f89cc4db102369724befda280a0dd Mon Sep 17 00:00:00 2001 From: Rasmus Karlsson Date: Sat, 28 Apr 2018 15:48:40 +0200 Subject: [PATCH] move pubsub stuff to the providers/twitch namespace and folder --- chatterino.pro | 11 ++-- src/application.cpp | 26 ++++---- src/application.hpp | 6 +- src/messages/message.cpp | 8 +-- src/messages/message.hpp | 9 +-- .../twitch/pubsub.cpp} | 66 ++++++++++--------- .../twitch/pubsub.hpp} | 21 ++++-- .../twitch}/pubsubactions.cpp | 10 +-- .../twitch}/pubsubactions.hpp | 7 +- .../twitch}/pubsubhelpers.cpp | 10 +-- .../twitch}/pubsubhelpers.hpp | 6 +- src/providers/twitch/twitchchannel.cpp | 5 +- 12 files changed, 104 insertions(+), 81 deletions(-) rename src/{singletons/pubsubmanager.cpp => providers/twitch/pubsub.cpp} (90%) rename src/{singletons/pubsubmanager.hpp => providers/twitch/pubsub.hpp} (91%) rename src/{singletons/helper => providers/twitch}/pubsubactions.cpp (58%) rename src/{singletons/helper => providers/twitch}/pubsubactions.hpp (94%) rename src/{singletons/helper => providers/twitch}/pubsubhelpers.cpp (91%) rename src/{singletons/helper => providers/twitch}/pubsubhelpers.hpp (95%) diff --git a/chatterino.pro b/chatterino.pro index 21fc5db0..5af054bd 100644 --- a/chatterino.pro +++ b/chatterino.pro @@ -104,6 +104,7 @@ SOURCES += \ src/providers/twitch/twitchchannel.cpp \ src/providers/twitch/twitchmessagebuilder.cpp \ src/providers/twitch/twitchserver.cpp \ + src/providers/twitch/pubsub.cpp \ src/singletons/accountmanager.cpp \ src/singletons/commandmanager.cpp \ src/singletons/emotemanager.cpp \ @@ -175,10 +176,9 @@ SOURCES += \ src/widgets/helper/debugpopup.cpp \ src/util/debugcount.cpp \ src/singletons/nativemessagingmanager.cpp \ - src/singletons/pubsubmanager.cpp \ src/util/rapidjson-helpers.cpp \ - src/singletons/helper/pubsubhelpers.cpp \ - src/singletons/helper/pubsubactions.cpp \ + src/providers/twitch/pubsubhelpers.cpp \ + src/providers/twitch/pubsubactions.cpp \ src/widgets/selectchanneldialog.cpp \ src/singletons/updatemanager.cpp \ src/widgets/lastruncrashdialog.cpp \ @@ -213,6 +213,7 @@ HEADERS += \ src/providers/twitch/twitchchannel.hpp \ src/providers/twitch/twitchmessagebuilder.hpp \ src/providers/twitch/twitchserver.hpp \ + src/providers/twitch/pubsub.hpp \ src/singletons/accountmanager.hpp \ src/singletons/commandmanager.hpp \ src/singletons/emotemanager.hpp \ @@ -304,8 +305,8 @@ HEADERS += \ src/singletons/nativemessagingmanager.hpp \ src/singletons/pubsubmanager.hpp \ src/util/rapidjson-helpers.hpp \ - src/singletons/helper/pubsubhelpers.hpp \ - src/singletons/helper/pubsubactions.hpp \ + src/providers/twitch/pubsubhelpers.hpp \ + src/providers/twitch/pubsubactions.hpp \ src/widgets/selectchanneldialog.hpp \ src/singletons/updatemanager.hpp \ src/widgets/lastruncrashdialog.hpp \ diff --git a/src/application.cpp b/src/application.cpp index eb3827d7..2e1231f4 100644 --- a/src/application.cpp +++ b/src/application.cpp @@ -1,5 +1,6 @@ #include "application.hpp" +#include "providers/twitch/pubsub.hpp" #include "providers/twitch/twitchserver.hpp" #include "singletons/accountmanager.hpp" #include "singletons/commandmanager.hpp" @@ -8,7 +9,6 @@ #include "singletons/loggingmanager.hpp" #include "singletons/nativemessagingmanager.hpp" #include "singletons/pathmanager.hpp" -#include "singletons/pubsubmanager.hpp" #include "singletons/resourcemanager.hpp" #include "singletons/settingsmanager.hpp" #include "singletons/thememanager.hpp" @@ -66,12 +66,12 @@ void Application::construct() this->commands = new singletons::CommandManager; this->accounts = new singletons::AccountManager; this->emotes = new singletons::EmoteManager; - this->pubsub = new singletons::PubSubManager; this->settings = new singletons::SettingManager; this->fonts = new singletons::FontManager; this->resources = new singletons::ResourceManager; this->twitch.server = new providers::twitch::TwitchServer; + this->twitch.pubsub = new providers::twitch::PubSub; } void Application::instantiate(int argc, char **argv) @@ -106,29 +106,29 @@ void Application::initialize() this->nativeMessaging->openGuiMessageQueue(); - this->pubsub->sig.whisper.sent.connect([](const auto &msg) { + this->twitch.pubsub->sig.whisper.sent.connect([](const auto &msg) { debug::Log("WHISPER SENT LOL"); // }); - this->pubsub->sig.whisper.received.connect([](const auto &msg) { + this->twitch.pubsub->sig.whisper.received.connect([](const auto &msg) { debug::Log("WHISPER RECEIVED LOL"); // }); - this->pubsub->sig.moderation.chatCleared.connect([&](const auto &action) { + this->twitch.pubsub->sig.moderation.chatCleared.connect([&](const auto &action) { debug::Log("Chat cleared by {}", action.source.name); // }); - this->pubsub->sig.moderation.modeChanged.connect([&](const auto &action) { + this->twitch.pubsub->sig.moderation.modeChanged.connect([&](const auto &action) { debug::Log("Mode {} was turned {} by {} (duration {})", (int &)action.mode, (bool &)action.state, action.source.name, action.args.duration); }); - this->pubsub->sig.moderation.moderationStateChanged.connect([&](const auto &action) { + this->twitch.pubsub->sig.moderation.moderationStateChanged.connect([&](const auto &action) { debug::Log("User {} was {} by {}", action.target.id, action.modded ? "modded" : "unmodded", action.source.name); }); - this->pubsub->sig.moderation.userBanned.connect([&](const auto &action) { + this->twitch.pubsub->sig.moderation.userBanned.connect([&](const auto &action) { auto chan = this->twitch.server->getChannelOrEmptyByID(action.roomID); if (chan->isEmpty()) { @@ -140,7 +140,7 @@ void Application::initialize() util::postToThread([chan, msg] { chan->addMessage(msg); }); }); - this->pubsub->sig.moderation.userUnbanned.connect([&](const auto &action) { + this->twitch.pubsub->sig.moderation.userUnbanned.connect([&](const auto &action) { auto chan = this->twitch.server->getChannelOrEmptyByID(action.roomID); if (chan->isEmpty()) { @@ -152,14 +152,14 @@ void Application::initialize() util::postToThread([chan, msg] { chan->addMessage(msg); }); }); - this->pubsub->Start(); + this->twitch.pubsub->Start(); auto RequestModerationActions = [=]() { - this->pubsub->UnlistenAllModerationActions(); + this->twitch.pubsub->UnlistenAllModerationActions(); // TODO(pajlada): Unlisten to all authed topics instead of only moderation topics - // this->pubsub->UnlistenAllAuthedTopics(); + // this->twitch.pubsub->UnlistenAllAuthedTopics(); - this->pubsub->ListenToWhispers(this->accounts->Twitch.getCurrent()); // + this->twitch.pubsub->ListenToWhispers(this->accounts->Twitch.getCurrent()); // }; this->accounts->Twitch.userChanged.connect(RequestModerationActions); diff --git a/src/application.hpp b/src/application.hpp index 22aed68b..071eedc9 100644 --- a/src/application.hpp +++ b/src/application.hpp @@ -11,6 +11,7 @@ namespace providers { namespace twitch { class TwitchServer; +class PubSub; } // namespace twitch } // namespace providers @@ -24,7 +25,6 @@ class PathManager; class CommandManager; class AccountManager; class EmoteManager; -class PubSubManager; class NativeMessagingManager; class SettingManager; class FontManager; @@ -56,7 +56,6 @@ public: singletons::CommandManager *commands = nullptr; singletons::AccountManager *accounts = nullptr; singletons::EmoteManager *emotes = nullptr; - singletons::PubSubManager *pubsub = nullptr; singletons::NativeMessagingManager *nativeMessaging = nullptr; singletons::SettingManager *settings = nullptr; singletons::FontManager *fonts = nullptr; @@ -64,7 +63,8 @@ public: /// Provider-specific struct { - providers::twitch::TwitchServer *server; + providers::twitch::TwitchServer *server = nullptr; + providers::twitch::PubSub *pubsub = nullptr; } twitch; void save(); diff --git a/src/messages/message.cpp b/src/messages/message.cpp index 02e53555..38ea0837 100644 --- a/src/messages/message.cpp +++ b/src/messages/message.cpp @@ -1,6 +1,6 @@ #include "messages/message.hpp" #include "messageelement.hpp" -#include "singletons/helper/pubsubactions.hpp" +#include "providers/twitch/pubsubactions.hpp" #include "util/irchelpers.hpp" using SBHighlight = chatterino::widgets::ScrollbarHighlight; @@ -79,7 +79,7 @@ MessagePtr Message::createTimeoutMessage(const QString &username, const QString return message; } -MessagePtr Message::createTimeoutMessage(const singletons::BanAction &action, uint32_t count) +MessagePtr Message::createTimeoutMessage(const providers::twitch::BanAction &action, uint32_t count) { MessagePtr msg(new Message); @@ -89,7 +89,7 @@ MessagePtr Message::createTimeoutMessage(const singletons::BanAction &action, ui msg->timeoutUser = action.target.name; msg->count = count; - msg->banAction.reset(new singletons::BanAction(action)); + msg->banAction.reset(new providers::twitch::BanAction(action)); QString text; @@ -130,7 +130,7 @@ MessagePtr Message::createTimeoutMessage(const singletons::BanAction &action, ui return msg; } -MessagePtr Message::createUntimeoutMessage(const singletons::UnbanAction &action) +MessagePtr Message::createUntimeoutMessage(const providers::twitch::UnbanAction &action) { MessagePtr msg(new Message); diff --git a/src/messages/message.hpp b/src/messages/message.hpp index f039c021..d3f81367 100644 --- a/src/messages/message.hpp +++ b/src/messages/message.hpp @@ -1,7 +1,7 @@ #pragma once #include "messages/messageelement.hpp" -#include "singletons/helper/pubsubactions.hpp" +#include "providers/twitch/pubsubactions.hpp" #include "util/flagsenum.hpp" #include "widgets/helper/scrollbarhighlight.hpp" @@ -50,7 +50,7 @@ struct Message { QString localizedName; QString timeoutUser; - std::unique_ptr banAction; + std::unique_ptr banAction; uint32_t count = 1; // Messages should not be added after the message is done initializing. @@ -70,9 +70,10 @@ public: const QString &durationInSeconds, const QString &reason, bool multipleTimes); - static std::shared_ptr createTimeoutMessage(const singletons::BanAction &action, + static std::shared_ptr createTimeoutMessage(const providers::twitch::BanAction &action, uint32_t count = 1); - static std::shared_ptr createUntimeoutMessage(const singletons::UnbanAction &action); + static std::shared_ptr createUntimeoutMessage( + const providers::twitch::UnbanAction &action); }; using MessagePtr = std::shared_ptr; diff --git a/src/singletons/pubsubmanager.cpp b/src/providers/twitch/pubsub.cpp similarity index 90% rename from src/singletons/pubsubmanager.cpp rename to src/providers/twitch/pubsub.cpp index 17a8449a..22a48bd5 100644 --- a/src/singletons/pubsubmanager.cpp +++ b/src/providers/twitch/pubsub.cpp @@ -1,9 +1,9 @@ -#include "singletons/pubsubmanager.hpp" +#include "providers/twitch/pubsub.hpp" #include "debug/log.hpp" +#include "providers/twitch/pubsubactions.hpp" +#include "providers/twitch/pubsubhelpers.hpp" #include "singletons/accountmanager.hpp" -#include "singletons/helper/pubsubactions.hpp" -#include "singletons/helper/pubsubhelpers.hpp" #include "util/rapidjson-helpers.hpp" #include @@ -18,12 +18,15 @@ using websocketpp::lib::placeholders::_1; using websocketpp::lib::placeholders::_2; namespace chatterino { -namespace singletons { +namespace providers { +namespace twitch { static const char *pingPayload = "{\"type\":\"PING\"}"; static std::map sentMessages; +namespace detail { + PubSubClient::PubSubClient(WebsocketClient &_websocketClient, WebsocketHandle _handle) : websocketClient(_websocketClient) , handle(_handle) @@ -170,9 +173,11 @@ bool PubSubClient::Send(const char *payload) return true; } -PubSubManager::PubSubManager() +} // namespace detail + +PubSub::PubSub() { - qDebug() << "init PubSubManager"; + qDebug() << "init PubSub"; this->moderationActionHandlers["clear"] = [this](const auto &data, const auto &roomID) { ClearChatAction action(data, roomID); @@ -420,17 +425,17 @@ PubSubManager::PubSubManager() this->websocketClient.init_asio(); // SSL Handshake - this->websocketClient.set_tls_init_handler(bind(&PubSubManager::OnTLSInit, this, ::_1)); + this->websocketClient.set_tls_init_handler(bind(&PubSub::OnTLSInit, this, ::_1)); - this->websocketClient.set_message_handler(bind(&PubSubManager::OnMessage, this, ::_1, ::_2)); - this->websocketClient.set_open_handler(bind(&PubSubManager::OnConnectionOpen, this, ::_1)); - this->websocketClient.set_close_handler(bind(&PubSubManager::OnConnectionClose, this, ::_1)); + this->websocketClient.set_message_handler(bind(&PubSub::OnMessage, this, ::_1, ::_2)); + this->websocketClient.set_open_handler(bind(&PubSub::OnConnectionOpen, this, ::_1)); + this->websocketClient.set_close_handler(bind(&PubSub::OnConnectionClose, this, ::_1)); // Add an initial client this->AddClient(); } -void PubSubManager::AddClient() +void PubSub::AddClient() { websocketpp::lib::error_code ec; auto con = this->websocketClient.get_connection(TWITCH_PUBSUB_URL, ec); @@ -443,12 +448,12 @@ void PubSubManager::AddClient() this->websocketClient.connect(con); } -void PubSubManager::Start() +void PubSub::Start() { - this->mainThread.reset(new std::thread(std::bind(&PubSubManager::RunThread, this))); + this->mainThread.reset(new std::thread(std::bind(&PubSub::RunThread, this))); } -void PubSubManager::ListenToWhispers(std::shared_ptr account) +void PubSub::ListenToWhispers(std::shared_ptr account) { assert(account != nullptr); @@ -467,7 +472,7 @@ void PubSubManager::ListenToWhispers(std::shared_ptrclients) { const auto &client = p.second; @@ -475,7 +480,7 @@ void PubSubManager::UnlistenAllModerationActions() } } -void PubSubManager::ListenToChannelModerationActions( +void PubSub::ListenToChannelModerationActions( const QString &channelID, std::shared_ptr account) { assert(!channelID.isEmpty()); @@ -495,15 +500,15 @@ void PubSubManager::ListenToChannelModerationActions( this->listenToTopic(topic, account); } -void PubSubManager::listenToTopic(const std::string &topic, - std::shared_ptr account) +void PubSub::listenToTopic(const std::string &topic, + std::shared_ptr account) { auto message = CreateListenMessage({topic}, account); this->Listen(std::move(message)); } -void PubSubManager::Listen(rapidjson::Document &&msg) +void PubSub::Listen(rapidjson::Document &&msg) { if (this->TryListen(msg)) { debug::Log("Successfully listened!"); @@ -514,7 +519,7 @@ void PubSubManager::Listen(rapidjson::Document &&msg) this->requests.emplace_back(std::make_unique(std::move(msg))); } -bool PubSubManager::TryListen(rapidjson::Document &msg) +bool PubSub::TryListen(rapidjson::Document &msg) { debug::Log("TryListen with {} clients", this->clients.size()); for (const auto &p : this->clients) { @@ -527,7 +532,7 @@ bool PubSubManager::TryListen(rapidjson::Document &msg) return false; } -bool PubSubManager::isListeningToTopic(const std::string &topic) +bool PubSub::isListeningToTopic(const std::string &topic) { for (const auto &p : this->clients) { const auto &client = p.second; @@ -539,7 +544,7 @@ bool PubSubManager::isListeningToTopic(const std::string &topic) return false; } -void PubSubManager::OnMessage(websocketpp::connection_hdl hdl, WebsocketMessagePtr websocketMessage) +void PubSub::OnMessage(websocketpp::connection_hdl hdl, WebsocketMessagePtr websocketMessage) { const std::string &payload = websocketMessage->get_payload(); @@ -596,9 +601,9 @@ void PubSubManager::OnMessage(websocketpp::connection_hdl hdl, WebsocketMessageP } } -void PubSubManager::OnConnectionOpen(WebsocketHandle hdl) +void PubSub::OnConnectionOpen(WebsocketHandle hdl) { - auto client = std::make_shared(this->websocketClient, hdl); + auto client = std::make_shared(this->websocketClient, hdl); // We separate the starting from the constructor because we will want to use shared_from_this client->Start(); @@ -608,7 +613,7 @@ void PubSubManager::OnConnectionOpen(WebsocketHandle hdl) this->connected.invoke(); } -void PubSubManager::OnConnectionClose(WebsocketHandle hdl) +void PubSub::OnConnectionClose(WebsocketHandle hdl) { auto clientIt = this->clients.find(hdl); @@ -625,7 +630,7 @@ void PubSubManager::OnConnectionClose(WebsocketHandle hdl) this->connected.invoke(); } -PubSubManager::WebsocketContextPtr PubSubManager::OnTLSInit(websocketpp::connection_hdl hdl) +PubSub::WebsocketContextPtr PubSub::OnTLSInit(websocketpp::connection_hdl hdl) { WebsocketContextPtr ctx(new boost::asio::ssl::context(boost::asio::ssl::context::tlsv1)); @@ -640,7 +645,7 @@ PubSubManager::WebsocketContextPtr PubSubManager::OnTLSInit(websocketpp::connect return ctx; } -void PubSubManager::HandleListenResponse(const rapidjson::Document &msg) +void PubSub::HandleListenResponse(const rapidjson::Document &msg) { std::string error; @@ -661,7 +666,7 @@ void PubSubManager::HandleListenResponse(const rapidjson::Document &msg) } } -void PubSubManager::HandleMessageResponse(const rapidjson::Value &outerData) +void PubSub::HandleMessageResponse(const rapidjson::Value &outerData) { QString topic; @@ -733,12 +738,13 @@ void PubSubManager::HandleMessageResponse(const rapidjson::Value &outerData) } } -void PubSubManager::RunThread() +void PubSub::RunThread() { debug::Log("Start pubsub manager thread"); this->websocketClient.run(); debug::Log("Done with pubsub manager thread"); } -} // namespace singletons +} // namespace twitch +} // namespace providers } // namespace chatterino diff --git a/src/singletons/pubsubmanager.hpp b/src/providers/twitch/pubsub.hpp similarity index 91% rename from src/singletons/pubsubmanager.hpp rename to src/providers/twitch/pubsub.hpp index 17095b0b..a21867f9 100644 --- a/src/singletons/pubsubmanager.hpp +++ b/src/providers/twitch/pubsub.hpp @@ -1,8 +1,8 @@ #pragma once +#include "providers/twitch/pubsubactions.hpp" #include "providers/twitch/twitchaccount.hpp" #include "providers/twitch/twitchserver.hpp" -#include "singletons/helper/pubsubactions.hpp" #include #include @@ -21,7 +21,8 @@ #include namespace chatterino { -namespace singletons { +namespace providers { +namespace twitch { using WebsocketClient = websocketpp::client; using WebsocketHandle = websocketpp::connection_hdl; @@ -30,6 +31,8 @@ using WebsocketErrorCode = websocketpp::lib::error_code; #define MAX_PUBSUB_LISTENS 50 #define MAX_PUBSUB_CONNECTIONS 10 +namespace detail { + struct Listener { std::string topic; bool authed; @@ -66,7 +69,9 @@ private: bool Send(const char *payload); }; -class PubSubManager +} // namespace detail + +class PubSub { using WebsocketMessagePtr = websocketpp::config::asio_tls_client::message_type::ptr; using WebsocketContextPtr = websocketpp::lib::shared_ptr; @@ -78,9 +83,9 @@ class PubSubManager std::unique_ptr mainThread; public: - PubSubManager(); + PubSub(); - ~PubSubManager() = delete; + ~PubSub() = delete; enum class State { Connected, @@ -136,7 +141,8 @@ private: State state = State::Connected; - std::map, std::owner_less> + std::map, + std::owner_less> clients; std::unordered_map> @@ -153,5 +159,6 @@ private: void RunThread(); }; -} // namespace singletons +} // namespace twitch +} // namespace providers } // namespace chatterino diff --git a/src/singletons/helper/pubsubactions.cpp b/src/providers/twitch/pubsubactions.cpp similarity index 58% rename from src/singletons/helper/pubsubactions.cpp rename to src/providers/twitch/pubsubactions.cpp index 02fddc55..d18b4fc5 100644 --- a/src/singletons/helper/pubsubactions.cpp +++ b/src/providers/twitch/pubsubactions.cpp @@ -1,9 +1,10 @@ -#include "singletons/helper/pubsubactions.hpp" +#include "providers/twitch/pubsubactions.hpp" -#include "singletons/helper/pubsubhelpers.hpp" +#include "providers/twitch/pubsubhelpers.hpp" namespace chatterino { -namespace singletons { +namespace providers { +namespace twitch { PubSubAction::PubSubAction(const rapidjson::Value &data, const QString &_roomID) : timestamp(std::chrono::steady_clock::now()) @@ -12,5 +13,6 @@ PubSubAction::PubSubAction(const rapidjson::Value &data, const QString &_roomID) getCreatedByUser(data, this->source); } -} // namespace singletons +} // namespace twitch +} // namespace providers } // namespace chatterino diff --git a/src/singletons/helper/pubsubactions.hpp b/src/providers/twitch/pubsubactions.hpp similarity index 94% rename from src/singletons/helper/pubsubactions.hpp rename to src/providers/twitch/pubsubactions.hpp index fe0796e7..68c02627 100644 --- a/src/singletons/helper/pubsubactions.hpp +++ b/src/providers/twitch/pubsubactions.hpp @@ -1,14 +1,14 @@ #pragma once #include - #include #include #include namespace chatterino { -namespace singletons { +namespace providers { +namespace twitch { struct ActionUser { QString id; @@ -91,5 +91,6 @@ struct ModerationStateAction : PubSubAction { bool modded; }; -} // namespace singletons +} // namespace twitch +} // namespace providers } // namespace chatterino diff --git a/src/singletons/helper/pubsubhelpers.cpp b/src/providers/twitch/pubsubhelpers.cpp similarity index 91% rename from src/singletons/helper/pubsubhelpers.cpp rename to src/providers/twitch/pubsubhelpers.cpp index d7b79ada..0c88a595 100644 --- a/src/singletons/helper/pubsubhelpers.cpp +++ b/src/providers/twitch/pubsubhelpers.cpp @@ -1,11 +1,12 @@ -#include "singletons/helper/pubsubhelpers.hpp" +#include "providers/twitch/pubsubhelpers.hpp" +#include "providers/twitch/pubsubactions.hpp" #include "singletons/accountmanager.hpp" -#include "singletons/helper/pubsubactions.hpp" #include "util/rapidjson-helpers.hpp" namespace chatterino { -namespace singletons { +namespace providers { +namespace twitch { const rapidjson::Value &getArgs(const rapidjson::Value &data) { @@ -85,5 +86,6 @@ rapidjson::Document CreateUnlistenMessage(const std::vector &topics return msg; } -} // namespace singletons +} // namespace twitch +} // namespace providers } // namespace chatterino diff --git a/src/singletons/helper/pubsubhelpers.hpp b/src/providers/twitch/pubsubhelpers.hpp similarity index 95% rename from src/singletons/helper/pubsubhelpers.hpp rename to src/providers/twitch/pubsubhelpers.hpp index 8794bd31..49a0b9da 100644 --- a/src/singletons/helper/pubsubhelpers.hpp +++ b/src/providers/twitch/pubsubhelpers.hpp @@ -10,7 +10,8 @@ #include namespace chatterino { -namespace singletons { +namespace providers { +namespace twitch { struct ActionUser; @@ -59,5 +60,6 @@ void RunAfter(std::shared_ptr timer, Duration duratio }); } -} // namespace singletons +} // namespace twitch +} // namespace providers } // namespace chatterino diff --git a/src/providers/twitch/twitchchannel.cpp b/src/providers/twitch/twitchchannel.cpp index 85905694..525184db 100644 --- a/src/providers/twitch/twitchchannel.cpp +++ b/src/providers/twitch/twitchchannel.cpp @@ -1,12 +1,13 @@ #include "providers/twitch/twitchchannel.hpp" + #include "common.hpp" #include "debug/log.hpp" #include "messages/message.hpp" +#include "providers/twitch/pubsub.hpp" #include "providers/twitch/twitchmessagebuilder.hpp" #include "singletons/accountmanager.hpp" #include "singletons/emotemanager.hpp" #include "singletons/ircmanager.hpp" -#include "singletons/pubsubmanager.hpp" #include "singletons/settingsmanager.hpp" #include "util/posttothread.hpp" #include "util/urlfetch.hpp" @@ -57,7 +58,7 @@ TwitchChannel::TwitchChannel(const QString &channelName, Communi::IrcConnection auto account = app->accounts->Twitch.getCurrent(); if (account && !account->getUserId().isEmpty()) { - app->pubsub->ListenToChannelModerationActions(this->roomID, account); + app->twitch.pubsub->ListenToChannelModerationActions(this->roomID, account); } };