Changeset 1046


Ignore:
Timestamp:
Oct 31, 2006, 8:53:10 PM (16 years ago)
Author:
livings124
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/Controller.m

    r1045 r1046  
    15701570        if ([[file pathExtension] caseInsensitiveCompare: @"torrent"] == NSOrderedSame)
    15711571        {
    1572             oldCount = [fTorrents count];
    1573             [self openFiles: [NSArray arrayWithObject: [path stringByAppendingPathComponent: file]]];
     1572            int error;
     1573            tr_torrent_t * tempTor = tr_torrentInit(fLib, [path UTF8String], 0, & error);
    15741574           
    1575             //import only actually happened if the torrent array is larger
    1576             if (oldCount < [fTorrents count])
     1575            if (tempTor)
    15771576            {
    1578                 [GrowlApplicationBridge notifyWithTitle: NSLocalizedString(@"Torrent File Auto Added",
    1579                     "Growl notification title") description: file
    1580                     notificationName: GROWL_AUTO_ADD iconData: nil priority: 0 isSticky: NO clickContext: nil];
     1577                tr_torrentClose(fLib, tempTor);
     1578               
     1579                int count = [fTorrents count];
     1580                [self openFiles: [NSArray arrayWithObject: [path stringByAppendingPathComponent: file]]];
     1581               
     1582                //check if torrent was opened
     1583                if ([fTorrents count] > count)
     1584                {
     1585                    [GrowlApplicationBridge notifyWithTitle: NSLocalizedString(@"Torrent File Auto Added",
     1586                        "Growl notification title") description: file
     1587                        notificationName: GROWL_AUTO_ADD iconData: nil priority: 0 isSticky: NO clickContext: nil];
     1588                }
    15811589            }
    1582             else
    1583                 [fAutoImportedNames removeObjectIdenticalTo: file]; //failed to import, possibly because not fully downloaded
     1590            else if (error != TR_EUNSUPPORTED || error != TR_EDUPLICATE)
     1591                [fAutoImportedNames removeObjectIdenticalTo: file]; //failed to import for unknown reason, so try again later
     1592            else;
    15841593        }
    15851594    }
Note: See TracChangeset for help on using the changeset viewer.