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

(trunk daemon) #2786 "Trigger blocklist update using transmission-remote" -- patch applied for 1.90

This commit is contained in:
Charles Kerr 2010-01-29 16:43:39 +00:00
parent 34187bad0f
commit 217d2f54d0

View file

@ -40,7 +40,7 @@
#define DEFAULT_HOST "localhost"
#define DEFAULT_PORT atoi(TR_DEFAULT_RPC_PORT_STR)
enum { TAG_SESSION, TAG_STATS, TAG_LIST, TAG_DETAILS, TAG_FILES, TAG_PEERS };
enum { TAG_SESSION, TAG_STATS, TAG_LIST, TAG_DETAILS, TAG_FILES, TAG_PEERS, TAG_PORTTEST };
static const char*
getUsage( void )
@ -72,6 +72,7 @@ static tr_option opts[] =
{ 976, "alt-speed-time-begin", "Time to start using the alt speed limits (in hhmm)", NULL, 1, "<time>" },
{ 977, "alt-speed-time-end", "Time to stop using the alt speed limits (in hhmm)", NULL, 1, "<time>" },
{ 978, "alt-speed-days", "Numbers for any/all days of the week - eg. \"1-7\"", NULL, 1, "<days>" },
{ 963, "blocklist-update", "Blocklist update", NULL, 0, NULL },
{ 'c', "incomplete-dir", "Where to store new torrents until they're complete", "c", 1, "<dir>" },
{ 'C', "no-incomplete-dir", "Don't store incomplete torrents in a different location", "C", 0, NULL },
{ 'b', "debug", "Print debugging information", "b", 0, NULL },
@ -96,6 +97,7 @@ static tr_option opts[] =
{ 'o', "dht", "Enable distributed hash tables (DHT)", "o", 0, NULL },
{ 'O', "no-dht", "Disable distributed hash tables (DHT)", "O", 0, NULL },
{ 'p', "port", "Port for incoming peers (Default: " TR_DEFAULT_PEER_PORT_STR ")", "p", 1, "<port>" },
{ 962, "port-test", "Port testing", "pt", 0, NULL },
{ 'P', "random-port", "Random port for incomping peers", "P", 0, NULL },
{ 900, "priority-high", "Set the files' priorities as high", "ph", 1, "<files>" },
{ 901, "priority-normal", "Set the files' priorities as normal", "pn", 1, "<files>" },
@ -701,6 +703,15 @@ readargs( int argc, const char ** argv )
addIdArg( args, id );
break;
case 962:
tr_bencDictAddStr( &top, "method", "port-test" );
tr_bencDictAddInt( &top, "tag", TAG_PORTTEST );
break;
case 963:
tr_bencDictAddStr( &top, "method", "blocklist-update" );
break;
case 970:
tr_bencDictAddStr( &top, "method", "session-set" );
tr_bencDictAddBool( args, TR_PREFS_KEY_ALT_SPEED_ENABLED, TRUE );
@ -1601,6 +1612,19 @@ printPeers( tr_benc * top )
}
}
static void
printPortTest( tr_benc * top )
{
tr_benc *args;
if( ( tr_bencDictFindDict( top, "arguments", &args ) ) )
{
tr_bool boolVal;
if( tr_bencDictFindBool( args, "port-is-open", &boolVal ) )
printf( "Port is open: %s\n", ( boolVal ? "Yes" : "No" ) );
}
}
static void
printTorrentList( tr_benc * top )
{
@ -1726,6 +1750,9 @@ processResponse( const char * host,
case TAG_PEERS:
printPeers( &top ); break;
case TAG_PORTTEST:
printPortTest( &top ); break;
default:
if( !tr_bencDictFindStr( &top, "result", &str ) )
status |= EXIT_FAILURE;