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

differentiate old-style and new-style Transmission peer id (so version 1.01, etc is identified correctly)

This commit is contained in:
Mitchell Livingston 2007-05-09 03:05:38 +00:00
parent d2d8f9cf3c
commit 5aa4e9a664

View file

@ -46,9 +46,18 @@ char * tr_clientForId( uint8_t * id )
{ {
if( !memcmp( &id[1], "TR", 2 ) ) if( !memcmp( &id[1], "TR", 2 ) )
{ {
asprintf( &ret, "Transmission %d.%d", /* support old-style Transmission id without maintenance number */
charToInt( id[3] ) * 10 + charToInt( id[4] ), if ( !memcmp( &id[3], "00", 2 ) )
charToInt( id[5] ) * 10 + charToInt( id[6] ) ); {
asprintf( &ret, "Transmission 0.%d",
charToInt( id[5] ) * 10 + charToInt( id[6] ) );
}
else
{
asprintf( &ret, "Transmission %d.%c%c",
charToInt( id[3] ) * 10 + charToInt( id[4] ),
id[5], id[6] );
}
} }
else if( !memcmp( &id[1], "AZ", 2 ) ) else if( !memcmp( &id[1], "AZ", 2 ) )
{ {