mirror of
https://github.com/transmission/transmission
synced 2025-03-04 10:38:13 +00:00
switch-ify an if
This commit is contained in:
parent
b276f285b0
commit
78419871e9
1 changed files with 18 additions and 16 deletions
|
@ -2329,30 +2329,32 @@ void sleepCallBack(void * controller, io_service_t y, natural_t messageType, voi
|
|||
BOOL ask = [[fDefaults stringForKey: @"DownloadChoice"] isEqualToString: @"Ask"];
|
||||
|
||||
NSEnumerator * enumerator = [newNames objectEnumerator];
|
||||
int canAdd, count;
|
||||
int count;
|
||||
tr_ctor * ctor;
|
||||
while ((file = [enumerator nextObject]))
|
||||
{
|
||||
tr_ctor * ctor = tr_ctorNew(fLib);
|
||||
ctor = tr_ctorNew(fLib);
|
||||
tr_ctorSetMetainfoFromFile(ctor, [file UTF8String]);
|
||||
canAdd = tr_torrentParseFromCtor(fLib, ctor, NULL);
|
||||
tr_ctorFree(ctor);
|
||||
|
||||
if (canAdd == TR_OK)
|
||||
switch (tr_torrentParseFromCtor(fLib, ctor, NULL))
|
||||
{
|
||||
if (!ask)
|
||||
count = [fTorrents count];
|
||||
[self openFiles: [NSArray arrayWithObject: file]];
|
||||
case TR_OK:
|
||||
if (!ask)
|
||||
count = [fTorrents count];
|
||||
[self openFiles: [NSArray arrayWithObject: file]];
|
||||
|
||||
//check if torrent was opened
|
||||
if (!ask && [fTorrents count] > count)
|
||||
[GrowlApplicationBridge notifyWithTitle: NSLocalizedString(@"Torrent File Auto Added",
|
||||
"Growl notification title") description: [file lastPathComponent]
|
||||
notificationName: GROWL_AUTO_ADD iconData: nil priority: 0 isSticky: NO clickContext: nil];
|
||||
break;
|
||||
|
||||
//check if torrent was opened
|
||||
if (!ask && [fTorrents count] > count)
|
||||
[GrowlApplicationBridge notifyWithTitle: NSLocalizedString(@"Torrent File Auto Added",
|
||||
"Growl notification title") description: [file lastPathComponent]
|
||||
notificationName: GROWL_AUTO_ADD iconData: nil priority: 0 isSticky: NO clickContext: nil];
|
||||
case TR_EINVALID:
|
||||
[fAutoImportedNames removeObject: [file lastPathComponent]];
|
||||
}
|
||||
else if (canAdd == TR_EINVALID)
|
||||
[fAutoImportedNames removeObject: [file lastPathComponent]];
|
||||
else;
|
||||
|
||||
tr_ctorFree(ctor);
|
||||
}
|
||||
|
||||
[newNames release];
|
||||
|
|
Loading…
Add table
Reference in a new issue