From: Jay Freeman (saurik) Date: Mon, 28 Oct 2013 03:12:13 +0000 (-0700) Subject: Provide the entire package record via JavaScript. X-Git-Tag: v1.1.9~20 X-Git-Url: https://git.saurik.com/cydia.git/commitdiff_plain/8fb7c7a18f4ffb66f5b277f6b490c2594c0552b4 Provide the entire package record via JavaScript. --- diff --git a/MobileCydia.mm b/MobileCydia.mm index 38f6db1f..8ffb37da 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;