diff --git a/resources/images/verified.png b/resources/images/verified.png
new file mode 100644
index 000000000..b34330b34
Binary files /dev/null and b/resources/images/verified.png differ
diff --git a/resources/resources.qrc b/resources/resources.qrc
index 0c300cabf..0195cedce 100644
--- a/resources/resources.qrc
+++ b/resources/resources.qrc
@@ -8,6 +8,7 @@
images/cheer10000.png
images/cheer100000.png
images/cheer5000.png
+ images/verified.png
images/CopyLongTextToClipboard_16x.png
images/CustomActionEditor_16x.png
images/Emoji_Color_1F60A_19.png
diff --git a/src/messages/message.cpp b/src/messages/message.cpp
index a016e51c4..119ffef5c 100644
--- a/src/messages/message.cpp
+++ b/src/messages/message.cpp
@@ -21,67 +21,66 @@ namespace chatterino {
namespace messages {
Message::Message(const QString &text)
- : _text(text)
- , _words()
+ : text(text)
{
- _words.push_back(
+ this->words.push_back(
Word(text, Word::Text, ColorScheme::getInstance().SystemMessageColor, text, QString()));
}
Message::Message(const QString &text, const std::vector &words)
- : _text(text)
- , _words(words)
+ : text(text)
+ , words(words)
{
}
bool Message::getCanHighlightTab() const
{
- return _highlightTab;
+ return this->highlightTab;
}
const QString &Message::getTimeoutUser() const
{
- return _timeoutUser;
+ return this->timeoutUser;
}
int Message::getTimeoutCount() const
{
- return _timeoutCount;
+ return this->timeoutCount;
}
const QString &Message::getUserName() const
{
- return _userName;
+ return this->userName;
}
const QString &Message::getDisplayName() const
{
- return _displayName;
+ return this->displayName;
}
const QString &Message::getContent() const
{
- return _content;
+ return this->content;
}
const std::chrono::time_point &Message::getParseTime() const
{
- return _parseTime;
+ return this->parseTime;
}
std::vector &Message::getWords()
{
- return _words;
+ return this->words;
}
bool Message::isDisabled() const
{
- return _isDisabled;
+ return this->disabled;
}
const QString &Message::getId() const
{
- return _id;
+ return this->id;
}
} // namespace messages
diff --git a/src/messages/message.hpp b/src/messages/message.hpp
index 1ca097861..533bc8c82 100644
--- a/src/messages/message.hpp
+++ b/src/messages/message.hpp
@@ -37,7 +37,7 @@ public:
bool isDisabled() const;
const QString &getId() const;
- const QString _text;
+ const QString text;
private:
static LazyLoadedImage *badgeStaff;
@@ -50,18 +50,18 @@ private:
static QRegularExpression *cheerRegex;
- bool _highlightTab = false;
- QString _timeoutUser = "";
- int _timeoutCount = 0;
- bool _isDisabled = false;
- std::chrono::time_point _parseTime;
+ bool highlightTab = false;
+ QString timeoutUser = "";
+ int timeoutCount = 0;
+ bool disabled = false;
+ std::chrono::time_point parseTime;
- QString _userName = "";
- QString _displayName = "";
- QString _content;
- QString _id = "";
+ QString userName = "";
+ QString displayName = "";
+ QString content;
+ QString id = "";
- std::vector _words;
+ std::vector words;
};
} // namespace messages
diff --git a/src/messages/word.hpp b/src/messages/word.hpp
index a17464a35..3146b12b0 100644
--- a/src/messages/word.hpp
+++ b/src/messages/word.hpp
@@ -44,17 +44,18 @@ public:
BadgePremium = (1 << 20),
BadgeChatterino = (1 << 21),
BadgeCheer = (1 << 22),
+ BadgeVerified = (1 << 23),
Badges = BadgeStaff | BadgeAdmin | BadgeGlobalMod | BadgeModerator | BadgeTurbo |
- BadgeBroadcaster | BadgePremium | BadgeChatterino | BadgeCheer,
+ BadgeBroadcaster | BadgePremium | BadgeChatterino | BadgeCheer | BadgeVerified,
- Username = (1 << 23),
- BitsAmount = (1 << 24),
+ Username = (1 << 24),
+ BitsAmount = (1 << 25),
- ButtonBan = (1 << 25),
- ButtonTimeout = (1 << 26),
+ ButtonBan = (1 << 26),
+ ButtonTimeout = (1 << 27),
- EmojiImage = (1 << 27),
- EmojiText = (1 << 28),
+ EmojiImage = (1 << 28),
+ EmojiText = (1 << 29),
Default = TimestampNoSeconds | Badges | Username | BitsStatic | FfzEmoteImage |
BttvEmoteImage | BttvGifEmoteImage | TwitchEmoteImage | BitsAmount | Text |
diff --git a/src/resources.cpp b/src/resources.cpp
index 4c87917f3..be3c6d088 100644
--- a/src/resources.cpp
+++ b/src/resources.cpp
@@ -25,6 +25,7 @@ Resources::Resources(EmoteManager &emoteManager, WindowManager &windowManager)
, badgeTurbo(lli(emoteManager, windowManager, ":/images/turbo_bg.png"))
, badgeBroadcaster(lli(emoteManager, windowManager, ":/images/broadcaster_bg.png"))
, badgePremium(lli(emoteManager, windowManager, ":/images/twitchprime_bg.png"))
+ , badgeVerified(lli(emoteManager, windowManager, ":/images/verified.png"))
, cheerBadge100000(lli(emoteManager, windowManager, ":/images/cheer100000"))
, cheerBadge10000(lli(emoteManager, windowManager, ":/images/cheer10000"))
, cheerBadge5000(lli(emoteManager, windowManager, ":/images/cheer5000"))
diff --git a/src/resources.hpp b/src/resources.hpp
index 06f93c66a..8f34bb6e7 100644
--- a/src/resources.hpp
+++ b/src/resources.hpp
@@ -19,6 +19,7 @@ public:
messages::LazyLoadedImage *badgeTurbo;
messages::LazyLoadedImage *badgeBroadcaster;
messages::LazyLoadedImage *badgePremium;
+ messages::LazyLoadedImage *badgeVerified;
messages::LazyLoadedImage *cheerBadge100000;
messages::LazyLoadedImage *cheerBadge10000;
diff --git a/src/twitch/twitchmessagebuilder.cpp b/src/twitch/twitchmessagebuilder.cpp
index 96ac5a1bb..f024ed6a0 100644
--- a/src/twitch/twitchmessagebuilder.cpp
+++ b/src/twitch/twitchmessagebuilder.cpp
@@ -335,6 +335,10 @@ void TwitchMessageBuilder::appendTwitchBadges(const QStringList &badges, const R
EmoteManager &emoteManager)
{
for (QString badge : badges) {
+ if (badge.isEmpty()) {
+ continue;
+ }
+
if (badge.startsWith("bits/")) {
long long int cheer = std::strtoll(badge.mid(5).toStdString().c_str(), nullptr, 10);
appendWord(Word(emoteManager.getCheerBadge(cheer), Word::BadgeCheer, QString(),
@@ -349,8 +353,8 @@ void TwitchMessageBuilder::appendTwitchBadges(const QStringList &badges, const R
appendWord(Word(resources.badgeGlobalModerator, Word::BadgeGlobalMod, QString(),
QString("Global Moderator")));
} else if (badge == "moderator/1") {
- // TODO: implement this xD
- appendWord(Word(resources.badgeTurbo, Word::BadgeModerator, QString(),
+ // TODO: Implement custom FFZ moderator badge
+ appendWord(Word(resources.badgeModerator, Word::BadgeModerator, QString(),
QString("Channel Moderator"))); // custom badge
} else if (badge == "turbo/1") {
appendWord(Word(resources.badgeStaff, Word::BadgeTurbo, QString(),
@@ -361,6 +365,28 @@ void TwitchMessageBuilder::appendTwitchBadges(const QStringList &badges, const R
} else if (badge == "premium/1") {
appendWord(Word(resources.badgePremium, Word::BadgePremium, QString(),
QString("Twitch Prime")));
+
+ } else if (badge.startsWith("partner/")) {
+ int index = badge.midRef(8).toInt();
+ switch (index) {
+ case 1: {
+ appendWord(Word(resources.badgeVerified, Word::BadgeVerified, QString(),
+ "Twitch Verified"));
+ } break;
+ default: {
+ printf("[TwitchMessageBuilder] Unhandled partner badge index: %d\n", index);
+ } break;
+ }
+ } else if (badge.startsWith("subscriber/")) {
+ int index = badge.midRef(11).toInt();
+ // TODO: Implement subscriber badges here
+ switch (index) {
+ default: {
+ // printf("[TwitchMessageBuilder] Unhandled subscriber badge index: %d\n", index);
+ } break;
+ }
+ } else {
+ printf("[TwitchMessageBuilder] Unhandled badge: %s\n", qPrintable(badge));
}
}
}