1 #pragma once
2 
3 #include "messages/search/MessagePredicate.hpp"
4 
5 namespace chatterino {
6 
7 /**
8  * @brief MessagePredicate checking for the channel a message was sent in.
9  *
10  * This predicate will only allow messages that are sent in a list of channels,
11  * specified by their names.
12  */
13 class ChannelPredicate : public MessagePredicate
14 {
15 public:
16     /**
17      * @brief Create a ChannelPredicate with a list of channels to search for.
18      *
19      * @param channels a list of channel names that a message should be sent in
20      */
21     ChannelPredicate(const QStringList &channels);
22 
23     /**
24      * @brief Checks whether the message was sent in any of the channels passed
25      *        in the constructor.
26      *
27      * @param message the message to check
28      * @return true if the message was sent in one of the specified channels,
29      *         false otherwise
30      */
31     bool appliesTo(const Message &message);
32 
33 private:
34     /// Holds the channel names that will be searched for
35     QStringList channels_;
36 };
37 
38 }  // namespace chatterino
39