Ignore:
Timestamp:
Sep 17, 2009, 12:33:39 AM (13 years ago)
Author:
livings124
Message:

remove distinction between built-in trackers and custom-added trackers; add trackers to the end of the list instead of the beginning

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/Torrent.m

    r9046 r9125  
    3535        useIncompleteFolder: (NSNumber *) useIncompleteFolder incompleteFolder: (NSString *) incompleteFolder
    3636        waitToStart: (NSNumber *) waitToStart
    37         groupValue: (NSNumber *) groupValue addedTrackers: (NSNumber *) addedTrackers;
     37        groupValue: (NSNumber *) groupValue;
    3838
    3939- (BOOL) shouldUseIncompleteFolderForName: (NSString *) name;
     
    8484            downloadFolder: location
    8585            useIncompleteFolder: nil incompleteFolder: nil
    86             waitToStart: nil groupValue: nil addedTrackers: nil];
     86            waitToStart: nil groupValue: nil];
    8787   
    8888    if (self)
     
    9999            downloadFolder: location
    100100            useIncompleteFolder: nil incompleteFolder: nil
    101             waitToStart: nil groupValue: nil addedTrackers: nil];
     101            waitToStart: nil groupValue: nil];
    102102   
    103103    return self;
     
    113113                incompleteFolder: [history objectForKey: @"IncompleteFolder"]
    114114                waitToStart: [history objectForKey: @"WaitToStart"]
    115                 groupValue: [history objectForKey: @"GroupValue"]
    116                 addedTrackers: [history objectForKey: @"AddedTrackers"]];
     115                groupValue: [history objectForKey: @"GroupValue"]];
    117116   
    118117    if (self)
     
    162161                    [NSNumber numberWithBool: [self isActive]], @"Active",
    163162                    [NSNumber numberWithBool: fWaitToStart], @"WaitToStart",
    164                     [NSNumber numberWithInt: fGroupValue], @"GroupValue",
    165                     [NSNumber numberWithBool: fAddedTrackers], @"AddedTrackers", nil];
     163                    [NSNumber numberWithInt: fGroupValue], @"GroupValue", nil];
    166164   
    167165    if (fIncompleteFolder)
     
    749747        {
    750748            tier = fInfo->trackers[i].tier;
    751             [allTrackers addObject: [NSNumber numberWithInt: fAddedTrackers ? tier : tier + 1]];
     749            [allTrackers addObject: [NSNumber numberWithInteger: tier + 1]];
    752750        }
    753751       
     
    765763- (BOOL) updateAllTrackersForAdd: (NSMutableArray *) trackers
    766764{
    767     //find added tracker at end of first tier
    768     NSInteger i;
    769     for (i = 1; i < [trackers count]; i++)
    770         if ([[trackers objectAtIndex: i] isKindOfClass: [NSNumber class]])
    771             break;
    772     i--;
    773    
    774     NSString * tracker = [trackers objectAtIndex: i];
    775    
     765    NSString * tracker = [trackers lastObject];
    776766    tracker = [tracker stringByTrimmingCharactersInSet: [NSCharacterSet whitespaceAndNewlineCharacterSet]];
    777767   
     
    779769    {
    780770        tracker = [@"http://" stringByAppendingString: tracker];
    781         [trackers replaceObjectAtIndex: i withObject: tracker];
     771        [trackers replaceObjectAtIndex: [trackers count]-1 withObject: tracker];
    782772    }
    783773   
     
    787777    [self updateAllTrackers: trackers];
    788778   
    789     fAddedTrackers = YES;
    790779    return YES;
    791780}
    792781
     782#warning needed?
    793783- (void) updateAllTrackersForRemove: (NSMutableArray *) trackers
    794784{
    795     //check if no user-added groups
    796     if ([trackers count] == 0 || [[trackers objectAtIndex: 0] intValue] != 0)
    797         fAddedTrackers = NO;
    798    
    799785    [self updateAllTrackers: trackers];
    800 }
    801 
    802 - (BOOL) hasAddedTrackers
    803 {
    804     return fAddedTrackers;
    805786}
    806787
     
    15681549        useIncompleteFolder: (NSNumber *) useIncompleteFolder incompleteFolder: (NSString *) incompleteFolder
    15691550        waitToStart: (NSNumber *) waitToStart
    1570         groupValue: (NSNumber *) groupValue addedTrackers: (NSNumber *) addedTrackers
     1551        groupValue: (NSNumber *) groupValue
    15711552{
    15721553    if (!(self = [super init]))
     
    16511632    [self createFileList];
    16521633       
    1653     fGroupValue = groupValue ? [groupValue intValue] : [[GroupsController groups] groupIndexForTorrent: self];
    1654    
    1655     fAddedTrackers = addedTrackers ? [addedTrackers boolValue] : NO;   
     1634    fGroupValue = groupValue ? [groupValue intValue] : [[GroupsController groups] groupIndexForTorrent: self];
    16561635   
    16571636    [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(checkGroupValueForRemoval:)
Note: See TracChangeset for help on using the changeset viewer.