1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-24 00:34:04 +00:00

when getting the list of all trackers, exclude tiers when necessary

This commit is contained in:
Mitchell Livingston 2008-04-24 14:41:41 +00:00
parent c444a79cc4
commit b5d8fd0eb8
2 changed files with 6 additions and 4 deletions

View file

@ -194,7 +194,6 @@
trackerString = [@"http://" stringByAppendingString: trackerString];
//parse tracker string
#warning check if it works with https
if (tr_httpParseURL([trackerString UTF8String], -1, NULL, NULL, NULL))
{
NSAlert * alert = [[[NSAlert alloc] init] autorelease];

View file

@ -770,15 +770,18 @@ void completenessChangeCallback(tr_torrent * torrent, cp_status_t status, void *
return [NSString stringWithUTF8String: fStat->tracker_stat.scrapeResponse];
}
#warning removes separators?
- (NSArray *) allTrackers: (BOOL) separators
{
int count = fInfo->trackerCount;
NSMutableArray * allTrackers = [NSMutableArray arrayWithCapacity: count + fInfo->trackers[count-1].tier + 1];
int count = fInfo->trackerCount, capacity = count;
if (separators)
capacity += fInfo->trackers[count-1].tier + 1;
NSMutableArray * allTrackers = [NSMutableArray arrayWithCapacity: capacity];
int i, tier = -1;
for (i = 0; i < count; i++)
{
if (tier != fInfo->trackers[i].tier)
if (separators && tier != fInfo->trackers[i].tier)
{
tier = fInfo->trackers[i].tier;
[allTrackers addObject: [NSNumber numberWithInt: tier]];