summaryrefslogtreecommitdiff
path: root/src/adblock/adblockhostmatcher.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/adblock/adblockhostmatcher.cpp')
-rw-r--r--src/adblock/adblockhostmatcher.cpp37
1 files changed, 35 insertions, 2 deletions
diff --git a/src/adblock/adblockhostmatcher.cpp b/src/adblock/adblockhostmatcher.cpp
index 021fe12d..5033c6f7 100644
--- a/src/adblock/adblockhostmatcher.cpp
+++ b/src/adblock/adblockhostmatcher.cpp
@@ -29,11 +29,11 @@
// Rekonq Includes
#include "rekonq_defines.h"
+
bool AdBlockHostMatcher::tryAddFilter(const QString &filter)
{
if (filter.startsWith(QL1S("||")))
{
-
QString domain = filter.mid(2);
if (!domain.endsWith(QL1C('^')))
@@ -49,8 +49,41 @@ bool AdBlockHostMatcher::tryAddFilter(const QString &filter)
domain = domain.toLower();
m_hostList.insert(domain);
- m_hostList.insert(QL1S("www.") + domain);
return true;
}
+
+ if (filter.startsWith(QL1S("@@")))
+ {
+ QString domain = filter.mid(2);
+
+ if (domain.contains(QL1C('^')))
+ return false;
+
+ if (domain.contains(QL1C('$')))
+ return false;
+
+ if (domain.contains(QL1C('*')))
+ return false;
+
+ if (domain.contains(QL1C('|')))
+ return false;
+
+ if (domain.contains(QL1C('/')))
+ {
+ if (!domain.endsWith(QL1C('/')))
+ return false;
+ }
+ domain = domain.toLower();
+ m_hostList.insert(domain);
+ return true;
+ }
+
return false;
}
+
+
+void AdBlockHostMatcher::remove(const QString &hostRule)
+{
+ bool on = m_hostList.remove(hostRule);
+ kDebug() << "REMOVED? " << on;
+}