summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--MobileCydia.mm13
1 files changed, 12 insertions, 1 deletions
diff --git a/MobileCydia.mm b/MobileCydia.mm
index dbe4f80..addc941 100644
--- a/MobileCydia.mm
+++ b/MobileCydia.mm
@@ -1135,6 +1135,7 @@ typedef std::map< unsigned long, _H<Source> > SourceMap;
+ (Database *) sharedInstance;
- (unsigned) era;
+- (bool) hasPackages;
- (void) _readCydia:(NSNumber *)fd;
- (void) _readStatus:(NSNumber *)fd;
@@ -3523,6 +3524,10 @@ class CydiaLogCleaner :
CFArrayRemoveAllValues(packages_);
}
+- (bool) hasPackages {
+ return CFArrayGetCount(packages_) != 0;
+}
+
- (void) dealloc {
// XXX: actually implement this thing
_assert(false);
@@ -4857,10 +4862,16 @@ static _H<NSMutableSet> Diversions_;
}
- (NSString *) substitutePackageNames:(NSString *)message {
+ auto database([Database sharedInstance]);
+
+ // XXX: this check is less racy than you'd expect, but this entire concept is a little awkward
+ if ([database hasPackages])
+ return message;
+
NSMutableArray *words([[[message componentsSeparatedByString:@" "] mutableCopy] autorelease]);
for (size_t i(0), e([words count]); i != e; ++i) {
NSString *word([words objectAtIndex:i]);
- if (Package *package = [[Database sharedInstance] packageWithName:word])
+ if (Package *package = [database packageWithName:word])
[words replaceObjectAtIndex:i withObject:[package name]];
}