summaryrefslogtreecommitdiff
path: root/MobileCydia.mm
diff options
context:
space:
mode:
authorJay Freeman (saurik) <saurik@saurik.com>2011-03-18 05:28:53 -0700
committerJay Freeman (saurik) <saurik@saurik.com>2011-03-18 05:28:53 -0700
commitf87cac81daa0599173488e566abe961b4202b818 (patch)
treebf9c1b9ebec160f7a30990e59dd632efb8eb682a /MobileCydia.mm
parent4f749ed1cbdd574e5d387234815c4b505f69e439 (diff)
Provide cydia.mcc and cydia.mnc, not cydia.plmn.
Diffstat (limited to 'MobileCydia.mm')
-rw-r--r--MobileCydia.mm41
1 files changed, 12 insertions, 29 deletions
diff --git a/MobileCydia.mm b/MobileCydia.mm
index 946bf03..e8d8cfc 100644
--- a/MobileCydia.mm
+++ b/MobileCydia.mm
@@ -691,7 +691,6 @@ static NSString *ChipID_ = nil;
static NSString *BBSNum_ = nil;
static _H<NSString> 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<NSMutableSet> Diversions_;
@"firmware",
@"hostname",
@"idiom",
+ @"mcc",
+ @"mnc",
@"model",
- @"plmn",
@"role",
@"serial",
@"token",
@@ -3999,8 +3999,16 @@ static _H<NSMutableSet> Diversions_;
return (id) Idiom_ ?: [NSNull null];
}
-- (NSString *) plmn {
- return (id) PLMN_ ?: [NSNull null];
+- (NSString *) mcc {
+ if (CFStringRef (*$CTSIMSupportCopyMobileSubscriberCountryCode)(CFAllocatorRef) = reinterpret_cast<CFStringRef (*)(CFAllocatorRef)>(dlsym(RTLD_DEFAULT, "CTSIMSupportCopyMobileSubscriberCountryCode")))
+ return [(NSString *) (*$CTSIMSupportCopyMobileSubscriberCountryCode)(kCFAllocatorDefault) autorelease];
+ return nil;
+}
+
+- (NSString *) mnc {
+ if (CFStringRef (*$CTSIMSupportCopyMobileSubscriberNetworkCode)(CFAllocatorRef) = reinterpret_cast<CFStringRef (*)(CFAllocatorRef)>(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<CFStringRef (*)(CFAllocatorRef)>(dlsym(RTLD_DEFAULT, "CTSIMSupportCopyMobileSubscriberCountryCode"));
- CFStringRef mcc($CTSIMSupportCopyMobileSubscriberCountryCode == NULL ? NULL : (*$CTSIMSupportCopyMobileSubscriberCountryCode)(kCFAllocatorDefault));
-
- CFStringRef (*$CTSIMSupportCopyMobileSubscriberNetworkCode)(CFAllocatorRef);
- $CTSIMSupportCopyMobileSubscriberNetworkCode = reinterpret_cast<CFStringRef (*)(CFAllocatorRef)>(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"]) {