summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJay Freeman (saurik) <saurik@saurik.com>2008-04-25 08:45:43 +0000
committerJay Freeman (saurik) <saurik@saurik.com>2008-04-25 08:45:43 +0000
commita72074b2e406983d9da08636bfe899043e619339 (patch)
treef6e11d19351dd214388b506a611d5078dc0ffb2b
parent4cf4165e8f0fc78a905fc9c421c0728e00ce4905 (diff)
Refresh sources after source update and sort sections without case.
-rw-r--r--Cydia.mm27
1 files changed, 16 insertions, 11 deletions
diff --git a/Cydia.mm b/Cydia.mm
index e5f198c..70c5ff6 100644
--- a/Cydia.mm
+++ b/Cydia.mm
@@ -48,7 +48,6 @@
#include <objc/objc.h>
#include <objc/runtime.h>
-#include <map>
#include <sstream>
#include <string>
@@ -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<std::string> 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 {