Index: shell/src/MatchesCommand.cpp |
=================================================================== |
--- a/shell/src/MatchesCommand.cpp |
+++ b/shell/src/MatchesCommand.cpp |
@@ -10,29 +10,34 @@ MatchesCommand::MatchesCommand(AdblockPl |
void MatchesCommand::operator()(const std::string& arguments) |
{ |
std::istringstream argumentStream(arguments); |
std::string url; |
argumentStream >> url; |
std::string contentType; |
argumentStream >> contentType; |
- if (!url.size() || !contentType.size()) |
+ std::string documentUrl; |
+ argumentStream >> documentUrl; |
+ if (!url.size() || !contentType.size() || !documentUrl.size()) |
{ |
ShowUsage(); |
return; |
} |
- if (filterEngine.Matches(url, contentType)) |
- std::cout << "Match" << std::endl; |
+ AdblockPlus::Filter* match = filterEngine.Matches(url, contentType, documentUrl); |
+ if (!match) |
+ std::cout << "No match" << std::endl; |
+ else if (match->GetProperty("type", "") == "exception") |
+ std::cout << "Whitelisted" << std::endl; |
else |
- std::cout << "No match" << std::endl; |
+ std::cout << "Blocked" << std::endl; |
} |
std::string MatchesCommand::GetDescription() const |
{ |
return "Returns the first filter that matches the supplied URL"; |
} |
std::string MatchesCommand::GetUsage() const |
{ |
- return name + " URL CONTENT_TYPE"; |
+ return name + " URL CONTENT_TYPE DOCUMENT_URL"; |
} |