summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManish Sinha <manishsinha@ubuntu.com>2011-04-28 23:03:40 +0530
committerManish Sinha <manishsinha@ubuntu.com>2011-04-28 23:03:40 +0530
commite8a2fa0aee5838b3f54b9fccf073870641c2e37b (patch)
tree78f4371e134df24bb07c6e95fe3ade2661b61e89
parentb2362d595effe20cd023eaf5f63df71a998c7dc8 (diff)
Updated the blacklist API
-rw-r--r--Zeitgeist.Testsuite/Blacklist/TestInsertEventsWithBlacklist.cs18
-rw-r--r--Zeitgeist/BlacklistClient.cs10
2 files changed, 16 insertions, 12 deletions
diff --git a/Zeitgeist.Testsuite/Blacklist/TestInsertEventsWithBlacklist.cs b/Zeitgeist.Testsuite/Blacklist/TestInsertEventsWithBlacklist.cs
index c88b8c8..9495524 100644
--- a/Zeitgeist.Testsuite/Blacklist/TestInsertEventsWithBlacklist.cs
+++ b/Zeitgeist.Testsuite/Blacklist/TestInsertEventsWithBlacklist.cs
@@ -39,6 +39,15 @@ namespace Zeitgeist.Testsuite
{
LogClient client = new LogClient();
BlacklistClient bClient = new BlacklistClient();
+ // Handle the Template Added event
+ bClient.TemplateAdded += delegate(string blacklistId, Event addedTemplate) {
+ Console.Out.WriteLine("Blacklist added for: ", blacklistId);
+ };
+ // Handle the Template Removed event
+ bClient.TemplateRemoved += delegate(string blacklistId, Event removedTemplate) {
+ Console.Out.WriteLine("Blacklist removed for: ", blacklistId);
+ };
+
string fooBlacklistId = "block-foo";
// Create the first event
@@ -72,14 +81,7 @@ namespace Zeitgeist.Testsuite
// If inserted, clean the database by deleting random events
client.DeleteEvents(res);
- // Handle the Template Added event
- bClient.TemplateAdded += delegate(string blacklistId, Event addedTemplate) {
- Console.Out.WriteLine("Blacklist added for: ", blacklistId);
- };
- // Handle the Template Removed event
- bClient.TemplateRemoved += delegate(string blacklistId, Event removedTemplate) {
- Console.Out.WriteLine("Blacklist removed for: ", blacklistId);
- };
+
// Add the blacklist template
bClient.AddTemplate(fooBlacklistId, evTemplate);
diff --git a/Zeitgeist/BlacklistClient.cs b/Zeitgeist/BlacklistClient.cs
index 6019748..4aaf8ae 100644
--- a/Zeitgeist/BlacklistClient.cs
+++ b/Zeitgeist/BlacklistClient.cs
@@ -50,14 +50,16 @@ namespace Zeitgeist
// Connect the Template Added event
srcInterface.TemplateAdded += delegate(string blacklistId, RawEvent addedTemplate) {
- if(TemplateAdded != null)
- TemplateAdded(blacklistId, RawEvent.FromRaw(addedTemplate));
+ Console.Out.WriteLine("Blacklist added for: "+blacklistId);
+ if(this.TemplateAdded != null)
+ this.TemplateAdded(blacklistId, RawEvent.FromRaw(addedTemplate));
};
// Connect the Template Removed event
srcInterface.TemplateRemoved += delegate(string blacklistId, RawEvent removedTemplate) {
- if(TemplateRemoved != null)
- TemplateRemoved(blacklistId, RawEvent.FromRaw(removedTemplate));
+ Console.Out.WriteLine("Blacklist removed for: "+blacklistId);
+ if(this.TemplateRemoved != null)
+ this.TemplateRemoved(blacklistId, RawEvent.FromRaw(removedTemplate));
};
}