From e4e73aeee9e584c959bea5680bc5830275a0b18b Mon Sep 17 00:00:00 2001 From: rakshasa Date: Fri, 16 May 2014 01:14:47 +0900 Subject: [PATCH] Set deprecated commands to be off by default. If needed use the '-D' option, however note that they will be removed permanently in the future. --- src/command_dynamic.cc | 2 +- src/main.cc | 26 ++++++++++++++------------ 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/src/command_dynamic.cc b/src/command_dynamic.cc index 7ec16fb4..6c600d09 100644 --- a/src/command_dynamic.cc +++ b/src/command_dynamic.cc @@ -438,7 +438,7 @@ cmd_catch(rpc::target_type target, const torrent::Object& args) { void initialize_command_dynamic() { - CMD2_VAR_BOOL ("method.use_deprecated", true); + CMD2_VAR_BOOL ("method.use_deprecated", false); CMD2_VAR_VALUE ("method.use_intermediate", 1); CMD2_ANY_LIST ("method.insert", tr1::bind(&system_method_insert, tr1::placeholders::_2)); diff --git a/src/main.cc b/src/main.cc index 5e826bb1..fa5a5bff 100644 --- a/src/main.cc +++ b/src/main.cc @@ -230,7 +230,7 @@ main(int argc, char** argv) { initialize_commands(); if (OptionParser::has_flag('D', argc, argv)) { - rpc::call_command_set_value("method.use_deprecated.set", false); + rpc::call_command_set_value("method.use_deprecated.set", true); lt_log_print(torrent::LOG_WARN, "Disabled deprecated commands."); } @@ -397,8 +397,20 @@ main(int argc, char** argv) { CMD2_REDIRECT_GENERIC("directory", "directory.default.set"); CMD2_REDIRECT_GENERIC("session", "session.path.set"); + CMD2_REDIRECT ("check_hash", "pieces.hash.on_completion.set"); + CMD2_REDIRECT ("key_layout", "keys.layout.set"); + CMD2_REDIRECT_GENERIC("to_gm_time", "convert.gm_time"); + CMD2_REDIRECT_GENERIC("to_gm_date", "convert.gm_date"); + CMD2_REDIRECT_GENERIC("to_time", "convert.time"); + CMD2_REDIRECT_GENERIC("to_date", "convert.date"); + CMD2_REDIRECT_GENERIC("to_elapsed_time", "convert.elapsed_time"); + CMD2_REDIRECT_GENERIC("to_kb", "convert.kb"); + CMD2_REDIRECT_GENERIC("to_mb", "convert.mb"); + CMD2_REDIRECT_GENERIC("to_xb", "convert.xb"); + CMD2_REDIRECT_GENERIC("to_throttle", "convert.throttle"); + // Deprecated commands. Don't use these anymore. if (rpc::call_command_value("method.use_intermediate") == 1) { @@ -634,7 +646,6 @@ main(int argc, char** argv) { CMD2_REDIRECT ("get_session_on_completion", "session.on_completion"); CMD2_REDIRECT_GENERIC("set_session_on_completion", "session.on_completion.set"); - CMD2_REDIRECT ("check_hash", "pieces.hash.on_completion.set"); CMD2_REDIRECT ("get_check_hash", "pieces.hash.on_completion"); CMD2_REDIRECT_GENERIC("set_check_hash", "pieces.hash.on_completion.set"); @@ -809,16 +820,6 @@ main(int argc, char** argv) { // Rename these to avoid conflicts with old style. CMD2_REDIRECT_GENERIC("d.multicall", "d.multicall2"); - CMD2_REDIRECT_GENERIC("to_gm_time", "convert.gm_time"); - CMD2_REDIRECT_GENERIC("to_gm_date", "convert.gm_date"); - CMD2_REDIRECT_GENERIC("to_time", "convert.time"); - CMD2_REDIRECT_GENERIC("to_date", "convert.date"); - CMD2_REDIRECT_GENERIC("to_elapsed_time", "convert.elapsed_time"); - CMD2_REDIRECT_GENERIC("to_kb", "convert.kb"); - CMD2_REDIRECT_GENERIC("to_mb", "convert.mb"); - CMD2_REDIRECT_GENERIC("to_xb", "convert.xb"); - CMD2_REDIRECT_GENERIC("to_throttle", "convert.throttle"); - CMD2_REDIRECT_GENERIC("execute_throw", "execute.throw"); CMD2_REDIRECT_GENERIC("execute_nothrow", "execute.nothrow"); CMD2_REDIRECT_GENERIC("execute_raw", "execute.raw"); @@ -1002,6 +1003,7 @@ print_help() { std::cout << "order. Use the up/down/left/right arrow keys to move between screens." << std::endl; std::cout << std::endl; std::cout << "Usage: rtorrent [OPTIONS]... [FILE]... [URL]..." << std::endl; + std::cout << " -D Enable deprecated commands" << std::endl; std::cout << " -h Display this very helpful text" << std::endl; std::cout << " -n Don't try to load ~/.rtorrent.rc on startup" << std::endl; std::cout << " -b Bind the listening socket to this IP" << std::endl;