mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
* refactor: remove unnecessary includes in headers * fix: formatting * chore: changelog * fix: scrollbar * fix: suggestions and old appbase remains * fix: suggestion * fix: missing Qt forward declarations * fix: another qt include * fix: includes for precompiled-headers=off * Add missing `<memory>` includes * Add missing `#pragma once` * Fix tests Co-authored-by: Rasmus Karlsson <rasmus.karlsson@pajlada.com>
43 lines
1.2 KiB
C++
43 lines
1.2 KiB
C++
#pragma once
|
|
|
|
#include "messages/search/MessagePredicate.hpp"
|
|
|
|
#include <QString>
|
|
#include <QStringList>
|
|
|
|
namespace chatterino {
|
|
|
|
/**
|
|
* @brief MessagePredicate checking for the author/sender of a message.
|
|
*
|
|
* This predicate will only allow messages that are sent by a list of users,
|
|
* specified by their user names.
|
|
*/
|
|
class AuthorPredicate : public MessagePredicate
|
|
{
|
|
public:
|
|
/**
|
|
* @brief Create an AuthorPredicate with a list of users to search for.
|
|
*
|
|
* @param authors one or more comma-separated user names that a message should be sent from
|
|
* @param negate when set, excludes list of user names from results
|
|
*/
|
|
AuthorPredicate(const QString &authors, bool negate);
|
|
|
|
protected:
|
|
/**
|
|
* @brief Checks whether the message is authored by any of the users passed
|
|
* in the constructor.
|
|
*
|
|
* @param message the message to check
|
|
* @return true if the message was authored by one of the specified users,
|
|
* false otherwise
|
|
*/
|
|
bool appliesToImpl(const Message &message) override;
|
|
|
|
private:
|
|
/// Holds the user names that will be searched for
|
|
QStringList authors_;
|
|
};
|
|
|
|
} // namespace chatterino
|