From 56e126d8a0c88db0c231855c6f738124dc52eb12 Mon Sep 17 00:00:00 2001 From: rakshasa Date: Sun, 3 Oct 2010 10:47:36 +0000 Subject: [PATCH] * Fixed more redirects to work properly with old webui's. git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@1175 e378c898-3ddf-0310-93e7-cc216c733640 --- src/command_dynamic.cc | 15 +++------ src/command_events.cc | 16 ++------- src/command_helpers.h | 23 ++++++++++--- src/command_local.cc | 31 +++++++++++++----- src/command_network.cc | 35 +++++++++++--------- src/core/download_factory.cc | 4 +-- src/main.cc | 63 ++++++++++++++++++++++++------------ src/rpc/command_map.cc | 1 - src/ui/download.cc | 8 ++--- src/ui/download_list.cc | 4 +-- 10 files changed, 118 insertions(+), 82 deletions(-) diff --git a/src/command_dynamic.cc b/src/command_dynamic.cc index 43346325..6cf4b9d8 100644 --- a/src/command_dynamic.cc +++ b/src/command_dynamic.cc @@ -57,15 +57,6 @@ system_method_generate_command(torrent::Object::list_const_iterator first, torre return command; } -template -inline const char* -create_new_key(const std::string& key, const char postfix[postfix_size]) { - char *buffer = new char[key.size() + std::max(postfix_size, 1)]; - std::memcpy(buffer, key.c_str(), key.size() + 1); - std::memcpy(buffer + key.size(), postfix, postfix_size); - return buffer; -} - // torrent::Object // system_method_insert_function(const torrent::Object::list_type& args, int flags) { @@ -301,8 +292,8 @@ system_method_redirect(const torrent::Object::list_type& args) { std::string new_key = torrent::object_create_string(args.front()); std::string dest_key = torrent::object_create_string(args.back()); - rpc::commands.create_redirect(new_key.c_str(), dest_key.c_str(), - rpc::CommandMap::flag_public_xmlrpc | rpc::CommandMap::flag_delete_key); + rpc::commands.create_redirect(create_new_key<0>(new_key, ""), create_new_key<0>(dest_key, ""), + rpc::CommandMap::flag_public_xmlrpc | rpc::CommandMap::flag_delete_key | rpc::CommandMap::flag_modifiable); return torrent::Object(); } @@ -369,6 +360,8 @@ system_method_list_keys(const torrent::Object::string_type& args) { void initialize_command_dynamic() { + CMD2_VAR_BOOL ("method.use_deprecated", true); + CMD2_ANY_LIST ("method.insert", std::tr1::bind(&system_method_insert, std::tr1::placeholders::_2)); CMD2_ANY_LIST ("method.insert.value", std::tr1::bind(&system_method_insert_object, std::tr1::placeholders::_2, diff --git a/src/command_events.cc b/src/command_events.cc index 74e02a50..87936256 100644 --- a/src/command_events.cc +++ b/src/command_events.cc @@ -64,14 +64,14 @@ apply_on_ratio(const torrent::Object& rawArgs) { const std::string& groupName = rawArgs.as_string(); char buffer[32 + groupName.size()]; - sprintf(buffer, "group.%s.view", groupName.c_str()); + sprintf(buffer, "group2.%s.view", groupName.c_str()); core::ViewManager::iterator viewItr = control->view_manager()->find(rpc::commands.call(buffer, rpc::make_target()).as_string()); if (viewItr == control->view_manager()->end()) throw torrent::input_error("Could not find view."); - char* bufferStart = buffer + sprintf(buffer, "group.%s.ratio.", groupName.c_str()); + char* bufferStart = buffer + sprintf(buffer, "group2.%s.ratio.", groupName.c_str()); // first argument: minimum ratio to reach // second argument: minimum upload amount to reach [optional] @@ -101,7 +101,7 @@ apply_on_ratio(const torrent::Object& rawArgs) { downloads.push_back(*itr); } - std::strcpy(bufferStart, "command"); + sprintf(buffer, "group.%s.ratio.command", groupName.c_str()); for (std::vector::iterator itr = downloads.begin(), last = downloads.end(); itr != last; itr++) { // rpc::commands.call("print", rpc::make_target(*itr), "Calling ratio command."); @@ -328,16 +328,6 @@ initialize_command_events() { CMD2_ANY_STRING_V("import", std::tr1::bind(&apply_import, std::tr1::placeholders::_2)); CMD2_ANY_STRING_V("try_import", std::tr1::bind(&apply_try_import, std::tr1::placeholders::_2)); - // CMD2_ANY_LIST ("load", std::tr1::bind(&apply_load, std::tr1::placeholders::_2, core::Manager::create_quiet | core::Manager::create_tied)); - // CMD2_ANY_LIST ("load_verbose", std::tr1::bind(&apply_load, std::tr1::placeholders::_2, core::Manager::create_tied)); - // CMD2_ANY_LIST ("load_start", std::tr1::bind(&apply_load, std::tr1::placeholders::_2, - // core::Manager::create_quiet | core::Manager::create_tied | core::Manager::create_start)); - // CMD2_ANY_LIST ("load_start_verbose", std::tr1::bind(&apply_load, std::tr1::placeholders::_2, core::Manager::create_tied | core::Manager::create_start)); - // CMD2_ANY_LIST ("load_raw", std::tr1::bind(&apply_load, std::tr1::placeholders::_2, core::Manager::create_quiet | core::Manager::create_raw_data)); - // CMD2_ANY_LIST ("load_raw_verbose", std::tr1::bind(&apply_load, std::tr1::placeholders::_2, core::Manager::create_raw_data)); - // CMD2_ANY_LIST ("load_raw_start", std::tr1::bind(&apply_load, std::tr1::placeholders::_2, - // core::Manager::create_quiet | core::Manager::create_start | core::Manager::create_raw_data)); - CMD2_ANY_LIST ("load.normal", std::tr1::bind(&apply_load, std::tr1::placeholders::_2, core::Manager::create_quiet | core::Manager::create_tied)); CMD2_ANY_LIST ("load.verbose", std::tr1::bind(&apply_load, std::tr1::placeholders::_2, core::Manager::create_tied)); CMD2_ANY_LIST ("load.start", std::tr1::bind(&apply_load, std::tr1::placeholders::_2, diff --git a/src/command_helpers.h b/src/command_helpers.h index 43a178c4..c896c82d 100644 --- a/src/command_helpers.h +++ b/src/command_helpers.h @@ -127,14 +127,16 @@ void initialize_commands(); std::tr1::placeholders::_1, std::tr1::placeholders::_2)); #define CMD2_REDIRECT(from_key, to_key) \ - rpc::commands.create_redirect(from_key, to_key, rpc::CommandMap::flag_public_xmlrpc); + rpc::commands.create_redirect(from_key, to_key, rpc::CommandMap::flag_public_xmlrpc | rpc::CommandMap::flag_dont_delete); #define CMD2_REDIRECT_GENERIC(from_key, to_key) \ - rpc::commands.create_redirect(from_key, to_key, rpc::CommandMap::flag_public_xmlrpc | rpc::CommandMap::flag_no_target); + rpc::commands.create_redirect(from_key, to_key, rpc::CommandMap::flag_public_xmlrpc | rpc::CommandMap::flag_no_target | rpc::CommandMap::flag_dont_delete); #define CMD2_REDIRECT_FILE(from_key, to_key) \ - rpc::commands.create_redirect(from_key, to_key, rpc::CommandMap::flag_public_xmlrpc | rpc::CommandMap::flag_file_target); + rpc::commands.create_redirect(from_key, to_key, rpc::CommandMap::flag_public_xmlrpc | rpc::CommandMap::flag_file_target | rpc::CommandMap::flag_dont_delete); #define CMD2_REDIRECT_TRACKER(from_key, to_key) \ - rpc::commands.create_redirect(from_key, to_key, rpc::CommandMap::flag_public_xmlrpc | rpc::CommandMap::flag_tracker_target); + rpc::commands.create_redirect(from_key, to_key, rpc::CommandMap::flag_public_xmlrpc | rpc::CommandMap::flag_tracker_target | rpc::CommandMap::flag_dont_delete); +#define CMD2_REDIRECT_GENERIC_STR(from_key, to_key) \ + rpc::commands.create_redirect(create_new_key<0>(from_key, ""), create_new_key<0>(to_key, ""), rpc::CommandMap::flag_public_xmlrpc | rpc::CommandMap::flag_no_target | rpc::CommandMap::flag_delete_key); // // Conversion of return types: @@ -165,4 +167,17 @@ template object_convert_type object_convert_void(T f) { return f; } +// +// Key creation: +// + +template +inline const char* +create_new_key(const std::string& key, const char postfix[postfix_size]) { + char *buffer = new char[key.size() + std::max(postfix_size, 1)]; + std::memcpy(buffer, key.c_str(), key.size() + 1); + std::memcpy(buffer + key.size(), postfix, postfix_size); + return buffer; +} + #endif diff --git a/src/command_local.cc b/src/command_local.cc index 0c0890da..102f995d 100644 --- a/src/command_local.cc +++ b/src/command_local.cc @@ -158,14 +158,29 @@ group_insert(const torrent::Object::list_type& args) { const std::string& name = check_name(post_increment(itr, last)->as_string()); const std::string& view = check_name(post_increment(itr, last)->as_string()); - rpc::commands.call("method.insert", rpc::create_object_list("group." + name + ".view", "string", view)); + rpc::commands.call("method.insert", rpc::create_object_list("group2." + name + ".view", "string", view)); - rpc::commands.call("method.insert", rpc::create_object_list("group." + name + ".ratio.enable", "simple", "schedule=group." + name + ".ratio,5,60,on_ratio=" + name)); - rpc::commands.call("method.insert", rpc::create_object_list("group." + name + ".ratio.disable", "simple", "schedule_remove=group." + name + ".ratio")); - rpc::commands.call("method.insert", rpc::create_object_list("group." + name + ".ratio.command", "simple", "d.try_close= ;d.ignore_commands.set=1")); - rpc::commands.call("method.insert", rpc::create_object_list("group." + name + ".ratio.min", "value", (int64_t)200)); - rpc::commands.call("method.insert", rpc::create_object_list("group." + name + ".ratio.max", "value", (int64_t)300)); - rpc::commands.call("method.insert", rpc::create_object_list("group." + name + ".ratio.upload", "value", (int64_t)20 << 20)); + rpc::commands.call("method.insert", rpc::create_object_list("group2." + name + ".ratio.enable", "simple", "schedule2=group." + name + ".ratio,5,60,on_ratio=" + name)); + rpc::commands.call("method.insert", rpc::create_object_list("group2." + name + ".ratio.disable", "simple", "schedule_remove2=group." + name + ".ratio")); + rpc::commands.call("method.insert", rpc::create_object_list("group." + name + ".ratio.command", "simple", "d.try_close= ;d.ignore_commands.set=1")); + rpc::commands.call("method.insert", rpc::create_object_list("group2." + name + ".ratio.min", "value", (int64_t)200)); + rpc::commands.call("method.insert", rpc::create_object_list("group2." + name + ".ratio.max", "value", (int64_t)300)); + rpc::commands.call("method.insert", rpc::create_object_list("group2." + name + ".ratio.upload", "value", (int64_t)20 << 20)); + + if (rpc::call_command_value("method.use_deprecated")) { + // Deprecated in 0.7.0: + + CMD2_REDIRECT_GENERIC_STR("group." + name + ".view", "group2." + name + ".view"); + CMD2_REDIRECT_GENERIC_STR("group." + name + ".view.set", "group2." + name + ".view.set"); + CMD2_REDIRECT_GENERIC_STR("group." + name + ".ratio.enable", "group2." + name + ".ratio.enable"); + CMD2_REDIRECT_GENERIC_STR("group." + name + ".ratio.disable", "group2." + name + ".ratio.disable"); + CMD2_REDIRECT_GENERIC_STR("group." + name + ".ratio.min", "group2." + name + ".ratio.min"); + CMD2_REDIRECT_GENERIC_STR("group." + name + ".ratio.min.set", "group2." + name + ".ratio.min.set"); + CMD2_REDIRECT_GENERIC_STR("group." + name + ".ratio.max", "group2." + name + ".ratio.max"); + CMD2_REDIRECT_GENERIC_STR("group." + name + ".ratio.max.set", "group2." + name + ".ratio.max.set"); + CMD2_REDIRECT_GENERIC_STR("group." + name + ".ratio.upload", "group2." + name + ".ratio.upload"); + CMD2_REDIRECT_GENERIC_STR("group." + name + ".ratio.upload.set", "group2." + name + ".ratio.upload.set"); + } return name; } @@ -283,5 +298,5 @@ initialize_command_local() { CMD2_ANY_P("argument.2", std::tr1::bind(&rpc::command_base::argument_ref, 2)); CMD2_ANY_P("argument.3", std::tr1::bind(&rpc::command_base::argument_ref, 3)); - CMD2_ANY_LIST ("group.insert", std::tr1::bind(&group_insert, std::tr1::placeholders::_2)); + CMD2_ANY_LIST ("group2.insert", std::tr1::bind(&group_insert, std::tr1::placeholders::_2)); } diff --git a/src/command_network.cc b/src/command_network.cc index 0d3e160e..74c29178 100644 --- a/src/command_network.cc +++ b/src/command_network.cc @@ -406,19 +406,22 @@ initialize_command_network() { torrent::FileManager* fileManager = torrent::file_manager(); core::CurlStack* httpStack = control->core()->http_stack(); - CMD2_VAR_BOOL ("protocol.pex", true); CMD2_VAR_BOOL ("log.handshake", false); CMD2_VAR_STRING ("log.tracker", ""); - CMD2_ANY_STRING ("encoding_list", std::tr1::bind(&apply_encoding_list, std::tr1::placeholders::_2)); + // CMD2_ANY_STRING ("encoding_list", std::tr1::bind(&apply_encoding_list, std::tr1::placeholders::_2)); + CMD2_ANY_STRING ("encoding.add", std::tr1::bind(&apply_encoding_list, std::tr1::placeholders::_2)); // Isn't port_open used? - CMD2_VAR_BOOL ("network.port_open", true); - CMD2_VAR_BOOL ("network.port_random", true); - CMD2_VAR_STRING("network.port_range", "6881-6999"); + CMD2_VAR_BOOL ("network.port_open", true); + CMD2_VAR_BOOL ("network.port_random", true); + CMD2_VAR_STRING ("network.port_range", "6881-6999"); - CMD2_VAR_STRING("connection_leech", "leech"); - CMD2_VAR_STRING("connection_seed", "seed"); + CMD2_VAR_BOOL ("protocol.pex", true); + CMD2_ANY_LIST ("protocol.encryption.set", std::tr1::bind(&apply_encryption, std::tr1::placeholders::_2)); + + CMD2_VAR_STRING ("protocol.connection.leech", "leech"); + CMD2_VAR_STRING ("protocol.connection.seed", "seed"); CMD2_ANY ("throttle.unchoked_uploads", std::tr1::bind(&torrent::currently_unchoked)); CMD2_ANY ("throttle.unchoked_downloads", std::tr1::bind(&torrent::download_unchoked)); @@ -447,16 +450,16 @@ initialize_command_network() { CMD2_ANY_VALUE_V ("throttle.global_down.max_rate.set", std::tr1::bind(&ui::Root::set_down_throttle_i64, control->ui(), std::tr1::placeholders::_2)); CMD2_ANY_VALUE_KB("throttle.global_down.max_rate.set_kb", std::tr1::bind(&ui::Root::set_down_throttle_i64, control->ui(), std::tr1::placeholders::_2)); - CMD2_ANY_LIST("throttle_up", std::tr1::bind(&apply_throttle, std::tr1::placeholders::_2, true)); - CMD2_ANY_LIST("throttle_down", std::tr1::bind(&apply_throttle, std::tr1::placeholders::_2, false)); - CMD2_ANY_LIST("throttle_ip", std::tr1::bind(&apply_address_throttle, std::tr1::placeholders::_2)); + // Temporary names, need to change this to accept real rates rather + // than kB. + CMD2_ANY_LIST ("throttle.up", std::tr1::bind(&apply_throttle, std::tr1::placeholders::_2, true)); + CMD2_ANY_LIST ("throttle.down", std::tr1::bind(&apply_throttle, std::tr1::placeholders::_2, false)); + CMD2_ANY_LIST ("throttle.ip", std::tr1::bind(&apply_address_throttle, std::tr1::placeholders::_2)); - CMD2_ANY_STRING("get_throttle_up_max", std::tr1::bind(&retrieve_throttle_info, std::tr1::placeholders::_2, throttle_info_up | throttle_info_max)); - CMD2_ANY_STRING("get_throttle_up_rate", std::tr1::bind(&retrieve_throttle_info, std::tr1::placeholders::_2, throttle_info_up | throttle_info_rate)); - CMD2_ANY_STRING("get_throttle_down_max", std::tr1::bind(&retrieve_throttle_info, std::tr1::placeholders::_2, throttle_info_down | throttle_info_max)); - CMD2_ANY_STRING("get_throttle_down_rate", std::tr1::bind(&retrieve_throttle_info, std::tr1::placeholders::_2, throttle_info_down | throttle_info_rate)); - - CMD2_ANY_LIST("encryption", std::tr1::bind(&apply_encryption, std::tr1::placeholders::_2)); + CMD2_ANY_STRING ("throttle.up.max", std::tr1::bind(&retrieve_throttle_info, std::tr1::placeholders::_2, throttle_info_up | throttle_info_max)); + CMD2_ANY_STRING ("throttle.up.rate", std::tr1::bind(&retrieve_throttle_info, std::tr1::placeholders::_2, throttle_info_up | throttle_info_rate)); + CMD2_ANY_STRING ("throttle.down.max", std::tr1::bind(&retrieve_throttle_info, std::tr1::placeholders::_2, throttle_info_down | throttle_info_max)); + CMD2_ANY_STRING ("throttle.down.rate", std::tr1::bind(&retrieve_throttle_info, std::tr1::placeholders::_2, throttle_info_down | throttle_info_rate)); CMD2_ANY ("network.http.capath", std::tr1::bind(&core::CurlStack::http_capath, httpStack)); CMD2_ANY_STRING_V("network.http.capath.set", std::tr1::bind(&core::CurlStack::set_http_capath, httpStack, std::tr1::placeholders::_2)); diff --git a/src/core/download_factory.cc b/src/core/download_factory.cc index 30e022c0..656794c6 100644 --- a/src/core/download_factory.cc +++ b/src/core/download_factory.cc @@ -108,8 +108,8 @@ DownloadFactory::DownloadFactory(Manager* m) : m_taskLoad.set_slot(rak::mem_fn(this, &DownloadFactory::receive_load)); m_taskCommit.set_slot(rak::mem_fn(this, &DownloadFactory::receive_commit)); - m_variables["connection_leech"] = rpc::call_command_void("connection_leech"); - m_variables["connection_seed"] = rpc::call_command_void("connection_seed"); + m_variables["connection_leech"] = rpc::call_command_void("protocol.connection.leech"); + m_variables["connection_seed"] = rpc::call_command_void("protocol.connection.seed"); m_variables["directory"] = rpc::call_command_void("directory.default"); m_variables["tied_to_file"] = torrent::Object((int64_t)false); } diff --git a/src/main.cc b/src/main.cc index ba6ffaec..8cbe9cf1 100644 --- a/src/main.cc +++ b/src/main.cc @@ -98,6 +98,9 @@ parse_options(Control* c, int argc, char** argv) { optionParser.insert_option('O', sigc::ptr_fun(&rpc::parse_command_single_std)); optionParser.insert_option_list('o', sigc::ptr_fun(&rpc::call_command_set_std_string)); + if (OptionParser::has_flag('D', argc, argv)) + rpc::call_command_set_value("method.use_deprecated", false); + return optionParser.process(argc, argv); } catch (torrent::input_error& e) { @@ -194,7 +197,7 @@ main(int argc, char** argv) { // "method.insert = test.value2,value,6\n" // "method.insert = test.string,string,6\n" -// "method.insert = test.bool,bool,true\n" +// "method.insert = test.bool,bool,true\n" "method.insert = test.method.simple,simple,\"print=simple_test_,$argument.0=\"\n" @@ -221,10 +224,10 @@ main(int argc, char** argv) { "method.set_key = event.download.erased, !_download_list, ui.unfocus_download=\n" "method.set_key = event.download.erased, ~_delete_tied, d.delete_tied=\n" - "method.insert = group.insert_persistent_view,simple|const," - "view.add=$argument.0=,view.persistent=$argument.0=,\"group.insert=$argument.0=,$argument.0=\"\n" + "method.insert = group2.insert_persistent_view,simple|const," + "view.add=$argument.0=,view.persistent=$argument.0=,\"group2.insert=$argument.0=,$argument.0=\"\n" - // Allow setting 'group.view' as constant, so that we can't + // Allow setting 'group2.view' as constant, so that we can't // modify the value. And look into the possibility of making // 'const' use non-heap memory, as we know they can't be // erased. @@ -232,7 +235,7 @@ main(int argc, char** argv) { // TODO: Remember to ensure it doesn't get restarted by watch // dir, etc. Set ignore commands, or something. - "group.insert = seeding,seeding\n" + "group2.insert = seeding,seeding\n" "system.session_name = \"$cat=$system.hostname=,:,$system.pid=\"\n" @@ -291,7 +294,7 @@ main(int argc, char** argv) { "schedule = low_diskspace,5,60,close_low_diskspace=500M\n" "schedule = prune_file_status,3600,86400,system.file_status_cache.prune=\n" - "encryption=allow_incoming,prefer_plaintext,enable_retry\n" + "protocol.encryption.set=allow_incoming,prefer_plaintext,enable_retry\n" ); // Functions that might not get depracted as they are nice for @@ -300,14 +303,20 @@ main(int argc, char** argv) { CMD2_REDIRECT_GENERIC("upload_rate", "throttle.global_up.max_rate.set_kb"); CMD2_REDIRECT_GENERIC("download_rate", "throttle.global_down.max_rate.set_kb"); - CMD2_REDIRECT_GENERIC("ratio.enable", "group.seeding.ratio.enable"); - CMD2_REDIRECT_GENERIC("ratio.disable", "group.seeding.ratio.disable"); - CMD2_REDIRECT_GENERIC("ratio.min", "group.seeding.ratio.min"); - CMD2_REDIRECT_GENERIC("ratio.max", "group.seeding.ratio.max"); - CMD2_REDIRECT_GENERIC("ratio.upload", "group.seeding.ratio.upload"); - CMD2_REDIRECT_GENERIC("ratio.min.set", "group.seeding.ratio.min.set"); - CMD2_REDIRECT_GENERIC("ratio.max.set", "group.seeding.ratio.max.set"); - CMD2_REDIRECT_GENERIC("ratio.upload.set", "group.seeding.ratio.upload.set"); + CMD2_REDIRECT_GENERIC("ratio.enable", "group2.seeding.ratio.enable"); + CMD2_REDIRECT_GENERIC("ratio.disable", "group2.seeding.ratio.disable"); + CMD2_REDIRECT_GENERIC("ratio.min", "group2.seeding.ratio.min"); + CMD2_REDIRECT_GENERIC("ratio.max", "group2.seeding.ratio.max"); + CMD2_REDIRECT_GENERIC("ratio.upload", "group2.seeding.ratio.upload"); + CMD2_REDIRECT_GENERIC("ratio.min.set", "group2.seeding.ratio.min.set"); + CMD2_REDIRECT_GENERIC("ratio.max.set", "group2.seeding.ratio.max.set"); + CMD2_REDIRECT_GENERIC("ratio.upload.set", "group2.seeding.ratio.upload.set"); + + CMD2_REDIRECT_GENERIC("encryption", "protocol.encryption.set"); + CMD2_REDIRECT_GENERIC("encoding_list", "encoding.add"); + + CMD2_REDIRECT_GENERIC("connection_leech", "protocol.connection.leech.set"); + CMD2_REDIRECT_GENERIC("connection_seed", "protocol.connection.seed.set"); CMD2_REDIRECT ("min_peers", "throttle.min_peers.normal.set"); CMD2_REDIRECT ("max_peers", "throttle.max_peers.normal.set"); @@ -328,13 +337,13 @@ main(int argc, char** argv) { CMD2_REDIRECT ("port_random", "network.port_random.set"); CMD2_REDIRECT ("proxy_address", "network.proxy_address.set"); - CMD2_REDIRECT ("directory", "directory.default.set"); + CMD2_REDIRECT_GENERIC("directory", "directory.default.set"); CMD2_REDIRECT_GENERIC("execute", "execute2"); // Deprecated commands. Don't use these anymore. - if (!OptionParser::has_flag('D', argc, argv)) { + if (rpc::call_command_value("method.use_deprecated")) { // Deprecated in 0.7.0: CMD2_REDIRECT_GENERIC("system.method.insert", "method.insert"); @@ -345,6 +354,9 @@ main(int argc, char** argv) { CMD2_REDIRECT_GENERIC("system.method.has_key", "method.has_key"); CMD2_REDIRECT_GENERIC("system.method.set_key", "method.set_key"); + CMD2_REDIRECT_GENERIC("group.insert", "group2.insert"); + CMD2_REDIRECT_GENERIC("group.insert_persistent_view", "group2.insert_persistent_view"); + CMD2_REDIRECT ("get_handshake_log", "log.handshake"); CMD2_REDIRECT_GENERIC("set_handshake_log", "log.handshake.set"); CMD2_REDIRECT ("get_log.tracker", "log.tracker"); @@ -394,10 +406,24 @@ main(int argc, char** argv) { CMD2_REDIRECT_GENERIC("load_raw_start", "load.raw_start"); CMD2_REDIRECT_GENERIC("load_raw_verbose", "load.raw_verbose"); + CMD2_REDIRECT_GENERIC("get_connection_leech", "protocol.connection.leech"); + CMD2_REDIRECT_GENERIC("get_connection_seed", "protocol.connection.seed"); + CMD2_REDIRECT_GENERIC("set_connection_leech", "protocol.connection.leech.set"); + CMD2_REDIRECT_GENERIC("set_connection_seed", "protocol.connection.seed.set"); + // // Throttle: // + CMD2_REDIRECT_GENERIC("throttle_up", "throttle.up"); + CMD2_REDIRECT_GENERIC("throttle_down", "throttle.down"); + CMD2_REDIRECT_GENERIC("throttle_ip", "throttle.ip"); + + CMD2_REDIRECT_GENERIC("get_throttle_up_max", "throttle.up.max"); + CMD2_REDIRECT_GENERIC("get_throttle_up_rate", "throttle.up.rate"); + CMD2_REDIRECT_GENERIC("get_throttle_down_max", "throttle.down.max"); + CMD2_REDIRECT_GENERIC("get_throttle_down_rate", "throttle.down.rate"); + CMD2_REDIRECT_GENERIC("set_min_peers", "throttle.min_peers.normal.set"); CMD2_REDIRECT_GENERIC("set_max_peers", "throttle.max_peers.normal.set"); CMD2_REDIRECT_GENERIC("set_min_peers_seed", "throttle.min_peers.seed.set"); @@ -501,11 +527,6 @@ main(int argc, char** argv) { CMD2_REDIRECT ("get_http_proxy", "network.http.proxy_address"); CMD2_REDIRECT_GENERIC("set_http_proxy", "network.http.proxy_address.set"); - CMD2_REDIRECT ("get_connection_leech", "connection_leech"); - CMD2_REDIRECT_GENERIC("set_connection_leech", "connection_leech.set"); - CMD2_REDIRECT ("get_connection_seed", "connection_seed"); - CMD2_REDIRECT_GENERIC("set_connection_seed", "connection_seed.set"); - CMD2_REDIRECT ("peer_exchange", "protocol.pex.set"); CMD2_REDIRECT ("get_peer_exchange", "protocol.pex"); CMD2_REDIRECT_GENERIC("set_peer_exchange", "protocol.pex.set"); diff --git a/src/rpc/command_map.cc b/src/rpc/command_map.cc index a4c7579e..18222c2b 100644 --- a/src/rpc/command_map.cc +++ b/src/rpc/command_map.cc @@ -133,7 +133,6 @@ CommandMap::create_redirect(key_type key_new, key_type key_dest, int flags) { dest_itr->second.m_flags |= flag_has_redirects; - flags |= flag_dont_delete; flags |= dest_itr->second.m_flags & ~(flag_delete_key | flag_has_redirects); iterator itr = base_type::insert(base_type::end(), diff --git a/src/ui/download.cc b/src/ui/download.cc index faf86064..4854e24f 100644 --- a/src/ui/download.cc +++ b/src/ui/download.cc @@ -184,10 +184,10 @@ Download::create_info() { // TODO: Define a custom command for this and use $argument.0 instead of looking up the name multiple times? element->push_column("Throttle:", te_command("branch=d.throttle_name=,\"" "cat=$d.throttle_name=,\\\" [Max \\\"," - "$convert.throttle=$get_throttle_up_max=$d.throttle_name=,\\\"/\\\"," - "$convert.throttle=$get_throttle_down_max=$d.throttle_name=,\\\" KB] [Rate \\\"," - "$convert.kb=$get_throttle_up_rate=$d.throttle_name=,\\\"/\\\"," - "$convert.kb=$get_throttle_down_rate=$d.throttle_name=,\\\" KB]\\\"\"," + "$convert.throttle=$throttle.up.max=$d.throttle_name=,\\\"/\\\"," + "$convert.throttle=$throttle.down.max=$d.throttle_name=,\\\" KB] [Rate \\\"," + "$convert.kb=$throttle.up.rate=$d.throttle_name=,\\\"/\\\"," + "$convert.kb=$throttle.down.rate=$d.throttle_name=,\\\" KB]\\\"\"," "cat=\"global\"")); element->push_back(""); diff --git a/src/ui/download_list.cc b/src/ui/download_list.cc index 0270eaa3..6c3c0c67 100644 --- a/src/ui/download_list.cc +++ b/src/ui/download_list.cc @@ -244,11 +244,11 @@ DownloadList::receive_view_input(Input type) { switch (type) { case INPUT_LOAD_DEFAULT: - title = "load_start"; + title = "load.start"; break; case INPUT_LOAD_MODIFIED: - title = "load"; + title = "load.normal"; break; case INPUT_CHANGE_DIRECTORY: