From: Jay Freeman (saurik) Date: Fri, 18 Mar 2011 12:28:53 +0000 (-0700) Subject: Provide cydia.mcc and cydia.mnc, not cydia.plmn. X-Git-Tag: v1.1.0%rc1~80 X-Git-Url: https://git.saurik.com/cydia.git/commitdiff_plain/f87cac81daa0599173488e566abe961b4202b818 Provide cydia.mcc and cydia.mnc, not cydia.plmn. --- diff --git a/MobileCydia.mm b/MobileCydia.mm index 946bf03c..e8d8cfc1 100644 --- a/MobileCydia.mm +++ b/MobileCydia.mm @@ -691,7 +691,6 @@ static NSString *ChipID_ = nil; static NSString *BBSNum_ = nil; static _H Token_; static NSString *UniqueID_ = nil; -static NSString *PLMN_ = nil; static NSString *Build_ = nil; static NSString *Product_ = nil; static NSString *Safari_ = nil; @@ -3962,8 +3961,9 @@ static _H Diversions_; @"firmware", @"hostname", @"idiom", + @"mcc", + @"mnc", @"model", - @"plmn", @"role", @"serial", @"token", @@ -3999,8 +3999,16 @@ static _H Diversions_; return (id) Idiom_ ?: [NSNull null]; } -- (NSString *) plmn { - return (id) PLMN_ ?: [NSNull null]; +- (NSString *) mcc { + if (CFStringRef (*$CTSIMSupportCopyMobileSubscriberCountryCode)(CFAllocatorRef) = reinterpret_cast(dlsym(RTLD_DEFAULT, "CTSIMSupportCopyMobileSubscriberCountryCode"))) + return [(NSString *) (*$CTSIMSupportCopyMobileSubscriberCountryCode)(kCFAllocatorDefault) autorelease]; + return nil; +} + +- (NSString *) mnc { + if (CFStringRef (*$CTSIMSupportCopyMobileSubscriberNetworkCode)(CFAllocatorRef) = reinterpret_cast(dlsym(RTLD_DEFAULT, "CTSIMSupportCopyMobileSubscriberNetworkCode"))) + return [(NSString *) (*$CTSIMSupportCopyMobileSubscriberNetworkCode)(kCFAllocatorDefault) autorelease]; + return nil; } - (NSString *) bbsnum { @@ -10221,31 +10229,6 @@ int main(int argc, char *argv[]) { UniqueID_ = [device uniqueIdentifier]; - CFStringRef (*$CTSIMSupportCopyMobileSubscriberCountryCode)(CFAllocatorRef); - $CTSIMSupportCopyMobileSubscriberCountryCode = reinterpret_cast(dlsym(RTLD_DEFAULT, "CTSIMSupportCopyMobileSubscriberCountryCode")); - CFStringRef mcc($CTSIMSupportCopyMobileSubscriberCountryCode == NULL ? NULL : (*$CTSIMSupportCopyMobileSubscriberCountryCode)(kCFAllocatorDefault)); - - CFStringRef (*$CTSIMSupportCopyMobileSubscriberNetworkCode)(CFAllocatorRef); - $CTSIMSupportCopyMobileSubscriberNetworkCode = reinterpret_cast(dlsym(RTLD_DEFAULT, "CTSIMSupportCopyMobileSubscriberNetworkCode")); - CFStringRef mnc($CTSIMSupportCopyMobileSubscriberNetworkCode == NULL ? NULL : (*$CTSIMSupportCopyMobileSubscriberNetworkCode)(kCFAllocatorDefault)); - - if (mcc != NULL && mnc != NULL) - if (CFStringGetLength(mcc) == 3) { - CFIndex length(CFStringGetLength(mnc)); - if (length == 2 || length == 3) { - PLMN_ = [NSString stringWithFormat:@"%@%@", mcc, mnc]; - - Pcre pattern("^[0-9]{5,6}$"); - if (!pattern(PLMN_)) - PLMN_ = nil; - } - } - - if (mnc != NULL) - CFRelease(mnc); - if (mcc != NULL) - CFRelease(mcc); - if (NSDictionary *system = [NSDictionary dictionaryWithContentsOfFile:@"/System/Library/CoreServices/SystemVersion.plist"]) Build_ = [system objectForKey:@"ProductBuildVersion"]; if (NSDictionary *info = [NSDictionary dictionaryWithContentsOfFile:@"/Applications/MobileSafari.app/Info.plist"]) {