]> git.saurik.com Git - cydia.git/commitdiff
Move to CoreTelephony's _CTServerConnectionCreate.
authorJay Freeman (saurik) <saurik@saurik.com>
Tue, 27 Dec 2016 03:57:55 +0000 (19:57 -0800)
committerJay Freeman (saurik) <saurik@saurik.com>
Tue, 27 Dec 2016 03:57:55 +0000 (19:57 -0800)
MobileCydia.mm
entitlements.xml

index 53df43e95b60081019658af30f74543fb0639a1c..ed88ae275760fcb5f2cda21da1a7abacfbb9f8d4 100644 (file)
@@ -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<NSMutableSet> Diversions_;
     return [NSArray arrayWithObjects:
         @"bbsnum",
         @"build",
+        @"cells",
         @"coreFoundationVersionNumber",
         @"device",
         @"ecid",
@@ -4416,6 +4427,29 @@ static _H<NSMutableSet> Diversions_;
     return (id) Idiom_ ?: [NSNull null];
 }
 
+- (NSArray *) cells {
+    auto *$_CTServerConnectionCreate(reinterpret_cast<id (*)(void *, void *, void *)>(dlsym(RTLD_DEFAULT, "_CTServerConnectionCreate")));
+    if ($_CTServerConnectionCreate == NULL)
+        return nil;
+
+    struct CTResult { int flag; int error; };
+    auto *$_CTServerConnectionCellMonitorCopyCellInfo(reinterpret_cast<CTResult (*)(CFTypeRef, void *, CFArrayRef *)>(dlsym(RTLD_DEFAULT, "_CTServerConnectionCellMonitorCopyCellInfo")));
+    if ($_CTServerConnectionCellMonitorCopyCellInfo == NULL)
+        return nil;
+
+    _H<const void> 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<CFStringRef (*)(CFAllocatorRef)>(dlsym(RTLD_DEFAULT, "CTSIMSupportCopyMobileSubscriberCountryCode")))
         return [(NSString *) (*$CTSIMSupportCopyMobileSubscriberCountryCode)(kCFAllocatorDefault) autorelease];
index 65bd529a26fec194b7cdf0945d95cf7ec95209ae..fbcca6adb1fef4b449666a6e7df19d49466a4f57 100644 (file)
 
     <key>platform-application</key>
     <true/>
+
+    <key>com.apple.CommCenter.fine-grained</key>
+    <array>
+        <string>spi</string>
+    </array>
 </dict>
 </plist>