Added in:<channels> search predicate (#2634)

Co-authored-by: pajlada <rasmus.karlsson@pajlada.com>
This commit is contained in:
Tal Neoran
2021-04-17 14:18:22 +03:00
committed by GitHub
parent b540bd0b69
commit cceadf473a
6 changed files with 77 additions and 2 deletions
+23
View File
@@ -0,0 +1,23 @@
#include "messages/search/ChannelPredicate.hpp"
namespace chatterino {
ChannelPredicate::ChannelPredicate(const QStringList &channels)
: channels_()
{
// Check if any comma-seperated values were passed and transform those
for (const auto &entry : channels)
{
for (const auto &channel : entry.split(',', QString::SkipEmptyParts))
{
this->channels_ << channel;
}
}
}
bool ChannelPredicate::appliesTo(const Message &message)
{
return channels_.contains(message.channelName, Qt::CaseInsensitive);
}
} // namespace chatterino