X-Git-Url: https://git.saurik.com/cydia.git/blobdiff_plain/21ac0ce2e7b9efaea52a836de3dabb74a9bb5d1e..51807490b9d639cc4bad27817134e597743e6336:/MobileCydia.mm diff --git a/MobileCydia.mm b/MobileCydia.mm index a68c4662..787a78e6 100644 --- a/MobileCydia.mm +++ b/MobileCydia.mm @@ -1082,6 +1082,7 @@ typedef std::map< unsigned long, _H > SourceMap; - (Source *) getSource:(pkgCache::PkgFileIterator)file; - (void) setFetch:(bool)fetch forURI:(const char *)uri; +- (void) resetFetch; - (NSString *) mappedSectionForPointer:(const char *)pointer; @@ -1128,6 +1129,11 @@ class SourceStatus : } else (*item)->ID = 0; return ![delegate_ isSourceCancelled]; } + + virtual void Stop() { + pkgAcquireStatus::Stop(); + [database_ resetFetch]; + } }; /* }}} */ /* ProgressEvent Implementation {{{ */ @@ -1428,6 +1434,7 @@ static void PackageImport(const void *key, const void *value, void *context) { - (NSURL *) iconURL; - (void) setFetch:(bool)fetch forURI:(const char *)uri; +- (void) resetFetch; @end @@ -1759,6 +1766,11 @@ static void PackageImport(const void *key, const void *value, void *context) { [delegate_ performSelectorOnMainThread:@selector(setFetch:) withObject:[NSNumber numberWithBool:[self fetch]] waitUntilDone:NO]; } +- (void) resetFetch { + fetches_.clear(); + [delegate_ performSelectorOnMainThread:@selector(setFetch:) withObject:[NSNumber numberWithBool:NO] waitUntilDone:NO]; +} + @end /* }}} */ /* CydiaOperation Class {{{ */ @@ -3964,6 +3976,11 @@ class CydiaLogCleaner : [source setFetch:fetch forURI:uri]; } +- (void) resetFetch { + for (Source *source in (id) sourceList_) + [source resetFetch]; +} + - (NSString *) mappedSectionForPointer:(const char *)section { _H *mapped; @@ -8171,10 +8188,8 @@ static void HomeControllerReachabilityCallback(SCNetworkReachabilityRef reachabi _H hud_; _H error_; - //NSURLConnection *installer_; NSURLConnection *trivial_bz2_; NSURLConnection *trivial_gz_; - //NSURLConnection *automatic_; BOOL cydia_; } @@ -8195,10 +8210,8 @@ static void HomeControllerReachabilityCallback(SCNetworkReachabilityRef reachabi } - (void) dealloc { - //[self _releaseConnection:installer_]; [self _releaseConnection:trivial_gz_]; [self _releaseConnection:trivial_bz2_]; - //[self _releaseConnection:automatic_]; [super dealloc]; } @@ -8289,6 +8302,10 @@ static void HomeControllerReachabilityCallback(SCNetworkReachabilityRef reachabi } } +- (void) tableView:(UITableView *)tableView didEndEditingRowAtIndexPath:(NSIndexPath *)indexPath { + [self updateButtonsForEditingStatusAnimated:YES]; +} + - (void) complete { [delegate_ addTrivialSource:href_]; href_ = nil; @@ -8441,7 +8458,21 @@ static void HomeControllerReachabilityCallback(SCNetworkReachabilityRef reachabi case 1: { NSString *href = [[alert textField] text]; - //installer_ = [[self _requestHRef:href method:@"GET"] retain]; + static Pcre href_r("^http(s?)://[^# ]*$"); + if (!href_r(href)) { + UIAlertView *alert = [[[UIAlertView alloc] + initWithTitle:Error_ + message:UCLocalize("INVALID_URL") + delegate:self + cancelButtonTitle:UCLocalize("OK") + otherButtonTitles:nil + ] autorelease]; + + [alert setContext:@"badurl"]; + [alert show]; + + break; + } if (![href hasSuffix:@"/"]) href_ = [href stringByAppendingString:@"/"]; @@ -8450,7 +8481,6 @@ static void HomeControllerReachabilityCallback(SCNetworkReachabilityRef reachabi trivial_bz2_ = [[self _requestHRef:[href_ stringByAppendingString:@"Packages.bz2"] method:@"HEAD"] retain]; trivial_gz_ = [[self _requestHRef:[href_ stringByAppendingString:@"Packages.gz"] method:@"HEAD"] retain]; - //trivial_bz2_ = [[self _requestHRef:[href stringByAppendingString:@"dists/Release"] method:@"HEAD"] retain]; cydia_ = false; @@ -10203,6 +10233,16 @@ int main(int argc, char *argv[]) { Changed_ = true; } + + _H broken([NSMutableArray array]); + for (NSString *key in (id) Sources_) + if ([key rangeOfCharacterFromSet:[NSCharacterSet characterSetWithCharactersInString:@"# "]].location != NSNotFound) + [broken addObject:key]; + if ([broken count] != 0) { + for (NSString *key in (id) broken) + [Sources_ removeObjectForKey:key]; + Changed_ = true; + } broken = nil; /* }}} */ CydiaWriteSources();