#ifndef MESSAGE_H #define MESSAGE_H #include "channel.h" #include "word.h" #include "wordpart.h" #include #include #include class Message { public: Message(const QString &text); Message(const IrcPrivateMessage &ircMessage, const Channel &Channel, bool enablePingSound = true, bool isReceivedWhisper = false, bool isSentWhisper = false, bool includeChannel = false); ~Message() { if (m_wordParts != NULL) { delete m_wordParts; } } bool canHighlightTab() const { return m_highlightTab; } const QString & timeoutUser() const { return m_timeoutUser; } int timeoutCount() const { return m_timeoutCount; } const QString & userName() const { return m_userName; } const QString & displayName() const { return m_displayName; } const std::vector words() const { return m_words; } const std::vector wordParts() const { return *m_wordParts; } bool disabled() const { return m_disabled; } const QString & id() const { return m_id; } int height() const { return m_height; } bool layout(int width, bool enableEmoteMargins = true); void requestRelayout() { m_relayoutRequested = true; } private: static LazyLoadedImage *badgeStaff; static LazyLoadedImage *badgeAdmin; static LazyLoadedImage *badgeGlobalmod; static LazyLoadedImage *badgeModerator; static LazyLoadedImage *badgeTurbo; static LazyLoadedImage *badgeBroadcaster; static LazyLoadedImage *badgePremium; static QRegularExpression *cheerRegex; bool m_highlightTab = false; QString m_timeoutUser = ""; int m_timeoutCount = 0; bool m_disabled = false; std::chrono::time_point m_parseTime; QString m_userName = ""; QString m_displayName = ""; QString m_id = ""; int m_height = 0; std::vector m_words; std::vector *m_wordParts; long m_currentLayoutWidth = -1; bool m_relayoutRequested = true; int m_fontGeneration = -1; int m_emoteGeneration = -1; static QString matchLink(const QString &string); static bool sortTwitchEmotes( const std::pair &a, const std::pair &b); }; #endif // MESSAGE_H