diff --git a/src/messages/message.cpp b/src/messages/message.cpp index 99bc9aa4c..0635e8639 100644 --- a/src/messages/message.cpp +++ b/src/messages/message.cpp @@ -7,11 +7,6 @@ #include "ircmanager.hpp" #include "messages/link.hpp" #include "resources.hpp" -#include "settingsmanager.hpp" - -#include -#include -#include #include #include @@ -20,27 +15,16 @@ namespace chatterino { namespace messages { -/* -Message::Message(const QString &text) - : text(text) -{ - this->words.push_back( - Word(text, Word::Text, ColorScheme::getInstance().SystemMessageColor, text, QString())); -} -*/ - -//Message::Message(const QString &text, const std::vector &words, const bool &highlight) -// : text(text) -// , highlightTab(highlight) -// , words(words) -//{ -//} - bool Message::getCanHighlightTab() const { return this->highlightTab; } +void Message::setHighlight(bool value) +{ + this->highlightTab = value; +} + const QString &Message::getTimeoutUser() const { return this->timeoutUser; diff --git a/src/messages/message.hpp b/src/messages/message.hpp index 2646d691a..349ee3cb3 100644 --- a/src/messages/message.hpp +++ b/src/messages/message.hpp @@ -1,15 +1,10 @@ #pragma once -#include "messages/message.hpp" -#include "messages/messageparseargs.hpp" #include "messages/word.hpp" -#include "messages/wordpart.hpp" - -#include -#include #include #include +#include namespace chatterino { @@ -23,11 +18,8 @@ typedef std::shared_ptr SharedMessage; class Message { public: - // explicit Message(const QString &text); - // explicit Message(const QString &text, const std::vector &words, - // const bool &highlight); - bool getCanHighlightTab() const; + void setHighlight(bool value); const QString &getTimeoutUser() const; int getTimeoutCount() const; const QString &getUserName() const; @@ -52,7 +44,9 @@ private: static QRegularExpression *cheerRegex; + // what is highlightTab? bool highlightTab = false; + QString timeoutUser = ""; int timeoutCount = 0; bool disabled = false; diff --git a/src/messages/messagebuilder.cpp b/src/messages/messagebuilder.cpp index 26f69a645..e1513081f 100644 --- a/src/messages/messagebuilder.cpp +++ b/src/messages/messagebuilder.cpp @@ -24,14 +24,14 @@ void MessageBuilder::appendWord(const Word &&word) void MessageBuilder::appendTimestamp() { - time_t t; + std::time_t t; time(&t); - appendTimestamp(t); + this->appendTimestamp(t); } -void MessageBuilder::setHighlight(const bool &value) +void MessageBuilder::setHighlight(bool value) { - highlight = value; + this->message->setHighlight(value); } void MessageBuilder::appendTimestamp(time_t time) @@ -41,14 +41,14 @@ void MessageBuilder::appendTimestamp(time_t time) // Add word for timestamp with no seconds strftime(timeStampBuffer, 69, "%H:%M", localtime(&time)); QString timestampNoSeconds(timeStampBuffer); - appendWord(Word(timestampNoSeconds, Word::TimestampNoSeconds, - MessageColor(MessageColor::System), QString(), QString())); + this->appendWord(Word(timestampNoSeconds, Word::TimestampNoSeconds, + MessageColor(MessageColor::System), QString(), QString())); // Add word for timestamp with seconds strftime(timeStampBuffer, 69, "%H:%M:%S", localtime(&time)); QString timestampWithSeconds(timeStampBuffer); - appendWord(Word(timestampWithSeconds, Word::TimestampWithSeconds, - MessageColor(MessageColor::System), QString(), QString())); + this->appendWord(Word(timestampWithSeconds, Word::TimestampWithSeconds, + MessageColor(MessageColor::System), QString(), QString())); } QString MessageBuilder::matchLink(const QString &string) @@ -67,6 +67,7 @@ QString MessageBuilder::matchLink(const QString &string) if (!captured.contains(httpRegex)) { captured.insert(0, "http://"); } + return captured; } diff --git a/src/messages/messagebuilder.hpp b/src/messages/messagebuilder.hpp index a67f7ae40..adda6e0f5 100644 --- a/src/messages/messagebuilder.hpp +++ b/src/messages/messagebuilder.hpp @@ -19,7 +19,7 @@ public: void appendWord(const Word &&word); void appendTimestamp(); void appendTimestamp(std::time_t time); - void setHighlight(const bool &value); + void setHighlight(bool value); QString matchLink(const QString &string); QRegularExpression linkRegex; diff --git a/src/messages/messageref.cpp b/src/messages/messageref.cpp index b514fcff8..ce55fb058 100644 --- a/src/messages/messageref.cpp +++ b/src/messages/messageref.cpp @@ -1,4 +1,4 @@ -#include "messageref.hpp" +#include "messages/messageref.hpp" #include "emotemanager.hpp" #include "settingsmanager.hpp" diff --git a/src/messages/messageref.hpp b/src/messages/messageref.hpp index 4af0e8d88..745c83b2f 100644 --- a/src/messages/messageref.hpp +++ b/src/messages/messageref.hpp @@ -1,6 +1,7 @@ #pragma once #include "messages/message.hpp" +#include "messages/wordpart.hpp" #include @@ -28,14 +29,14 @@ public: std::shared_ptr buffer = nullptr; bool updateBuffer = false; - const messages::Word *tryGetWordPart(QPoint point); + const Word *tryGetWordPart(QPoint point); int getSelectionIndex(QPoint position); private: // variables SharedMessage message; - std::vector wordParts; + std::vector wordParts; int height = 0; diff --git a/src/twitch/twitchmessagebuilder.cpp b/src/twitch/twitchmessagebuilder.cpp index b46eb7a81..f03c7fbae 100644 --- a/src/twitch/twitchmessagebuilder.cpp +++ b/src/twitch/twitchmessagebuilder.cpp @@ -390,7 +390,8 @@ void TwitchMessageBuilder::parseHighlights() bool alert; }; - QStringList blackList = settings.highlightUserBlacklist.get().split("\n",QString::SkipEmptyParts); + QStringList blackList = + settings.highlightUserBlacklist.get().split("\n", QString::SkipEmptyParts); // TODO: This vector should only be rebuilt upon highlights being changed std::vector activeHighlights; @@ -410,8 +411,7 @@ void TwitchMessageBuilder::parseHighlights() bool doHighlight = false; bool playSound = false; bool doAlert = false; - if(!blackList.contains(this->ircMessage->nick(),Qt::CaseInsensitive)) - { + if (!blackList.contains(this->ircMessage->nick(), Qt::CaseInsensitive)) { for (const Highlight &highlight : activeHighlights) { if (this->originalMessage.contains(highlight.target, Qt::CaseInsensitive)) { qDebug() << "Highlight because " << this->originalMessage << " contains " diff --git a/src/twitch/twitchmessagebuilder.hpp b/src/twitch/twitchmessagebuilder.hpp index d4564f70e..55096eaea 100644 --- a/src/twitch/twitchmessagebuilder.hpp +++ b/src/twitch/twitchmessagebuilder.hpp @@ -2,6 +2,7 @@ #include "emotemanager.hpp" #include "messages/messagebuilder.hpp" +#include "messages/messageparseargs.hpp" #include "resources.hpp" #include "twitch/twitchchannel.hpp"