summaryrefslogtreecommitdiff
path: root/MessageFilter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'MessageFilter.cpp')
-rw-r--r--MessageFilter.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/MessageFilter.cpp b/MessageFilter.cpp
new file mode 100644
index 00000000..2ed260a7
--- /dev/null
+++ b/MessageFilter.cpp
@@ -0,0 +1,21 @@
+#include "MessageFilter.hpp"
+
+bool MessageFilter::containsAny(const QString& text, const QStringList& keywords)
+{
+ for (const QString& keyword : keywords) {
+ if (!keyword.isEmpty() && text.contains(keyword)) {
+ return true;
+ }
+ }
+ return false;
+}
+
+bool MessageFilter::startsWithAny(const QString& text, const QStringList& keywords)
+{
+ for (const QString& keyword : keywords) {
+ if (!keyword.isEmpty() && text.startsWith(keyword)) {
+ return true;
+ }
+ }
+ return false;
+}