From 019bd407df21b38dc22972771fc8557e45a844d3 Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Mon, 26 Dec 2016 19:57:55 -0800 Subject: Move to CoreTelephony's _CTServerConnectionCreate. --- MobileCydia.mm | 34 ++++++++++++++++++++++++++++++++++ entitlements.xml | 5 +++++ 2 files changed, 39 insertions(+) diff --git a/MobileCydia.mm b/MobileCydia.mm index 53df43e..ed88ae2 100644 --- a/MobileCydia.mm +++ b/MobileCydia.mm @@ -238,6 +238,16 @@ union SplitHash { }; // }}} +@implementation NSDictionary (Cydia) +- (id) invokeUndefinedMethodFromWebScript:(NSString *)name withArguments:(NSArray *)arguments { + if (false); + else if ([name isEqualToString:@"get"]) + return [self objectForKey:[arguments objectAtIndex:0]]; + else if ([name isEqualToString:@"keys"]) + return [self allKeys]; + return nil; +} @end + static NSString *Colon_; NSString *Elision_; static NSString *Error_; @@ -4364,6 +4374,7 @@ static _H Diversions_; return [NSArray arrayWithObjects: @"bbsnum", @"build", + @"cells", @"coreFoundationVersionNumber", @"device", @"ecid", @@ -4416,6 +4427,29 @@ static _H Diversions_; return (id) Idiom_ ?: [NSNull null]; } +- (NSArray *) cells { + auto *$_CTServerConnectionCreate(reinterpret_cast(dlsym(RTLD_DEFAULT, "_CTServerConnectionCreate"))); + if ($_CTServerConnectionCreate == NULL) + return nil; + + struct CTResult { int flag; int error; }; + auto *$_CTServerConnectionCellMonitorCopyCellInfo(reinterpret_cast(dlsym(RTLD_DEFAULT, "_CTServerConnectionCellMonitorCopyCellInfo"))); + if ($_CTServerConnectionCellMonitorCopyCellInfo == NULL) + return nil; + + _H connection($_CTServerConnectionCreate(NULL, NULL, NULL), true); + if (connection == nil) + return nil; + + int count(0); + CFArrayRef cells(NULL); + auto result($_CTServerConnectionCellMonitorCopyCellInfo(connection, &count, &cells)); + if (result.flag != 0) + return nil; + + return [(NSArray *) cells autorelease]; +} + - (NSString *) mcc { if (CFStringRef (*$CTSIMSupportCopyMobileSubscriberCountryCode)(CFAllocatorRef) = reinterpret_cast(dlsym(RTLD_DEFAULT, "CTSIMSupportCopyMobileSubscriberCountryCode"))) return [(NSString *) (*$CTSIMSupportCopyMobileSubscriberCountryCode)(kCFAllocatorDefault) autorelease]; diff --git a/entitlements.xml b/entitlements.xml index 65bd529..fbcca6a 100644 --- a/entitlements.xml +++ b/entitlements.xml @@ -28,5 +28,10 @@ platform-application + + com.apple.CommCenter.fine-grained + + spi + -- cgit v1.2.3