Created
March 29, 2009 05:22
-
-
Save technolize/87290 to your computer and use it in GitHub Desktop.
Mail fetch toggle SBSettings add-on.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <Foundation/Foundation.h> | |
#import <unistd.h> | |
#import <stdlib.h> | |
#import <ctype.h> | |
#import <notify.h> | |
#define PREF_FILE @"/var/mobile/Library/Preferences/com.apple.persistentconnection.plist" | |
BOOL isCapable() { | |
return YES; | |
} | |
BOOL isEnabled() { | |
NSDictionary *config = [NSDictionary dictionaryWithContentsOfFile:PREF_FILE]; | |
BOOL ret = [[config objectForKey:@"PCDefaultPollInterval"] boolValue]; | |
return ret; | |
} | |
void setState(BOOL enable) { | |
NSMutableDictionary *config = [NSMutableDictionary dictionaryWithContentsOfFile:PREF_FILE]; | |
if ( enable == YES ) | |
[config setValue:[NSNumber numberWithInt:900] forKey:@"PCDefaultPollInterval"]; | |
else | |
[config setValue:[NSNumber numberWithInt:0] forKey:@"PCDefaultPollInterval"]; | |
[config writeToFile:PREF_FILE atomically: YES]; | |
} | |
float getDelayTime() { | |
return 0.5f; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment