#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 AbstractIrcServer { public: TwitchServer(); void initialize(); // fourtf: ugh void forEachChannelAndSpecialChannels(std::function func); std::shared_ptr getChannelOrEmptyByID(const QString &channelID); MutexValue lastUserThatWhisperedMe; const ChannelPtr whispersChannel; const ChannelPtr mentionsChannel; IndirectChannel watchingChannel; protected: void initializeConnection(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