Corrected the way we parse comma-separated "list tags" in PRIVMSGs (#3771)

tl;dr: we now split by slash only its first occurrence instead of every occurrence.
This commit is contained in:
Kasia
2022-05-28 11:55:48 +02:00
committed by GitHub
parent 6ef3ecc952
commit 7d0023cf73
10 changed files with 228 additions and 102 deletions
+6 -14
View File
@@ -1,5 +1,6 @@
#include "HighlightBadge.hpp"
#include "messages/SharedMessageBuilder.hpp"
#include "singletons/Resources.hpp"
namespace chatterino {
@@ -86,21 +87,12 @@ bool HighlightBadge::compare(const QString &id, const Badge &badge) const
{
if (this->hasVersions_)
{
auto parts = id.split("/");
if (parts.size() == 2)
{
return parts.at(0).compare(badge.key_, Qt::CaseInsensitive) == 0 &&
parts.at(1).compare(badge.value_, Qt::CaseInsensitive) == 0;
}
else
{
return parts.at(0).compare(badge.key_, Qt::CaseInsensitive) == 0;
}
}
else
{
return id.compare(badge.key_, Qt::CaseInsensitive) == 0;
auto parts = SharedMessageBuilder::slashKeyValue(id);
return parts.first.compare(badge.key_, Qt::CaseInsensitive) == 0 &&
parts.second.compare(badge.value_, Qt::CaseInsensitive) == 0;
}
return id.compare(badge.key_, Qt::CaseInsensitive) == 0;
}
bool HighlightBadge::hasCustomSound() const