Ignore:
Timestamp:
Nov 22, 2007, 3:34:44 AM (15 years ago)
Author:
livings124
Message:

implement another ipc method

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/Controller.m

    r3922 r3924  
    33453345- (BOOL) ipcAddTorrentFileAutostart: (NSString *) path directory: (NSString *) directory autostart: (BOOL) autostart
    33463346{
    3347     /* 'path' is path to torrent file, 'dir' is the directory it
    3348        should download it's files to and may be nil, 'autostart' is a
    3349        boolean indicating if the torrent should be automatically
    3350        started (or queued to start, I guess), should return NO if
    3351        torrent fails to load */
    3352     return NO;
     3347    NSArray * torrents;
     3348    if (autostart)
     3349        torrents = [fTorrents copy];
     3350    BOOL success = [self ipcAddTorrentFile: path directory: directory];
     3351   
     3352    if (success && autostart)
     3353    {
     3354        NSEnumerator * enumerator = [torrents objectEnumerator];
     3355        Torrent * torrent;
     3356        while ((torrent = [enumerator nextObject]))
     3357            if (![torrents containsObject: torrent])
     3358                break;
     3359       
     3360        if (torrent)
     3361            [torrent startTransfer];
     3362        else
     3363            success = NO;
     3364    }
     3365   
     3366    [torrents release];
     3367    return success;
    33533368}
    33543369
Note: See TracChangeset for help on using the changeset viewer.