From 591b95286f3dbfaa68546ed29e387bb0f6f3267e Mon Sep 17 00:00:00 2001 From: Jordan Lee Date: Tue, 15 Mar 2011 17:03:09 +0000 Subject: [PATCH] Show whether a tracker is http or udp. Without that context, it could be confusing to see the same tracker twice in a tier --- gtk/details.c | 8 ++------ libtransmission/announcer.c | 12 ++++++++---- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/gtk/details.c b/gtk/details.c index 3d4bbb728..c296de02a 100644 --- a/gtk/details.c +++ b/gtk/details.c @@ -1794,15 +1794,11 @@ buildTrackerSummary( const char * key, const tr_tracker_stat * st, gboolean show /* hostname */ { - const char * host = st->host; - const char * pch = strstr( host, "://" ); - if( pch ) - host = pch + 3; g_string_append( gstr, st->isBackup ? "" : "" ); if( key ) - str = g_markup_printf_escaped( "%s - %s", host, key ); + str = g_markup_printf_escaped( "%s - %s", st->host, key ); else - str = g_markup_printf_escaped( "%s", host ); + str = g_markup_printf_escaped( "%s", st->host ); g_string_append( gstr, str ); g_free( str ); g_string_append( gstr, st->isBackup ? "" : "" ); diff --git a/libtransmission/announcer.c b/libtransmission/announcer.c index c1be5fd59..d4bff777d 100644 --- a/libtransmission/announcer.c +++ b/libtransmission/announcer.c @@ -213,12 +213,16 @@ tr_tracker; static char * getKey( const char * url ) { - int port = 0; - char * host = NULL; char * ret; - tr_urlParse( url, -1, NULL, &host, &port, NULL ); - ret = tr_strdup_printf( "%s:%d", ( host ? host : "invalid" ), port ); + char * scheme = NULL; + char * host = NULL; + int port = 0; + + tr_urlParse( url, -1, &scheme, &host, &port, NULL ); + ret = tr_strdup_printf( "%s://%s:%d", (scheme?scheme:"invalid"), (host?host:"invalid"), port ); + tr_free( host ); + tr_free( scheme ); return ret; }