+- (NSNumber *) getKernelNumber:(NSString *)name {
+ const char *string([name UTF8String]);
+
+ size_t size;
+ if (sysctlbyname(string, NULL, &size, NULL, 0) == -1)
+ return (id) [NSNull null];
+
+ if (size != sizeof(int))
+ return (id) [NSNull null];
+
+ int value;
+ if (sysctlbyname(string, &value, &size, NULL, 0) == -1)
+ return (id) [NSNull null];
+
+ return [NSNumber numberWithInt:value];
+}
+
+- (NSString *) getKernelString:(NSString *)name {
+ const char *string([name UTF8String]);
+
+ size_t size;
+ if (sysctlbyname(string, NULL, &size, NULL, 0) == -1)
+ return (id) [NSNull null];
+
+ char value[size + 1];
+ if (sysctlbyname(string, value, &size, NULL, 0) == -1)
+ return (id) [NSNull null];
+
+ // XXX: just in case you request something ludicrous
+ value[size] = '\0';
+
+ return [NSString stringWithCString:value];
+}
+
+- (void) addCydiaHost:(NSString *)host {
+ [delegate_ performSelectorOnMainThread:@selector(addCydiaHost:) withObject:host waitUntilDone:NO];
+}
+
+- (void) addTrivialSource:(NSString *)href {
+ [delegate_ performSelectorOnMainThread:@selector(addTrivialSource:) withObject:href waitUntilDone:NO];
+}
+
+- (void) refreshSources {
+ [delegate_ performSelectorOnMainThread:@selector(syncData) withObject:nil waitUntilDone:NO];
+}
+
+- (NSArray *) getAllSources {
+ return [[Database sharedInstance] sources];
+}
+