From 113c9b626b240d2b7635b476fd64713bfe3335f0 Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Fri, 25 Apr 2008 08:45:43 +0000 Subject: [PATCH] Refresh sources after source update and sort sections without case. --- Cydia.mm | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/Cydia.mm b/Cydia.mm index e5f198c4..70c5ff66 100644 --- a/Cydia.mm +++ b/Cydia.mm @@ -48,7 +48,6 @@ #include #include -#include #include #include @@ -1100,7 +1099,7 @@ NSString *Scour(const char *field, const char *begin, const char *end) { else if (lhs != NULL && rhs == NULL) return NSOrderedDescending; else if (lhs != NULL && rhs != NULL) { - NSComparisonResult result = [lhs compare:rhs]; + NSComparisonResult result = [lhs caseInsensitiveCompare:rhs]; if (result != NSOrderedSame) return result; } @@ -1411,14 +1410,12 @@ NSString *Scour(const char *field, const char *begin, const char *end) { } - (void) perform { - pkgSourceList list; - _assert(list.ReadMainList()); - - /*std::map before; - - for (pkgSourceList::const_iterator source = list_->begin(); source != list_->end(); ++source) - before.add((*source)->GetURI().c_str()); - exit(0);*/ + NSMutableArray *before = [NSMutableArray arrayWithCapacity:16]; { + pkgSourceList list; + _assert(list.ReadMainList()); + for (pkgSourceList::const_iterator source = list.begin(); source != list.end(); ++source) + [before addObject:[NSString stringWithUTF8String:(*source)->GetURI().c_str()]]; + } if (fetcher_->Run(PulseInterval_) != pkgAcquire::Continue) return; @@ -1433,7 +1430,15 @@ NSString *Scour(const char *field, const char *begin, const char *end) { if (result != pkgPackageManager::Completed) return; - _assert(list.ReadMainList()); + NSMutableArray *after = [NSMutableArray arrayWithCapacity:16]; { + pkgSourceList list; + _assert(list.ReadMainList()); + for (pkgSourceList::const_iterator source = list.begin(); source != list.end(); ++source) + [after addObject:[NSString stringWithUTF8String:(*source)->GetURI().c_str()]]; + } + + if (![before isEqualToArray:after]) + [self update]; } - (void) upgrade { -- 2.47.2