From 674307add7877409b984bd6b3dd44d5530e4a7dd Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Wed, 22 Oct 2008 17:16:12 +0000 Subject: [PATCH] Add a new token, TR_DEFAULT_ENCRYPTION, and use it as the default in the various clients. Add a new #define, TR_EMBEDDED. When it's set, gettext is disabled and non-encrypted connections are the default. --- cli/cli.c | 2 +- daemon/daemon.c | 2 +- gtk/tr-prefs.c | 2 +- libtransmission/session.c | 2 +- libtransmission/transmission.h | 6 ++++++ libtransmission/utils.h | 6 ++++-- macosx/Controller.m | 2 +- 7 files changed, 15 insertions(+), 7 deletions(-) diff --git a/cli/cli.c b/cli/cli.c index 2f1fbffc0..d125ea65f 100644 --- a/cli/cli.c +++ b/cli/cli.c @@ -43,7 +43,7 @@ static int showInfo = 0; static int showScrape = 0; static int isPrivate = 0; static int verboseLevel = 0; -static int encryptionMode = TR_ENCRYPTION_PREFERRED; +static int encryptionMode = TR_DEFAULT_ENCRYPTION; static int peerPort = TR_DEFAULT_PORT; static int peerSocketTOS = TR_DEFAULT_PEER_SOCKET_TOS; static int blocklistEnabled = TR_DEFAULT_BLOCKLIST_ENABLED; diff --git a/daemon/daemon.c b/daemon/daemon.c index 5b4f24efa..f5f8f740e 100644 --- a/daemon/daemon.c +++ b/daemon/daemon.c @@ -218,7 +218,7 @@ session_init( const char * configDir, getConfigStr( dict, KEY_USERNAME, &username, NULL ); getConfigStr( dict, KEY_PASSWORD, &password, NULL ); getConfigInt( dict, KEY_ENCRYPTION, &encryption, - TR_ENCRYPTION_PREFERRED ); + TR_DEFAULT_ENCRYPTION ); /*** **** diff --git a/gtk/tr-prefs.c b/gtk/tr-prefs.c index 90d1c195f..198299a74 100644 --- a/gtk/tr-prefs.c +++ b/gtk/tr-prefs.c @@ -112,7 +112,7 @@ tr_prefs_init_global( void ) pref_flag_set_default ( PREF_KEY_PORT_FORWARDING, TRUE ); pref_flag_set_default ( PREF_KEY_PEX, TR_DEFAULT_PEX_ENABLED ); pref_flag_set_default ( PREF_KEY_ASKQUIT, TRUE ); - pref_flag_set_default ( PREF_KEY_ENCRYPTION, TR_ENCRYPTION_PREFERRED ); + pref_flag_set_default ( PREF_KEY_ENCRYPTION, TR_DEFAULT_ENCRYPTION ); pref_flag_set_default ( PREF_KEY_LAZY_BITFIELD, TR_DEFAULT_LAZY_BITFIELD_ENABLED ); diff --git a/libtransmission/session.c b/libtransmission/session.c index 8ffd73031..4a8bb452a 100644 --- a/libtransmission/session.c +++ b/libtransmission/session.c @@ -314,7 +314,7 @@ tr_sessionInit( const char * configDir, TR_DEFAULT_PEX_ENABLED, TR_DEFAULT_PORT_FORWARDING_ENABLED, -1, /* public port */ - TR_ENCRYPTION_PREFERRED, /* encryption mode */ + TR_DEFAULT_ENCRYPTION, /* encryption mode */ TR_DEFAULT_LAZY_BITFIELD_ENABLED, FALSE, /* use upload speed limit? */ -1, /* upload speed limit */ diff --git a/libtransmission/transmission.h b/libtransmission/transmission.h index 5ffacb70c..91c620fac 100644 --- a/libtransmission/transmission.h +++ b/libtransmission/transmission.h @@ -98,6 +98,12 @@ tr_proxy_type; /** @see tr_sessionInitFull */ #define TR_DEFAULT_CONFIG_DIR tr_getDefaultConfigDir( ) /** @see tr_sessionInitFull */ +#ifdef TR_EMBEDDED + #define TR_DEFAULT_ENCRYPTION TR_CLEAR_PREFERRED +#else + #define TR_DEFAULT_ENCRYPTION TR_ENCRYPTION_PREFERRED +#endif +/** @see tr_sessionInitFull */ #define TR_DEFAULT_PEX_ENABLED 1 /** @see tr_sessionInitFull */ #define TR_DEFAULT_PORT_FORWARDING_ENABLED 0 diff --git a/libtransmission/utils.h b/libtransmission/utils.h index 7bd27d807..f5dfae3df 100644 --- a/libtransmission/utils.h +++ b/libtransmission/utils.h @@ -98,9 +98,11 @@ extern "C" { #endif /* #define DISABLE_GETTEXT */ +#if defined(TR_EMBEDDED) && !defined(DISABLE_GETTEXT) + #define DISABLE_GETTEXT +#endif #ifdef DISABLE_GETTEXT -const char* tr_strip_positional_args( const char* fmt ); - + const char * tr_strip_positional_args( const char * fmt ); #undef _ #define _( a ) tr_strip_positional_args( a ) #endif diff --git a/macosx/Controller.m b/macosx/Controller.m index 676e881b5..ac92564f6 100644 --- a/macosx/Controller.m +++ b/macosx/Controller.m @@ -210,7 +210,7 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy [fDefaults boolForKey: @"PEXGlobal"], [fDefaults boolForKey: @"NatTraversal"], [fDefaults integerForKey: @"BindPort"], - TR_ENCRYPTION_PREFERRED, /* reset in prefs */ + TR_DEFAULT_ENCRYPTION, /* reset in prefs */ TR_DEFAULT_LAZY_BITFIELD_ENABLED, NO, /* reset in prefs */ -1, /* reset in prefs */