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
+38
View File
@@ -0,0 +1,38 @@
#pragma once
#include "messages/search/MessagePredicate.hpp"
namespace chatterino {
/**
* @brief MessagePredicate checking for the channel a message was sent in.
*
* This predicate will only allow messages that are sent in a list of channels,
* specified by their names.
*/
class ChannelPredicate : public MessagePredicate
{
public:
/**
* @brief Create a ChannelPredicate with a list of channels to search for.
*
* @param channels a list of channel names that a message should be sent in
*/
ChannelPredicate(const QStringList &channels);
/**
* @brief Checks whether the message was sent in any of the channels passed
* in the constructor.
*
* @param message the message to check
* @return true if the message was sent in one of the specified channels,
* false otherwise
*/
bool appliesTo(const Message &message);
private:
/// Holds the channel names that will be searched for
QStringList channels_;
};
} // namespace chatterino