#pragma once #include "common/MutexValue.hpp" #include "providers/irc/AbstractIrcServer.hpp" #include "providers/twitch/TwitchAccount.hpp" #include "providers/twitch/TwitchChannel.hpp" #include #include #include namespace chatterino { class TwitchServer final : public irc::AbstractIrcServer { public: TwitchServer(); void initialize(); // fourtf: ugh void forEachChannelAndSpecialChannels(std::function func); std::shared_ptr getChannelOrEmptyByID(const QString &channelID); util::MutexValue lastUserThatWhisperedMe; const ChannelPtr whispersChannel; const ChannelPtr mentionsChannel; IndirectChannel watchingChannel; protected: void initializeConnection(providers::irc::IrcConnection *connection, bool isRead, bool isWrite) override; std::shared_ptr createChannel(const QString &channelName) override; void privateMessageReceived(Communi::IrcPrivateMessage *message) override; void messageReceived(Communi::IrcMessage *message) override; void writeConnectionMessageReceived(Communi::IrcMessage *message) override; std::shared_ptr getCustomChannel(const QString &channelname) override; QString cleanChannelName(const QString &dirtyChannelName) override; private: std::mutex lastMessageMutex_; std::queue lastMessagePleb_; std::queue lastMessageMod_; std::chrono::steady_clock::time_point lastErrorTimeSpeed_; std::chrono::steady_clock::time_point lastErrorTimeAmount_; void onMessageSendRequested(TwitchChannel *channel, const QString &message, bool &sent); }; } // namespace chatterino