mirror of
https://github.com/transmission/transmission
synced 2024-12-26 09:37:56 +00:00
when removing trackers, handle hidden duplicates
This commit is contained in:
parent
f37da42a8c
commit
d0aac9336b
3 changed files with 9 additions and 9 deletions
|
@ -313,14 +313,14 @@
|
||||||
if (groupSelected || [selectedIndexes containsIndex: i])
|
if (groupSelected || [selectedIndexes containsIndex: i])
|
||||||
{
|
{
|
||||||
Torrent * torrent = [(TrackerNode *)object torrent];
|
Torrent * torrent = [(TrackerNode *)object torrent];
|
||||||
NSMutableIndexSet * removeIndexSet;
|
NSMutableSet * removeSet;
|
||||||
if (!(removeIndexSet = [removeIdentifiers objectForKey: torrent]))
|
if (!(removeSet = [removeIdentifiers objectForKey: torrent]))
|
||||||
{
|
{
|
||||||
removeIndexSet = [NSMutableIndexSet indexSet];
|
removeSet = [NSMutableSet set];
|
||||||
[removeIdentifiers setObject: removeIndexSet forKey: torrent];
|
[removeIdentifiers setObject: removeSet forKey: torrent];
|
||||||
}
|
}
|
||||||
|
|
||||||
[removeIndexSet addIndex: [(TrackerNode *)object identifier]];
|
[removeSet addObject: [(TrackerNode *)object fullAnnounceAddress]];
|
||||||
++removeCount;
|
++removeCount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -370,7 +370,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Torrent * torrent in removeIdentifiers)
|
for (Torrent * torrent in removeIdentifiers)
|
||||||
[torrent removeTrackersWithIdentifiers: [removeIdentifiers objectForKey: torrent]];
|
[torrent removeTrackers: [removeIdentifiers objectForKey: torrent]];
|
||||||
|
|
||||||
//reset table with either new or old value
|
//reset table with either new or old value
|
||||||
[fTrackers release];
|
[fTrackers release];
|
||||||
|
|
|
@ -134,7 +134,7 @@
|
||||||
- (NSMutableArray *) allTrackerStats;
|
- (NSMutableArray *) allTrackerStats;
|
||||||
- (NSArray *) allTrackersFlat; //used by GroupRules
|
- (NSArray *) allTrackersFlat; //used by GroupRules
|
||||||
- (BOOL) addTrackerToNewTier: (NSString *) tracker;
|
- (BOOL) addTrackerToNewTier: (NSString *) tracker;
|
||||||
- (void) removeTrackersWithIdentifiers: (NSIndexSet *) removeIdentifiers;
|
- (void) removeTrackers: (NSSet *) trackers;
|
||||||
|
|
||||||
- (NSString *) comment;
|
- (NSString *) comment;
|
||||||
- (NSString *) creator;
|
- (NSString *) creator;
|
||||||
|
|
|
@ -699,7 +699,7 @@ int trashDataFile(const char * filename)
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) removeTrackersWithIdentifiers: (NSIndexSet *) removeIdentifiers
|
- (void) removeTrackers: (NSSet *) trackers
|
||||||
{
|
{
|
||||||
//recreate the tracker structure
|
//recreate the tracker structure
|
||||||
tr_tracker_info * trackerStructs = tr_new(tr_tracker_info, fInfo->trackerCount);
|
tr_tracker_info * trackerStructs = tr_new(tr_tracker_info, fInfo->trackerCount);
|
||||||
|
@ -707,7 +707,7 @@ int trashDataFile(const char * filename)
|
||||||
NSUInteger newCount = 0;
|
NSUInteger newCount = 0;
|
||||||
for (NSUInteger i = 0; i < fInfo->trackerCount; i++)
|
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];
|
trackerStructs[newCount++] = fInfo->trackers[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue