Changeset 9735


Ignore:
Timestamp:
Dec 13, 2009, 1:36:22 AM (12 years ago)
Author:
livings124
Message:

warnings--

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/Torrent.m

    r9726 r9735  
    3232@interface Torrent (Private)
    3333
    34 - (id) initWithPath: (NSString *) path hash: (NSString *) hashString torrentStruct: (tr_torrent *) torrentStruct lib: (tr_session *) lib
     34- (id) initWithPath: (NSString *) path hash: (NSString *) hashString torrentStruct: (tr_torrent *) torrentStruct
     35        magnetAddress: (NSString *) magnetAddress lib: (tr_session *) lib
    3536        waitToStart: (NSNumber *) waitToStart
    3637        groupValue: (NSNumber *) groupValue
     
    7980        lib: (tr_session *) lib
    8081{
    81     self = [self initWithPath: path hash: nil torrentStruct: NULL lib: lib
     82    self = [self initWithPath: path hash: nil torrentStruct: NULL magnetAddress: nil lib: lib
    8283            waitToStart: nil groupValue: nil
    8384            downloadFolder: location legacyIncompleteFolder: nil];
     
    9394- (id) initWithTorrentStruct: (tr_torrent *) torrentStruct location: (NSString *) location lib: (tr_session *) lib
    9495{
    95     self = [self initWithPath: nil hash: nil torrentStruct: torrentStruct lib: lib
     96    self = [self initWithPath: nil hash: nil torrentStruct: torrentStruct magnetAddress: nil lib: lib
    9697            waitToStart: nil groupValue: nil
    9798            downloadFolder: location legacyIncompleteFolder: nil];
     
    103104- (id) initWithMagnetAddress: (NSString *) address location: (NSString *) location lib: (tr_session *) lib
    104105{
    105     #warning move into real constructor?
    106     //set libtransmission settings for initialization
    107     tr_ctor * ctor = tr_ctorNew(lib);
    108     tr_ctorSetPaused(ctor, TR_FORCE, YES);
    109    
    110     const tr_parse_result result = tr_ctorSetMagnet(ctor, [address UTF8String]);
    111    
    112     tr_torrent * handle = NULL;
    113     if (result == TR_PARSE_OK)
    114         handle = tr_torrentNew(ctor, NULL);
    115    
    116     tr_ctorFree(ctor);
    117    
    118     if (handle)
    119         self = [self initWithPath: nil hash: nil torrentStruct: handle lib: lib
    120                 waitToStart: nil groupValue: nil
    121                 downloadFolder: location legacyIncompleteFolder: nil];
    122     else
    123         self = nil;
     106    self = [self initWithPath: nil hash: nil torrentStruct: nil magnetAddress: address
     107            lib: lib waitToStart: nil groupValue: nil
     108            downloadFolder: location legacyIncompleteFolder: nil];
    124109   
    125110    return self;
     
    130115    self = [self initWithPath: [history objectForKey: @"InternalTorrentPath"]
    131116                hash: [history objectForKey: @"TorrentHash"]
    132                 torrentStruct: NULL lib: lib
     117                torrentStruct: NULL
     118                magnetAddress: nil
     119                lib: lib
    133120                waitToStart: [history objectForKey: @"WaitToStart"]
    134121                groupValue: [history objectForKey: @"GroupValue"]
     
    15431530@implementation Torrent (Private)
    15441531
    1545 - (id) initWithPath: (NSString *) path hash: (NSString *) hashString torrentStruct: (tr_torrent *) torrentStruct lib: (tr_session *) lib
     1532- (id) initWithPath: (NSString *) path hash: (NSString *) hashString torrentStruct: (tr_torrent *) torrentStruct
     1533        magnetAddress: (NSString *) magnetAddress lib: (tr_session *) lib
    15461534        waitToStart: (NSNumber *) waitToStart
    15471535        groupValue: (NSNumber *) groupValue
     
    15551543    if (torrentStruct)
    15561544        fHandle = torrentStruct;
     1545    else if (magnetAddress)
     1546    {
     1547        tr_ctor * ctor = tr_ctorNew(lib);
     1548       
     1549        tr_ctorSetPaused(ctor, TR_FORCE, YES);
     1550        if (downloadFolder)
     1551            tr_ctorSetDownloadDir(ctor, TR_FORCE, [downloadFolder UTF8String]);
     1552       
     1553        const tr_parse_result result = tr_ctorSetMagnet(ctor, [magnetAddress UTF8String]);
     1554       
     1555        if (result == TR_PARSE_OK)
     1556            fHandle = tr_torrentNew(ctor, NULL);
     1557       
     1558        tr_ctorFree(ctor);
     1559       
     1560        if (!fHandle)
     1561        {
     1562            [self release];
     1563            return nil;
     1564        }
     1565    }
    15571566    else
    15581567    {
    15591568        //set libtransmission settings for initialization
    15601569        tr_ctor * ctor = tr_ctorNew(lib);
     1570       
    15611571        tr_ctorSetPaused(ctor, TR_FORCE, YES);
     1572        if (downloadFolder)
     1573            tr_ctorSetDownloadDir(ctor, TR_FORCE, [downloadFolder UTF8String]);
     1574        if (incompleteFolder)
     1575            tr_ctorSetIncompleteDir(ctor, [incompleteFolder UTF8String]);
    15621576       
    15631577        tr_parse_result result = TR_PARSE_ERR;
     
    15701584       
    15711585        if (result == TR_PARSE_OK)
    1572         {
    1573             if (downloadFolder)
    1574                 tr_ctorSetDownloadDir(ctor, TR_FORCE, [downloadFolder UTF8String]);
    1575             if (incompleteFolder)
    1576                 tr_ctorSetIncompleteDir(ctor, [incompleteFolder UTF8String]);
    1577            
    15781586            fHandle = tr_torrentNew(ctor, NULL);
    1579         }
    15801587       
    15811588        tr_ctorFree(ctor);
Note: See TracChangeset for help on using the changeset viewer.