1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-25 17:17:31 +00:00

when removing trackers, handle hidden duplicates

This commit is contained in:
Mitchell Livingston 2011-04-05 23:03:33 +00:00
parent f37da42a8c
commit d0aac9336b
3 changed files with 9 additions and 9 deletions

View file

@ -313,14 +313,14 @@
if (groupSelected || [selectedIndexes containsIndex: i])
{
Torrent * torrent = [(TrackerNode *)object torrent];
NSMutableIndexSet * removeIndexSet;
if (!(removeIndexSet = [removeIdentifiers objectForKey: torrent]))
NSMutableSet * removeSet;
if (!(removeSet = [removeIdentifiers objectForKey: torrent]))
{
removeIndexSet = [NSMutableIndexSet indexSet];
[removeIdentifiers setObject: removeIndexSet forKey: torrent];
removeSet = [NSMutableSet set];
[removeIdentifiers setObject: removeSet forKey: torrent];
}
[removeIndexSet addIndex: [(TrackerNode *)object identifier]];
[removeSet addObject: [(TrackerNode *)object fullAnnounceAddress]];
++removeCount;
}
}
@ -370,7 +370,7 @@
}
for (Torrent * torrent in removeIdentifiers)
[torrent removeTrackersWithIdentifiers: [removeIdentifiers objectForKey: torrent]];
[torrent removeTrackers: [removeIdentifiers objectForKey: torrent]];
//reset table with either new or old value
[fTrackers release];

View file

@ -134,7 +134,7 @@
- (NSMutableArray *) allTrackerStats;
- (NSArray *) allTrackersFlat; //used by GroupRules
- (BOOL) addTrackerToNewTier: (NSString *) tracker;
- (void) removeTrackersWithIdentifiers: (NSIndexSet *) removeIdentifiers;
- (void) removeTrackers: (NSSet *) trackers;
- (NSString *) comment;
- (NSString *) creator;

View file

@ -699,7 +699,7 @@ int trashDataFile(const char * filename)
return success;
}
- (void) removeTrackersWithIdentifiers: (NSIndexSet *) removeIdentifiers
- (void) removeTrackers: (NSSet *) trackers
{
//recreate the tracker structure
tr_tracker_info * trackerStructs = tr_new(tr_tracker_info, fInfo->trackerCount);
@ -707,7 +707,7 @@ int trashDataFile(const char * filename)
NSUInteger newCount = 0;
for (NSUInteger i = 0; i < fInfo->trackerCount; i++)
{
if (![removeIdentifiers containsIndex: fInfo->trackers[i].id])
if (![trackers containsObject: [NSString stringWithUTF8String: fInfo->trackers[i].announce]])
trackerStructs[newCount++] = fInfo->trackers[i];
}