mirror of
https://github.com/transmission/transmission
synced 2024-12-24 08:43:27 +00:00
(trunk) #2245: defined macros
This commit is contained in:
parent
80987859a7
commit
ffc54a8c7e
2 changed files with 36 additions and 36 deletions
|
@ -362,13 +362,13 @@ readargs( int argc,
|
|||
|
||||
case 'd':
|
||||
tr_bencDictAddStr( &top, "method", "session-set" );
|
||||
tr_bencDictAddInt( args, "speed-limit-down", numarg( optarg ) );
|
||||
tr_bencDictAddBool( args, "speed-limit-down-enabled", TRUE );
|
||||
tr_bencDictAddInt( args, TR_PREFS_KEY_DSPEED, numarg( optarg ) );
|
||||
tr_bencDictAddBool( args, TR_PREFS_KEY_DSPEED_ENABLED, TRUE );
|
||||
break;
|
||||
|
||||
case 'D':
|
||||
tr_bencDictAddStr( &top, "method", "session-set" );
|
||||
tr_bencDictAddBool( args, "speed-limit-down-enabled", FALSE );
|
||||
tr_bencDictAddBool( args, TR_PREFS_KEY_DSPEED_ENABLED, FALSE );
|
||||
break;
|
||||
|
||||
case 'f':
|
||||
|
@ -414,12 +414,12 @@ readargs( int argc,
|
|||
|
||||
case 'm':
|
||||
tr_bencDictAddStr( &top, "method", "session-set" );
|
||||
tr_bencDictAddBool( args, "port-forwarding-enabled", TRUE );
|
||||
tr_bencDictAddBool( args, TR_PREFS_KEY_PORT_FORWARDING, TRUE );
|
||||
break;
|
||||
|
||||
case 'M':
|
||||
tr_bencDictAddStr( &top, "method", "session-set" );
|
||||
tr_bencDictAddBool( args, "port-forwarding-enabled", FALSE );
|
||||
tr_bencDictAddBool( args, TR_PREFS_KEY_PORT_FORWARDING, FALSE );
|
||||
break;
|
||||
|
||||
case 'n':
|
||||
|
@ -470,13 +470,13 @@ readargs( int argc,
|
|||
|
||||
case 'u':
|
||||
tr_bencDictAddStr( &top, "method", "session-set" );
|
||||
tr_bencDictAddInt( args, "speed-limit-up", numarg( optarg ) );
|
||||
tr_bencDictAddBool( args, "speed-limit-up-enabled", TRUE );
|
||||
tr_bencDictAddInt( args, TR_PREFS_KEY_USPEED, numarg( optarg ) );
|
||||
tr_bencDictAddBool( args, TR_PREFS_KEY_USPEED_ENABLED, TRUE );
|
||||
break;
|
||||
|
||||
case 'U':
|
||||
tr_bencDictAddStr( &top, "method", "session-set" );
|
||||
tr_bencDictAddBool( args, "speed-limit-up-enabled", FALSE );
|
||||
tr_bencDictAddBool( args, TR_PREFS_KEY_USPEED_ENABLED, FALSE );
|
||||
break;
|
||||
|
||||
case 'v':
|
||||
|
@ -844,15 +844,15 @@ printSession( tr_benc * top )
|
|||
printf( "\n" );
|
||||
|
||||
printf( "TRANSFER\n" );
|
||||
if( tr_bencDictFindStr( args, "download-dir", &str ) )
|
||||
if( tr_bencDictFindStr( args, TR_PREFS_KEY_DOWNLOAD_DIR, &str ) )
|
||||
printf( " Download directory: %s\n", str );
|
||||
if( tr_bencDictFindInt( args, "port", &i ) )
|
||||
if( tr_bencDictFindInt( args, TR_PREFS_KEY_PEER_PORT, &i ) )
|
||||
printf( " Listenport: %" PRId64 "\n", i );
|
||||
if( tr_bencDictFindBool( args, "port-forwarding-enabled", &boolVal ) )
|
||||
if( tr_bencDictFindBool( args, TR_PREFS_KEY_PORT_FORWARDING, &boolVal ) )
|
||||
printf( " Portforwarding enabled: %s\n", ( boolVal ? "Yes" : "No" ) );
|
||||
if( tr_bencDictFindBool( args, "pex-enabled", &boolVal ) )
|
||||
if( tr_bencDictFindBool( args, TR_PREFS_KEY_PEX_ENABLED, &boolVal ) )
|
||||
printf( " Peer exchange allowed: %s\n", ( boolVal ? "Yes" : "No" ) );
|
||||
if( tr_bencDictFindStr( args, "encryption", &str ) )
|
||||
if( tr_bencDictFindStr( args, TR_PREFS_KEY_ENCRYPTION, &str ) )
|
||||
printf( " Encryption: %s\n", str );
|
||||
printf( "\n" );
|
||||
|
||||
|
@ -860,18 +860,18 @@ printSession( tr_benc * top )
|
|||
tr_bool altEnabled, altTimeEnabled, upEnabled, downEnabled;
|
||||
int64_t altDown, altUp, altBegin, altEnd, altDay, upLimit, downLimit, peerLimit;
|
||||
|
||||
if( tr_bencDictFindInt ( args, "alt-speed-down", &altDown ) &&
|
||||
tr_bencDictFindBool( args, "alt-speed-enabled", &altEnabled ) &&
|
||||
tr_bencDictFindInt ( args, "alt-speed-time-begin", &altBegin ) &&
|
||||
tr_bencDictFindBool( args, "alt-speed-time-enabled", &altTimeEnabled ) &&
|
||||
tr_bencDictFindInt ( args, "alt-speed-time-end", &altEnd ) &&
|
||||
tr_bencDictFindInt ( args, "alt-speed-time-day", &altDay ) &&
|
||||
tr_bencDictFindInt ( args, "alt-speed-up", &altUp ) &&
|
||||
tr_bencDictFindInt ( args, "peer-limit-global", &peerLimit ) &&
|
||||
tr_bencDictFindInt ( args, "speed-limit-down", &downLimit ) &&
|
||||
tr_bencDictFindBool( args, "speed-limit-down-enabled", &downEnabled ) &&
|
||||
tr_bencDictFindInt ( args, "speed-limit-up", &upLimit ) &&
|
||||
tr_bencDictFindBool( args, "speed-limit-up-enabled", &upEnabled ) )
|
||||
if( tr_bencDictFindInt ( args, TR_PREFS_KEY_ALT_SPEED_DOWN, &altDown ) &&
|
||||
tr_bencDictFindBool( args, TR_PREFS_KEY_ALT_SPEED_ENABLED, &altEnabled ) &&
|
||||
tr_bencDictFindInt ( args, TR_PREFS_KEY_ALT_SPEED_TIME_BEGIN, &altBegin ) &&
|
||||
tr_bencDictFindBool( args, TR_PREFS_KEY_ALT_SPEED_TIME_ENABLED, &altTimeEnabled ) &&
|
||||
tr_bencDictFindInt ( args, TR_PREFS_KEY_ALT_SPEED_TIME_END, &altEnd ) &&
|
||||
tr_bencDictFindInt ( args, TR_PREFS_KEY_ALT_SPEED_TIME_DAY, &altDay ) &&
|
||||
tr_bencDictFindInt ( args, TR_PREFS_KEY_ALT_SPEED_UP, &altUp ) &&
|
||||
tr_bencDictFindInt ( args, TR_PREFS_KEY_PEER_LIMIT_GLOBAL, &peerLimit ) &&
|
||||
tr_bencDictFindInt ( args, TR_PREFS_KEY_DSPEED, &downLimit ) &&
|
||||
tr_bencDictFindBool( args, TR_PREFS_KEY_DSPEED_ENABLED, &downEnabled ) &&
|
||||
tr_bencDictFindInt ( args, TR_PREFS_KEY_USPEED, &upLimit ) &&
|
||||
tr_bencDictFindBool( args, TR_PREFS_KEY_USPEED_ENABLED, &upEnabled ) )
|
||||
{
|
||||
char buf[128];
|
||||
|
||||
|
|
|
@ -1027,7 +1027,7 @@ torrentAdd( tr_session * session,
|
|||
|
||||
/* set the optional arguments */
|
||||
|
||||
if( tr_bencDictFindStr( args_in, "download-dir", &str ) )
|
||||
if( tr_bencDictFindStr( args_in, TR_PREFS_KEY_DOWNLOAD_DIR, &str ) )
|
||||
tr_ctorSetDownloadDir( ctor, TR_FORCE, str );
|
||||
|
||||
if( tr_bencDictFindBool( args_in, "paused", &boolVal ) )
|
||||
|
@ -1148,15 +1148,15 @@ sessionSet( tr_session * session,
|
|||
tr_sessionSetRatioLimit( session, d );
|
||||
if( tr_bencDictFindBool( args_in, "seedRatioLimited", &boolVal ) )
|
||||
tr_sessionSetRatioLimited( session, boolVal );
|
||||
if( tr_bencDictFindInt( args_in, "speed-limit-down", &i ) )
|
||||
if( tr_bencDictFindInt( args_in, TR_PREFS_KEY_DSPEED, &i ) )
|
||||
tr_sessionSetSpeedLimit( session, TR_DOWN, i );
|
||||
if( tr_bencDictFindBool( args_in, "speed-limit-down-enabled", &boolVal ) )
|
||||
if( tr_bencDictFindBool( args_in, TR_PREFS_KEY_DSPEED_ENABLED, &boolVal ) )
|
||||
tr_sessionLimitSpeed( session, TR_DOWN, boolVal );
|
||||
if( tr_bencDictFindInt( args_in, "speed-limit-up", &i ) )
|
||||
if( tr_bencDictFindInt( args_in, TR_PREFS_KEY_USPEED, &i ) )
|
||||
tr_sessionSetSpeedLimit( session, TR_UP, i );
|
||||
if( tr_bencDictFindBool( args_in, "speed-limit-up-enabled", &boolVal ) )
|
||||
if( tr_bencDictFindBool( args_in, TR_PREFS_KEY_USPEED_ENABLED, &boolVal ) )
|
||||
tr_sessionLimitSpeed( session, TR_UP, boolVal );
|
||||
if( tr_bencDictFindStr( args_in, "encryption", &str ) ) {
|
||||
if( tr_bencDictFindStr( args_in, TR_PREFS_KEY_ENCRYPTION, &str ) ) {
|
||||
if( !strcmp( str, "required" ) )
|
||||
tr_sessionSetEncryption( session, TR_ENCRYPTION_REQUIRED );
|
||||
else if( !strcmp( str, "tolerated" ) )
|
||||
|
@ -1248,17 +1248,17 @@ sessionGet( tr_session * s,
|
|||
tr_bencDictAddInt ( d, "rpc-version-minimum", 1 );
|
||||
tr_bencDictAddReal( d, "seedRatioLimit", tr_sessionGetRatioLimit( s ) );
|
||||
tr_bencDictAddBool( d, "seedRatioLimited", tr_sessionIsRatioLimited( s ) );
|
||||
tr_bencDictAddInt ( d, "speed-limit-up", tr_sessionGetSpeedLimit( s, TR_UP ) );
|
||||
tr_bencDictAddBool( d, "speed-limit-up-enabled", tr_sessionIsSpeedLimited( s, TR_UP ) );
|
||||
tr_bencDictAddInt ( d, "speed-limit-down", tr_sessionGetSpeedLimit( s, TR_DOWN ) );
|
||||
tr_bencDictAddBool( d, "speed-limit-down-enabled", tr_sessionIsSpeedLimited( s, TR_DOWN ) );
|
||||
tr_bencDictAddInt ( d, TR_PREFS_KEY_USPEED, tr_sessionGetSpeedLimit( s, TR_UP ) );
|
||||
tr_bencDictAddBool( d, TR_PREFS_KEY_USPEED_ENABLED, tr_sessionIsSpeedLimited( s, TR_UP ) );
|
||||
tr_bencDictAddInt ( d, TR_PREFS_KEY_DSPEED, tr_sessionGetSpeedLimit( s, TR_DOWN ) );
|
||||
tr_bencDictAddBool( d, TR_PREFS_KEY_DSPEED_ENABLED, tr_sessionIsSpeedLimited( s, TR_DOWN ) );
|
||||
tr_bencDictAddStr ( d, "version", LONG_VERSION_STRING );
|
||||
switch( tr_sessionGetEncryption( s ) ) {
|
||||
case TR_CLEAR_PREFERRED: str = "tolerated"; break;
|
||||
case TR_ENCRYPTION_REQUIRED: str = "required"; break;
|
||||
default: str = "preferred"; break;
|
||||
}
|
||||
tr_bencDictAddStr( d, "encryption", str );
|
||||
tr_bencDictAddStr( d, TR_PREFS_KEY_ENCRYPTION, str );
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue