diff options
author | Aqua-sama <aqua@iserlohn-fortress.net> | 2020-04-18 15:06:35 +0300 |
---|---|---|
committer | Aqua-sama <aqua@iserlohn-fortress.net> | 2020-04-21 20:14:57 +0300 |
commit | a35b365504c51d4c8e605e5586438deb93ad6d63 (patch) | |
tree | 21db39c787afc0bc70c0325a6c519cabb9761611 /staging/hostlist/filterlist.hpp | |
parent | smolblok: rewrite filtermanager (diff) | |
download | smolbote-a35b365504c51d4c8e605e5586438deb93ad6d63.tar.xz |
Add staging/hostlist
Diffstat (limited to 'staging/hostlist/filterlist.hpp')
-rw-r--r-- | staging/hostlist/filterlist.hpp | 43 |
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 |