aboutsummaryrefslogtreecommitdiff
path: root/src/webengine/urlinterceptor.cpp
diff options
context:
space:
mode:
authorAqua-sama <aqua@iserlohn-fortress.net>2017-03-22 22:59:07 +0100
committerAqua-sama <aqua@iserlohn-fortress.net>2017-03-22 22:59:07 +0100
commit0772cf8b98387b2b641ae29aeb1b459eef22d794 (patch)
tree9ee8048e85e1fc8a11a6e88b6d8829d5784d6a4c /src/webengine/urlinterceptor.cpp
parentProfile saving and loading (diff)
downloadsmolbote-0772cf8b98387b2b641ae29aeb1b459eef22d794.tar.xz
Blocker fixes
Diffstat (limited to 'src/webengine/urlinterceptor.cpp')
-rw-r--r--src/webengine/urlinterceptor.cpp20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/webengine/urlinterceptor.cpp b/src/webengine/urlinterceptor.cpp
index 3c6a56e..94bfffa 100644
--- a/src/webengine/urlinterceptor.cpp
+++ b/src/webengine/urlinterceptor.cpp
@@ -19,6 +19,7 @@
******************************************************************************/
#include "urlinterceptor.h"
+#include "blocker/blockersubscription.h"
UrlRequestInterceptor::UrlRequestInterceptor(QObject *parent) :
QWebEngineUrlRequestInterceptor(parent)
@@ -27,10 +28,23 @@ UrlRequestInterceptor::UrlRequestInterceptor(QObject *parent) :
void UrlRequestInterceptor::interceptRequest(QWebEngineUrlRequestInfo &info)
{
- //
+#ifdef DEBUG_VERBOSE
+ qDebug("%s", qUtf8Printable(info.requestUrl().toString()));
+#endif
+
+ for(BlockerSubscription *s : m_manager->subscriptions()) {
+ BlockerSubscription::MatchResult r = s->match(info);
+ if(r.match) {
+ info.block(r.block);
+#ifdef DEBUG_VERBOSE
+ qDebug("+--> matched [%s] [%s]", r.block ? "blocked" : "allowed", qUtf8Printable(r.pattern));
+#endif
+ return;
+ }
+ }
}
-void UrlRequestInterceptor::setSubscription(BlockerManager *subscription)
+void UrlRequestInterceptor::setSubscription(BlockerManager *manager)
{
- m_blocker = subscription;
+ m_manager = manager;
}