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

#3133 Inspector > Trackers: Look for favicon.png

This commit is contained in:
Mitchell Livingston 2010-04-12 02:55:50 +00:00
parent 10dced5bb5
commit e115a0a2ad

View file

@ -224,6 +224,7 @@ NSMutableSet * fTrackerIconLoading;
{
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
//try favicon.ico
NSURL * favIconUrl = [NSURL URLWithString: [baseAddress stringByAppendingPathComponent: @"favicon.ico"]];
NSURLRequest * request = [NSURLRequest requestWithURL: favIconUrl cachePolicy: NSURLRequestUseProtocolCachePolicy
@ -231,6 +232,17 @@ NSMutableSet * fTrackerIconLoading;
NSData * iconData = [NSURLConnection sendSynchronousRequest: request returningResponse: NULL error: NULL];
NSImage * icon = [[NSImage alloc] initWithData: iconData];
//try favicon.png
if (!icon)
{
favIconUrl = [NSURL URLWithString: [baseAddress stringByAppendingPathComponent: @"favicon.png"]];
request = [NSURLRequest requestWithURL: favIconUrl cachePolicy: NSURLRequestUseProtocolCachePolicy
timeoutInterval: 30.0];
iconData = [NSURLConnection sendSynchronousRequest: request returningResponse: NULL error: NULL];
icon = [[NSImage alloc] initWithData: iconData];
}
if (icon)
{
[fTrackerIconCache setObject: icon forKey: baseAddress];