#pragma once #include "messages/LimitedQueueSnapshot.hpp" #include #include #include namespace chatterino { class IAbstractIrcServer; class ITwitchIrcServer; class Channel; using ChannelPtr = std::shared_ptr; struct Message; using MessagePtr = std::shared_ptr; class TwitchChannel; class TwitchMessageBuilder; struct ClearChatMessage { MessagePtr message; bool disableAllMessages; }; class IrcMessageHandler { IrcMessageHandler() = default; public: static IrcMessageHandler &instance(); /** * Parse an IRC message into 0 or more Chatterino messages * Takes previously loaded messages into consideration to add reply contexts **/ static std::vector parseMessageWithReply( Channel *channel, Communi::IrcMessage *message, std::vector &otherLoaded); void handlePrivMessage(Communi::IrcPrivateMessage *message, ITwitchIrcServer &twitchServer, IAbstractIrcServer &abstractIrcServer); void handleRoomStateMessage(Communi::IrcMessage *message); void handleClearChatMessage(Communi::IrcMessage *message); void handleClearMessageMessage(Communi::IrcMessage *message); void handleUserStateMessage(Communi::IrcMessage *message); void handleGlobalUserStateMessage(Communi::IrcMessage *message); void handleWhisperMessage(Communi::IrcMessage *ircMessage); void handleUserNoticeMessage(Communi::IrcMessage *message, ITwitchIrcServer &twitchServer, IAbstractIrcServer &abstractIrcServer); void handleNoticeMessage(Communi::IrcNoticeMessage *message); void handleJoinMessage(Communi::IrcMessage *message); void handlePartMessage(Communi::IrcMessage *message); void addMessage(Communi::IrcMessage *message, const ChannelPtr &chan, const QString &originalContent, ITwitchIrcServer &server, bool isSub, bool isAction); private: static float similarity(const MessagePtr &msg, const LimitedQueueSnapshot &messages); static void setSimilarityFlags(const MessagePtr &message, const ChannelPtr &channel); }; } // namespace chatterino