aboutsummaryrefslogtreecommitdiff
path: root/src/webengine
diff options
context:
space:
mode:
authorAqua-sama <aqua@iserlohn-fortress.net>2018-10-25 17:36:26 +0200
committerAqua-sama <aqua@iserlohn-fortress.net>2018-10-25 17:36:26 +0200
commit689a94481d8b6a44119093b65814e0c0f3ad98b5 (patch)
treec967a0d8ae65b3a44fdeb2a859689abb5ab625d2 /src/webengine
parentAdd test/ meson.build (diff)
downloadsmolbote-689a94481d8b6a44119093b65814e0c0f3ad98b5.tar.xz
Fix various build warnings
Diffstat (limited to 'src/webengine')
-rw-r--r--src/webengine/filter.cpp27
1 files changed, 19 insertions, 8 deletions
diff --git a/src/webengine/filter.cpp b/src/webengine/filter.cpp
index 9db61cb..216c84c 100644
--- a/src/webengine/filter.cpp
+++ b/src/webengine/filter.cpp
@@ -7,13 +7,13 @@
*/
#include "filter.h"
+#include "configuration.h"
#include "urlinterceptor.h"
+#include "util.h"
#include <QDir>
#include <QJsonArray>
#include <QJsonDocument>
#include <QTextStream>
-#include "configuration.h"
-#include "util.h"
/*
inline std::vector<FilterRule> parseAdBlockList(const QString &filename)
@@ -36,7 +36,7 @@ inline std::vector<FilterRule> parseAdBlockList(const QString &filename)
return rules;
}*/
-Filter::Filter::Filter(const std::unique_ptr<Configuration> &config, QObject* parent)
+Filter::Filter::Filter(const std::unique_ptr<Configuration> &config, QObject *parent)
: QObject(parent)
{
// parse headers
@@ -68,15 +68,26 @@ Filter::Filter::Filter(const std::unique_ptr<Configuration> &config, QObject* pa
*/
}
-void Filter::filterRequest(QWebEngineUrlRequestInfo& info) const
+void Filter::filterRequest(QWebEngineUrlRequestInfo &info) const
{
auto matches = filters.match(info.firstPartyUrl().toString(), info.requestUrl().toString());
for(const auto &rule : matches) {
switch(rule->action()) {
- case FilterLeaf::Block:
- qDebug("block %s", qUtf8Printable(info.requestUrl().toString()));
- info.block(true);
- break;
+ case FilterLeaf::NotMatched:
+#ifdef QT_DEBUG
+ qDebug("Paradoxical match: request matched, but not matched.");
+ qDebug(" - %s", qUtf8Printable(info.requestUrl().toString()));
+#endif
+ break;
+ case FilterLeaf::Block:
+ //qDebug("block %s", qUtf8Printable(info.requestUrl().toString()));
+ info.block(true);
+ break;
+ case FilterLeaf::Allow:
+ info.block(false);
+ break;
+ //case FilterLeaf::Redirect:
+ // break;
}
}
}