Handle exceptions

This commit is contained in:
Frank Denis
2012-09-27 23:13:40 +02:00
parent fde1ebff46
commit 92a8b0b097
3 changed files with 50 additions and 3 deletions
@@ -23,6 +23,7 @@
@synthesize blacklistIPsTextField = _blacklistIPsTextField;
@synthesize blacklistDomainsTextField = _blacklistDomainsTextField;
@synthesize helpWebView = _helpWebView;
@synthesize exceptionsTextField = _exceptionsTextField;
@synthesize dnscryptButton = _dnscryptButton;
@synthesize opendnsButton = _opendnsButton;
@synthesize fallbackButton = _fallbackButton;
@@ -110,6 +111,10 @@ DNSConfigurationState currentState = kDNS_CONFIGURATION_UNKNOWN;
if (fileContent != nil) {
[_blacklistDomainsTextField setStringValue: fileContent];
}
fileContent = [NSString stringWithContentsOfFile: kDNSCRYPT_EXCEPTIONS_TMP_FILE encoding:NSUTF8StringEncoding error: nil];
if (fileContent != nil) {
[_exceptionsTextField setStringValue: fileContent];
}
}
- (void) updateLedStatus
@@ -507,6 +512,21 @@ DNSConfigurationState currentState = kDNS_CONFIGURATION_UNKNOWN;
[self updateBlacklistDomains];
}
- (BOOL) updateExceptions {
[self showSpinners];
NSString *res = [self fromCommand: @"/bin/ksh" withArguments: [NSArray arrayWithObjects: @"-c", @"cd '" kDNSCRIPT_SCRIPTS_BASE_DIR @"' && ./create-ticket.sh && ./update-exceptions.sh", nil]];
(void) res;
return TRUE;
}
- (IBAction)exceptionsUpdated:(NSTextField *)sender {
NSString *content = sender.stringValue;
if ([content writeToFile: kDNSCRYPT_EXCEPTIONS_TMP_FILE atomically: YES encoding: NSUTF8StringEncoding error: nil] != YES) {
return;
}
[self updateExceptions];
}
- (IBAction)helpButtonPressed:(NSButton *)sender {
if (_helpWebView.isHidden) {
[_helpWebView setHidden: NO];