diff options
author | Jay Freeman (saurik) <saurik@saurik.com> | 2013-10-27 20:12:13 -0700 |
---|---|---|
committer | Jay Freeman (saurik) <saurik@saurik.com> | 2013-10-27 20:12:13 -0700 |
commit | 8fb7c7a18f4ffb66f5b277f6b490c2594c0552b4 (patch) | |
tree | cf0257b33be58f3b3fee43e45104431decbb272c /MobileCydia.mm | |
parent | 21b36e0d141fad54b8adf26b70ee0e3d9681f11e (diff) |
Provide the entire package record via JavaScript.
Diffstat (limited to 'MobileCydia.mm')
-rw-r--r-- | MobileCydia.mm | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/MobileCydia.mm b/MobileCydia.mm index 38f6db1..8ffb37d 100644 --- a/MobileCydia.mm +++ b/MobileCydia.mm @@ -2118,6 +2118,8 @@ struct PackageNameOrdering : return @"clear"; else if (selector == @selector(getField:)) return @"getField"; + else if (selector == @selector(getRecord)) + return @"getRecord"; else if (selector == @selector(hasTag:)) return @"hasTag"; else if (selector == @selector(install)) @@ -2202,6 +2204,19 @@ struct PackageNameOrdering : return [NSString stringWithString:[(NSString *) CYStringCreate(start, end - start) autorelease]]; } } +- (NSString *) getRecord { +@synchronized (database_) { + if ([database_ era] != era_ || file_.end()) + return nil; + + pkgRecords::Parser &parser([database_ records]->Lookup(file_)); + + const char *start, *end; + parser.GetRec(start, end); + + return [NSString stringWithString:[(NSString *) CYStringCreate(start, end - start) autorelease]]; +} } + - (void) parse { if (parsed_ != NULL) return; |