autoimport can now tell if not opening was a result of the torrent already existing or not being supported

This commit is contained in:
Mitchell Livingston 2006-10-31 20:53:10 +00:00
parent f165fb0404
commit 0f75cc7799
1 changed files with 18 additions and 9 deletions

View File

@ -1569,18 +1569,27 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
{ {
if ([[file pathExtension] caseInsensitiveCompare: @"torrent"] == NSOrderedSame) if ([[file pathExtension] caseInsensitiveCompare: @"torrent"] == NSOrderedSame)
{ {
oldCount = [fTorrents count]; int error;
[self openFiles: [NSArray arrayWithObject: [path stringByAppendingPathComponent: file]]]; tr_torrent_t * tempTor = tr_torrentInit(fLib, [path UTF8String], 0, & error);
//import only actually happened if the torrent array is larger if (tempTor)
if (oldCount < [fTorrents count])
{ {
[GrowlApplicationBridge notifyWithTitle: NSLocalizedString(@"Torrent File Auto Added", tr_torrentClose(fLib, tempTor);
"Growl notification title") description: file
notificationName: GROWL_AUTO_ADD iconData: nil priority: 0 isSticky: NO clickContext: nil]; int count = [fTorrents count];
[self openFiles: [NSArray arrayWithObject: [path stringByAppendingPathComponent: file]]];
//check if torrent was opened
if ([fTorrents count] > count)
{
[GrowlApplicationBridge notifyWithTitle: NSLocalizedString(@"Torrent File Auto Added",
"Growl notification title") description: file
notificationName: GROWL_AUTO_ADD iconData: nil priority: 0 isSticky: NO clickContext: nil];
}
} }
else else if (error != TR_EUNSUPPORTED || error != TR_EDUPLICATE)
[fAutoImportedNames removeObjectIdenticalTo: file]; //failed to import, possibly because not fully downloaded [fAutoImportedNames removeObjectIdenticalTo: file]; //failed to import for unknown reason, so try again later
else;
} }
} }