From caa1c8fb8f9a9e0b3c76c26b2b837d2845020234 Mon Sep 17 00:00:00 2001 From: Mitchell Livingston Date: Tue, 22 Nov 2011 03:02:18 +0000 Subject: [PATCH] =?UTF-8?q?#4643=20Support=20=C2=B5Torrent's=20long-versio?= =?UTF-8?q?n-number=20peer=20id?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- libtransmission/clients.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/libtransmission/clients.c b/libtransmission/clients.c index a17964ab7..ec2d894b1 100644 --- a/libtransmission/clients.c +++ b/libtransmission/clients.c @@ -304,6 +304,29 @@ tr_clientForId( char * buf, size_t buflen, const void * id_in ) return; } + /* uTorrent will replace the training dash for an extra digit for longer version numbers */ + if( id[0] == '-' ) + { + if( !memcmp( id+1, "UT", 2 ) ) + { + tr_snprintf( buf, buflen, "\xc2\xb5Torrent %d.%d.%d%s", + strint(id+3,1), strint(id+4,1), strint(id+5,2), getMnemonicEnd(id[7]) ); + } + else if( !memcmp( id+1, "UM", 2 ) ) + { + tr_snprintf( buf, buflen, "\xc2\xb5Torrent Mac %d.%d.%d%s", + strint(id+3,1), strint(id+4,1), strint(id+5,2), getMnemonicEnd(id[7]) ); + } + else if( !memcmp( id+1, "UE", 2 ) ) + { + tr_snprintf( buf, buflen, "\xc2\xb5Torrent Embedded %d.%d.%d%s", + strint(id+3,1), strint(id+4,1), strint(id+5,2), getMnemonicEnd(id[7]) ); + } + + if( *buf ) + return; + } + /* Mainline */ if( isMainlineStyle( id ) ) {