From 5907c42425c139bad33a925efd3ba0a084d7e4a0 Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Fri, 24 Jan 2014 11:30:03 -0800 Subject: [PATCH] Take WinterBoard's implementation of wb$filter. --- CydgetSettings.mm | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/CydgetSettings.mm b/CydgetSettings.mm index a97d19c..ca82f8f 100644 --- a/CydgetSettings.mm +++ b/CydgetSettings.mm @@ -338,8 +338,28 @@ static NSString *_plist; } - (id) specifiers { - if (!_specifiers) - _specifiers = [[self loadSpecifiersFromPlistName:@"Cydget" target:self] retain]; + if (!_specifiers) { + NSMutableArray *specifiers([NSMutableArray array]); + for (PSSpecifier *specifier in [self loadSpecifiersFromPlistName:@"Cydget" target:self]) { + if (NSArray *version = [specifier propertyForKey:@"wb$filter"]) { + size_t count([version count]); + if (count == 0 || count > 2) + continue; + + double lower([[version objectAtIndex:0] doubleValue]); + if (kCFCoreFoundationVersionNumber < lower) + continue; + + if (count != 1) { + double upper([[version objectAtIndex:1] doubleValue]); + if (upper <= kCFCoreFoundationVersionNumber) + continue; + } + } + [specifiers addObject:specifier]; + } + _specifiers = [specifiers retain]; + } return _specifiers; } -- 2.45.2