aboutsummaryrefslogtreecommitdiff
path: root/lib/urlfilter/filterleaf.h
diff options
context:
space:
mode:
authorAqua-sama <aqua@iserlohn-fortress.net>2018-10-18 23:39:28 +0200
committerAqua-sama <aqua@iserlohn-fortress.net>2018-10-19 00:30:13 +0200
commit5f623dcfc8f02504d745f47f8b9274b2bca5fd67 (patch)
treef7d6719f6c48c6c038e41631727ccc2ea3368461 /lib/urlfilter/filterleaf.h
parenturlfilter: add Domain class (diff)
downloadsmolbote-5f623dcfc8f02504d745f47f8b9274b2bca5fd67.tar.xz
urlfilter: destroy FilterLeaves only when destroying the FilterTree
Add QMutex lock when adding rules clang-format pass
Diffstat (limited to 'lib/urlfilter/filterleaf.h')
-rw-r--r--lib/urlfilter/filterleaf.h23
1 files changed, 20 insertions, 3 deletions
diff --git a/lib/urlfilter/filterleaf.h b/lib/urlfilter/filterleaf.h
index 6d9caae..36c00e9 100644
--- a/lib/urlfilter/filterleaf.h
+++ b/lib/urlfilter/filterleaf.h
@@ -9,8 +9,10 @@
#ifndef SMOLBOTE_FILTERLEAF_H
#define SMOLBOTE_FILTERLEAF_H
+#include <QHash>
#include <QObject>
#include <QString>
+#include <QWebEngineUrlRequestInfo>
class FilterLeaf
{
@@ -23,7 +25,7 @@ public:
};
FilterLeaf(FilterLeaf &&other);
- FilterLeaf& operator=(FilterLeaf &&other);
+ FilterLeaf &operator=(FilterLeaf &&other);
~FilterLeaf() = default;
virtual bool match(const QString &requestUrl) const = 0;
@@ -33,11 +35,26 @@ public:
const QString redirect() const;
protected:
+ enum UrlMatchType {
+ InvalidMatch,
+ RegularExpressionMatch,
+ StringContains,
+ StringStartsWith,
+ StringEndsWith,
+ StringEquals,
+ DomainMatch
+ };
+
explicit FilterLeaf() = default;
+ // rule matching
+ UrlMatchType matchType = InvalidMatch;
+ QHash<QWebEngineUrlRequestInfo::ResourceType, bool> resourceTypeOptions;
+ QString m_request;
+
+ // rule action
bool m_isBlocking;
- std::string m_request;
- std::string m_redirect;
+ QString m_redirect;
};
#endif // SMOLBOTE_FILTERLEAF_H