aboutsummaryrefslogtreecommitdiff
path: root/staging/hostlist/filterlist.hpp
diff options
context:
space:
mode:
authorAqua-sama <aqua@iserlohn-fortress.net>2020-04-18 15:06:35 +0300
committerAqua-sama <aqua@iserlohn-fortress.net>2020-04-21 20:14:57 +0300
commita35b365504c51d4c8e605e5586438deb93ad6d63 (patch)
tree21db39c787afc0bc70c0325a6c519cabb9761611 /staging/hostlist/filterlist.hpp
parentsmolblok: rewrite filtermanager (diff)
downloadsmolbote-a35b365504c51d4c8e605e5586438deb93ad6d63.tar.xz
Add staging/hostlist
Diffstat (limited to 'staging/hostlist/filterlist.hpp')
-rw-r--r--staging/hostlist/filterlist.hpp43
1 files changed, 43 insertions, 0 deletions
diff --git a/staging/hostlist/filterlist.hpp b/staging/hostlist/filterlist.hpp
new file mode 100644
index 0000000..24243e5
--- /dev/null
+++ b/staging/hostlist/filterlist.hpp
@@ -0,0 +1,43 @@
+/*
+ * This file is part of smolbote. It's copyrighted by the contributors recorded
+ * in the version control history of the file, available from its original
+ * location: https://library.iserlohn-fortress.net/aqua/smolbote.git
+ *
+ * SPDX-License-Identifier: GPL-3.0
+ */
+
+#pragma once
+
+#include <map>
+#include <smolbote/filterinterface.hpp>
+
+namespace Hostlist
+{
+
+class Filterlist final : public Filter
+{
+public:
+ Filterlist() = default;
+ ~Filterlist() = default;
+
+ [[nodiscard]] bool filter(QWebEngineUrlRequestInfo &info) const
+ {
+ return false;
+ }
+ [[nodiscard]] bool isUpToDate() const
+ {
+ return true;
+ }
+
+ typedef uint DomainHash;
+ struct Rule {
+ QString domain;
+ QString redirect;
+ };
+
+ [[nodiscard]] static std::map<DomainHash, Rule> parseRule(const QString &line);
+
+private:
+ std::map<DomainHash, Rule> rules;
+};
+} // namespace Hostlist