diff options
Diffstat (limited to 'lib/urlfilter/filtertree.cpp')
-rw-r--r-- | lib/urlfilter/filtertree.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/urlfilter/filtertree.cpp b/lib/urlfilter/filtertree.cpp index 8844a76..8d88140 100644 --- a/lib/urlfilter/filtertree.cpp +++ b/lib/urlfilter/filtertree.cpp @@ -45,7 +45,7 @@ const QStringList FilterTree::branches() const { QStringList branches; for(auto &branch : m_branches) { - branches.append(QString::fromStdString(branch.domain)); + branches.append(branch.domain.host()); } return branches; } @@ -54,7 +54,7 @@ QVector<const FilterLeaf *> FilterTree::match(const QString& domain, const QStri { QVector<const FilterLeaf *> leaves; for(const auto &branch : m_branches) { - if(branch.domain == domain.toStdString()) { + if(branch.domain.matches(QUrl(domain))) { for(const auto leaf : branch.leaves) { if(leaf->match(requestUrl)) { @@ -70,15 +70,15 @@ QVector<const FilterLeaf *> FilterTree::match(const QString& domain, const QStri bool FilterTree::addRule(FilterLeaf *rule, const QString& domain) { for(auto &branch : m_branches) { - if(branch.domain == domain.toStdString()) { + if(branch.domain.matches(QUrl(domain))) { branch.leaves.emplace_back(rule); return true; } } // no branch was found - Branch branch; - branch.domain = domain.toStdString(); + Branch branch(domain); + //branch.domain = domain.toStdString(); // TODO: for some reason, can't add rule here //branch.leaves.emplace_back(rule); m_branches.emplace_back(std::move(branch)); |