Skip to content

Commit

Permalink
reload rules whenever user defaults has changed
Browse files Browse the repository at this point in the history
  • Loading branch information
dustinrue committed Sep 7, 2014
1 parent e4f7806 commit 698ff67
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions Source/ShellScriptEvidenceSource.m
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@ - (void)start {
// rules can be configured immediately
[self setDataCollected:true];
running = YES;

[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(getRuleList)
name:NSUserDefaultsDidChangeNotification
object:nil];
}

- (void)stop {
Expand All @@ -81,6 +86,8 @@ - (void)stop {

[self setDataCollected: NO];
running = NO;

[[NSNotificationCenter defaultCenter] removeObserver:self name:NSUserDefaultsDidChangeNotification object:nil];
}

- (void)stopAllTasks {
Expand Down Expand Up @@ -268,11 +275,6 @@ - (NSString *)name {
}

- (BOOL)doesRuleMatch:(NSDictionary *)rule {
[self getRuleList];
DSLog(@"timers: %@", taskTimers);
[taskTimers enumerateKeysAndObjectsUsingBlock:^(id key, NSTimer * obj, BOOL *stop) {
DSLog(@"timer info: %f", [obj timeInterval]);
}];
return [[scriptResults valueForKey:[rule valueForKey:@"parameter"]] boolValue];
}

Expand Down Expand Up @@ -335,8 +337,6 @@ - (IBAction) browseForScript:(id) sendor {
// If this evidence source is running it wants to immediately
// fetch rules so the tasks can be started
- (BOOL)isRunning {
if (running)
[self getRuleList];
return running;
}

Expand Down

0 comments on commit 698ff67

Please sign in to comment.