1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-27 01:57:52 +00:00

add tr_blocklistExists( const tr_handle * );

This commit is contained in:
Charles Kerr 2008-03-29 22:16:33 +00:00
parent a20bb8d569
commit e5b04e45d5
3 changed files with 15 additions and 3 deletions

View file

@ -59,7 +59,7 @@ main( void )
/* create our own dummy blocklist */ /* create our own dummy blocklist */
createTestBlocklist( tmpfile ); createTestBlocklist( tmpfile );
tr_setBlocklist( handle, tmpfile ); tr_blocklistSet( handle, tmpfile );
/* now run some tests */ /* now run some tests */
check( !tr_netResolve( "216.16.1.143", &addr ) ); check( !tr_netResolve( "216.16.1.143", &addr ) );

View file

@ -135,8 +135,18 @@ deleteBlocklist( tr_handle * handle UNUSED )
unlink( filename ); unlink( filename );
} }
int
tr_blocklistExists( const tr_handle * handle UNUSED )
{
struct stat st;
char filename[MAX_PATH_LENGTH];
tr_getBlocklistFilename( filename, sizeof( filename ) );
return !stat( filename, &st );
}
void void
tr_setBlocklist( tr_handle * handle, tr_blocklistSet( tr_handle * handle,
const char * filename ) const char * filename )
{ {
FILE * in; FILE * in;

View file

@ -306,9 +306,11 @@ uint16_t tr_getGlobalPeerLimit( const tr_handle * handle );
* *
* Passing NULL for a filename will clear the blocklist. * Passing NULL for a filename will clear the blocklist.
*/ */
void tr_setBlocklist( tr_handle * handle, void tr_blocklistSet( tr_handle * handle,
const char * filename ); const char * filename );
int tr_blocklistExists( const tr_handle * handle );
/*********************************************************************** /***********************************************************************