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
1 changed files with 12 additions and 3 deletions

View File

@ -46,9 +46,18 @@ char * tr_clientForId( uint8_t * id )
{
if( !memcmp( &id[1], "TR", 2 ) )
{
asprintf( &ret, "Transmission %d.%d",
charToInt( id[3] ) * 10 + charToInt( id[4] ),
charToInt( id[5] ) * 10 + charToInt( id[6] ) );
/* support old-style Transmission id without maintenance number */
if ( !memcmp( &id[3], "00", 2 ) )
{
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 ) )
{