Ignore:
Timestamp:
Jun 16, 2008, 5:26:19 PM (13 years ago)
Author:
charles
Message:

#1032: recognize bitlord/bitcomet in the inspector's peers column

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/clients.c

    r5843 r6201  
    113113        && peer_id[7]=='-'
    114114        && ( peer_id[4]=='-' || peer_id[5]=='-' );
     115}
     116
     117static int
     118decodeBitCometClient( char * buf, size_t buflen, const uint8_t * id )
     119{
     120    int is_bitlord;
     121    int major, minor;
     122    const char * name;
     123    const char * mod = NULL;
     124
     125    if( !memcmp( id, "exbc", 4 ) ) mod = "";
     126    else if( !memcmp( id, "FUTB", 4 )) mod = "(Solidox Mod) ";
     127    else if( !memcmp( id, "xUTB", 4 )) mod = "(Mod 2) ";
     128    else return FALSE;
     129
     130    is_bitlord = !memcmp( id+6, "LORD", 4 );
     131    name = (is_bitlord) ? "BitLord " : "BitComet ";
     132    major = id[4];
     133    minor = id[5];
     134
     135    /**
     136     * Bitcomet, and older versions of BitLord, are of the form x.yy.
     137     * Bitcoment 1.0 and onwards are of the form x.y.
     138     */
     139    if( is_bitlord && major>0 )
     140        snprintf( buf, buflen, "%s%s%d.%d", name, mod, major, minor );
     141    else
     142        snprintf( buf, buflen, "%s%s%d.%02d", name, mod, major, minor );
     143
     144    return TRUE;
    115145}
    116146
     
    263293    }
    264294
     295    if( decodeBitCometClient( buf, buflen, id ) )
     296        return;
     297
    265298    /* Clients with no version */
    266299         if( !memcmp( id, "AZ2500BT", 8 ) )  no_version( buf, buflen, "BitTyrant (Azureus Mod)" );
Note: See TracChangeset for help on using the changeset viewer.