Index: messageResponder.js |
=================================================================== |
--- a/messageResponder.js |
+++ b/messageResponder.js |
@@ -24,7 +24,6 @@ |
var FilterStorage = require("filterStorage").FilterStorage; |
var FilterNotifier = require("filterNotifier").FilterNotifier; |
var defaultMatcher = require("matcher").defaultMatcher; |
- var BlockingFilter = require("filterClasses").BlockingFilter; |
var Synchronizer = require("synchronizer").Synchronizer; |
var subscriptionClasses = require("subscriptionClasses"); |
@@ -32,6 +31,10 @@ |
var DownloadableSubscription = subscriptionClasses.DownloadableSubscription; |
var SpecialSubscription = subscriptionClasses.SpecialSubscription; |
+ var filterClasses = require("filterClasses"); |
+ var Filter = filterClasses.Filter; |
+ var BlockingFilter = filterClasses.BlockingFilter; |
+ |
var subscriptionKeys = ["disabled", "homepage", "lastSuccess", "title", "url", "downloadStatus"]; |
function convertSubscription(subscription) |
{ |
@@ -142,6 +145,12 @@ |
var filter = defaultMatcher.matchesAny(message.url, message.requestType, message.docDomain, message.thirdParty); |
callback(filter instanceof BlockingFilter); |
break; |
+ case "filters.add": |
+ FilterStorage.addFilter(Filter.fromText(message.filter)); |
+ break; |
+ case "filters.remove": |
+ FilterStorage.removeFilter(Filter.fromText(message.filter)); |
+ break; |
case "subscriptions.toggle": |
var subscription = Subscription.fromURL(message.url); |
if (subscription.url in FilterStorage.knownSubscriptions && !subscription.disabled) |