refactor: rename Badge to TwitchBadge (#6706)

this change is made to clarify that the previously-called Badge object
is actually specialized for Twitch badges
This commit is contained in:
pajlada
2026-01-04 12:52:02 +01:00
committed by GitHub
parent 7fed720d18
commit 18e3d7c72b
190 changed files with 1058 additions and 1049 deletions
+2 -2
View File
@@ -12,7 +12,7 @@ const QSet<QString> channelAuthority{"lead_moderator", "moderator", "vip",
"broadcaster"};
const QSet<QString> subBadges{"subscriber", "founder"};
Badge::Badge(QString key, QString value)
TwitchBadge::TwitchBadge(QString key, QString value)
: key_(std::move(key))
, value_(std::move(value))
{
@@ -34,7 +34,7 @@ Badge::Badge(QString key, QString value)
}
}
bool Badge::operator==(const Badge &other) const
bool TwitchBadge::operator==(const TwitchBadge &other) const
{
return this->key_ == other.key_ && this->value_ == other.value_;
}
+3 -3
View File
@@ -6,12 +6,12 @@
namespace chatterino {
class Badge
class TwitchBadge
{
public:
Badge(QString key, QString value);
TwitchBadge(QString key, QString value);
bool operator==(const Badge &other) const;
bool operator==(const TwitchBadge &other) const;
// Class members are fetched from both "badges" and "badge-info" tags
// E.g.: "badges": "subscriber/18", "badge-info": "subscriber/22"
+4 -4
View File
@@ -106,10 +106,10 @@ std::unordered_map<QString, QString> parseBadgeInfoTag(const QVariantMap &tags)
return infoMap;
}
std::vector<Badge> parseBadgeTag(const QVariantMap &tags,
const QString &tagName)
std::vector<TwitchBadge> parseBadgeTag(const QVariantMap &tags,
const QString &tagName)
{
std::vector<Badge> b;
std::vector<TwitchBadge> b;
auto badgesIt = tags.constFind(tagName);
if (badgesIt == tags.end())
@@ -127,7 +127,7 @@ std::vector<Badge> parseBadgeTag(const QVariantMap &tags,
}
auto pair = slashKeyValue(badge);
b.emplace_back(Badge{pair.first, pair.second});
b.emplace_back(TwitchBadge{pair.first, pair.second});
}
return b;
+2 -2
View File
@@ -47,8 +47,8 @@ std::unordered_map<QString, QString> parseBadgeInfoTag(const QVariantMap &tags);
/// @param tags The tags of the IRC message
/// @param tagName The name of the tag to read badges from
/// @returns A list of badges (name and version)
std::vector<Badge> parseBadgeTag(const QVariantMap &tags,
const QString &tagName = "badges");
std::vector<TwitchBadge> parseBadgeTag(const QVariantMap &tags,
const QString &tagName = "badges");
/// @brief Parses Twitch emotes in an IRC message
///