mirror of
https://github.com/transmission/transmission
synced 2025-02-22 06:00:41 +00:00
#1032: recognize bitlord/bitcomet in the inspector's peers column
This commit is contained in:
parent
6779afac43
commit
fa92408627
2 changed files with 36 additions and 0 deletions
|
@ -34,6 +34,9 @@ main( void )
|
|||
TEST_CLIENT( "-TR0072-", "Transmission 0.72" );
|
||||
TEST_CLIENT( "-TR111Z-", "Transmission 1.11+" );
|
||||
|
||||
TEST_CLIENT( "\x65\x78\x62\x63\x00\x38\x7A\x44\x63\x10\x2D\x6E\x9A\xD6\x72\x3B\x33\x9F\x35\xA9", "BitComet 0.56" );
|
||||
TEST_CLIENT( "\x65\x78\x62\x63\x00\x38\x4C\x4F\x52\x44\x32\x00\x04\x8E\xCE\xD5\x7B\xD7\x10\x28", "BitLord 0.56" );
|
||||
|
||||
/* cleanup */
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -114,6 +114,36 @@ isMainlineStyle( const uint8_t * peer_id )
|
|||
&& ( peer_id[4]=='-' || peer_id[5]=='-' );
|
||||
}
|
||||
|
||||
static int
|
||||
decodeBitCometClient( char * buf, size_t buflen, const uint8_t * id )
|
||||
{
|
||||
int is_bitlord;
|
||||
int major, minor;
|
||||
const char * name;
|
||||
const char * mod = NULL;
|
||||
|
||||
if( !memcmp( id, "exbc", 4 ) ) mod = "";
|
||||
else if( !memcmp( id, "FUTB", 4 )) mod = "(Solidox Mod) ";
|
||||
else if( !memcmp( id, "xUTB", 4 )) mod = "(Mod 2) ";
|
||||
else return FALSE;
|
||||
|
||||
is_bitlord = !memcmp( id+6, "LORD", 4 );
|
||||
name = (is_bitlord) ? "BitLord " : "BitComet ";
|
||||
major = id[4];
|
||||
minor = id[5];
|
||||
|
||||
/**
|
||||
* Bitcomet, and older versions of BitLord, are of the form x.yy.
|
||||
* Bitcoment 1.0 and onwards are of the form x.y.
|
||||
*/
|
||||
if( is_bitlord && major>0 )
|
||||
snprintf( buf, buflen, "%s%s%d.%d", name, mod, major, minor );
|
||||
else
|
||||
snprintf( buf, buflen, "%s%s%d.%02d", name, mod, major, minor );
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
tr_clientForId( char * buf, size_t buflen, const void * id_in )
|
||||
{
|
||||
|
@ -262,6 +292,9 @@ tr_clientForId( char * buf, size_t buflen, const void * id_in )
|
|||
if( *buf ) return;
|
||||
}
|
||||
|
||||
if( decodeBitCometClient( buf, buflen, id ) )
|
||||
return;
|
||||
|
||||
/* Clients with no version */
|
||||
if( !memcmp( id, "AZ2500BT", 8 ) ) no_version( buf, buflen, "BitTyrant (Azureus Mod)" );
|
||||
else if( !memcmp( id, "LIME", 4 ) ) no_version( buf, buflen, "Limewire" );
|
||||
|
|
Loading…
Reference in a new issue