From 44e77016a92662ca22a323e0a5d905d6731bb91e Mon Sep 17 00:00:00 2001 From: rakshasa Date: Wed, 3 Mar 2010 13:45:34 +0000 Subject: [PATCH] * Renamed 'system.method.*' to 'method.*'. git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@1139 e378c898-3ddf-0310-93e7-cc216c733640 --- src/command_dynamic.cc | 32 ++++++------ src/command_events.cc | 4 +- src/command_local.cc | 28 +++++----- src/command_network.cc | 4 +- src/command_object.cc | 4 +- src/command_scheduler.cc | 2 +- src/core/view.cc | 4 +- src/main.cc | 108 ++++++++++++++++++++------------------- 8 files changed, 95 insertions(+), 91 deletions(-) diff --git a/src/command_dynamic.cc b/src/command_dynamic.cc index 68348320..973e2d2d 100644 --- a/src/command_dynamic.cc +++ b/src/command_dynamic.cc @@ -66,14 +66,14 @@ create_new_key(const std::string& key, const char postfix[postfix_size]) { return buffer; } -// system.method.insert {name, "simple|private|const", ...} -// system.method.insert {name, "multi|private|const"} -// system.method.insert {name, "value|private|const"} -// system.method.insert {name, "value|private|const", value} -// system.method.insert {name, "bool|private|const"} -// system.method.insert {name, "bool|private|const", bool} -// system.method.insert {name, "string|private|const"} -// system.method.insert {name, "string|private|const", string} +// method.insert {name, "simple|private|const", ...} +// method.insert {name, "multi|private|const"} +// method.insert {name, "value|private|const"} +// method.insert {name, "value|private|const", value} +// method.insert {name, "bool|private|const"} +// method.insert {name, "bool|private|const", bool} +// method.insert {name, "string|private|const"} +// method.insert {name, "string|private|const", string} // // Add a new user-defined method called 'name' and any number of // lines. @@ -172,7 +172,7 @@ system_method_insert(__UNUSED rpc::target_type target, const torrent::Object& ra return torrent::Object(); } -// system.method.erase <> {name} +// method.erase <> {name} // // Erase a modifiable method called 'name. Trying to remove methods // that aren't modifiable, e.g. defined by rtorrent or set to @@ -284,11 +284,11 @@ system_method_list_keys(__UNUSED rpc::target_type target, const torrent::Object& void initialize_command_dynamic() { - CMD_N ("system.method.insert", rak::ptr_fn(&system_method_insert)); - CMD_N_STRING("system.method.erase", rak::ptr_fn(&system_method_erase)); - CMD_N_STRING("system.method.get", rak::ptr_fn(&system_method_get)); - CMD_N ("system.method.set", rak::ptr_fn(&system_method_set)); - CMD_N ("system.method.set_key", rak::ptr_fn(&system_method_set_key)); - CMD_N ("system.method.has_key", rak::ptr_fn(&system_method_has_key)); - CMD_N_STRING("system.method.list_keys", rak::ptr_fn(&system_method_list_keys)); + CMD_N ("method.insert", rak::ptr_fn(&system_method_insert)); + CMD_N_STRING("method.erase", rak::ptr_fn(&system_method_erase)); + CMD_N_STRING("method.get", rak::ptr_fn(&system_method_get)); + CMD_N ("method.set", rak::ptr_fn(&system_method_set)); + CMD_N ("method.set_key", rak::ptr_fn(&system_method_set_key)); + CMD_N ("method.has_key", rak::ptr_fn(&system_method_has_key)); + CMD_N_STRING("method.list_keys", rak::ptr_fn(&system_method_list_keys)); } diff --git a/src/command_events.cc b/src/command_events.cc index 233a77a0..8bf1a4e5 100644 --- a/src/command_events.cc +++ b/src/command_events.cc @@ -331,8 +331,8 @@ initialize_command_events() { ADD_VARIABLE_BOOL("check_hash", true); // Rename - rpc::commands.call("system.method.insert", rpc::create_object_list("system.session.use_lock", "bool|const", true)); - rpc::commands.call("system.method.insert", rpc::create_object_list("system.session.on_completion", "bool|const", true)); + rpc::commands.call("method.insert", rpc::create_object_list("system.session.use_lock", "bool|const", true)); + rpc::commands.call("method.insert", rpc::create_object_list("system.session.on_completion", "bool|const", true)); ADD_COMMAND_STRING("on_ratio", rak::ptr_fn(&apply_on_ratio)); diff --git a/src/command_local.cc b/src/command_local.cc index a07bc8a3..293ec255 100644 --- a/src/command_local.cc +++ b/src/command_local.cc @@ -155,14 +155,14 @@ group_insert(__UNUSED rpc::target_type target, const torrent::Object& rawArgs) { 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("system.method.insert", rpc::create_object_list("group." + name + ".view", "string", view)); + rpc::commands.call("method.insert", rpc::create_object_list("group." + name + ".view", "string", view)); - rpc::commands.call("system.method.insert", rpc::create_object_list("group." + name + ".ratio.enable", "simple", "schedule=group." + name + ".ratio,5,60,on_ratio=" + name)); - rpc::commands.call("system.method.insert", rpc::create_object_list("group." + name + ".ratio.disable", "simple", "schedule_remove=group." + name + ".ratio")); - rpc::commands.call("system.method.insert", rpc::create_object_list("group." + name + ".ratio.command", "simple", "d.try_close= ;d.set_ignore_commands=1")); - rpc::commands.call("system.method.insert", rpc::create_object_list("group." + name + ".ratio.min", "value", (int64_t)200)); - rpc::commands.call("system.method.insert", rpc::create_object_list("group." + name + ".ratio.max", "value", (int64_t)300)); - rpc::commands.call("system.method.insert", rpc::create_object_list("group." + name + ".ratio.upload", "value", (int64_t)20 << 20)); + 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.set_ignore_commands=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)); return name; } @@ -176,13 +176,13 @@ initialize_command_local() { ADD_COMMAND_VOID("system.hostname", rak::ptr_fun(&system_hostname)); ADD_COMMAND_VOID("system.pid", rak::ptr_fun(&getpid)); - rpc::commands.call("system.method.insert", rpc::create_object_list("system.client_version", "string|static|const", PACKAGE_VERSION)); - rpc::commands.call("system.method.insert", rpc::create_object_list("system.library_version", "string|static|const", torrent::version())); - rpc::commands.call("system.method.insert", rpc::create_object_list("system.file.allocate", "value|const", (int64_t)0)); - rpc::commands.call("system.method.insert", rpc::create_object_list("system.file.max_size", "value|const", -1)); - rpc::commands.call("system.method.insert", rpc::create_object_list("system.file.split_size", "value|const", -1)); - rpc::commands.call("system.method.insert", rpc::create_object_list("system.file.split_suffix", "string|const", ".part")); - rpc::commands.call("system.method.insert", rpc::create_object_list("system.session_name", "string|const", "")); + rpc::commands.call("method.insert", rpc::create_object_list("system.client_version", "string|static|const", PACKAGE_VERSION)); + rpc::commands.call("method.insert", rpc::create_object_list("system.library_version", "string|static|const", torrent::version())); + rpc::commands.call("method.insert", rpc::create_object_list("system.file.allocate", "value|const", (int64_t)0)); + rpc::commands.call("method.insert", rpc::create_object_list("system.file.max_size", "value|const", -1)); + rpc::commands.call("method.insert", rpc::create_object_list("system.file.split_size", "value|const", -1)); + rpc::commands.call("method.insert", rpc::create_object_list("system.file.split_suffix", "string|const", ".part")); + rpc::commands.call("method.insert", rpc::create_object_list("system.session_name", "string|const", "")); ADD_COMMAND_VOID("system.file_status_cache.size", rak::make_mem_fun((utils::FileStatusCache::base_type*)control->core()->file_status_cache(), &utils::FileStatusCache::size)); diff --git a/src/command_network.cc b/src/command_network.cc index 4a9226fe..4aa52894 100644 --- a/src/command_network.cc +++ b/src/command_network.cc @@ -491,6 +491,6 @@ initialize_command_network() { ADD_VARIABLE_BOOL("peer_exchange", true); - rpc::commands.call("system.method.insert", rpc::create_object_list("log.handshake", "bool|const", int64_t())); - rpc::commands.call("system.method.insert", rpc::create_object_list("log.tracker", "string|const", "")); + rpc::commands.call("method.insert", rpc::create_object_list("log.handshake", "bool|const", int64_t())); + rpc::commands.call("method.insert", rpc::create_object_list("log.tracker", "string|const", "")); } diff --git a/src/command_object.cc b/src/command_object.cc index d87c888c..9b60d223 100644 --- a/src/command_object.cc +++ b/src/command_object.cc @@ -49,6 +49,6 @@ void initialize_command_object() { -// CMD_N ("system.method.insert", rak::ptr_fn(&system_method_insert)); -// CMD_N_STRING("system.method.erase", rak::ptr_fn(&system_method_erase)); +// CMD_N ("method.insert", rak::ptr_fn(&system_method_insert)); +// CMD_N_STRING("method.erase", rak::ptr_fn(&system_method_erase)); } diff --git a/src/command_scheduler.cc b/src/command_scheduler.cc index 0566e70a..a8a42318 100644 --- a/src/command_scheduler.cc +++ b/src/command_scheduler.cc @@ -118,7 +118,7 @@ initialize_command_scheduler() { // CMD_G("scheduler.active", rak::bind_ptr_fn(&cmd_call, "view.size=active")); - rpc::commands.call("system.method.insert", rpc::create_object_list("scheduler.max_active", "value", (int64_t)-1)); + rpc::commands.call("method.insert", rpc::create_object_list("scheduler.max_active", "value", (int64_t)-1)); CMD_D_ANY("scheduler.simple.added", rak::ptr_fn(&cmd_scheduler_simple_added)); CMD_D_ANY("scheduler.simple.removed", rak::ptr_fn(&cmd_scheduler_simple_removed)); diff --git a/src/core/view.cc b/src/core/view.cc index aad85b17..092a33b8 100644 --- a/src/core/view.cc +++ b/src/core/view.cc @@ -294,7 +294,7 @@ View::set_filter_on_event(const std::string& event) { if (std::find(m_events.begin(), m_events.end(), event) != m_events.end()) return; - rpc::commands.call_catch("system.method.set_key", rpc::make_target(), rpc::create_object_list(event, "!view_" + m_name, "view.filter_download=" + m_name)); + rpc::commands.call_catch("method.set_key", rpc::make_target(), rpc::create_object_list(event, "!view_" + m_name, "view.filter_download=" + m_name)); m_events.push_back(event); } @@ -303,7 +303,7 @@ View::clear_filter_on() { // Don't clear insert and erase as these are required to keep the // View up-to-date with the available downloads. for (event_list_type::const_iterator itr = m_events.begin(); itr != m_events.end(); itr++) - rpc::commands.call_catch("system.method.set_key", rpc::make_target(), rpc::create_object_list(*itr, "!view_" + m_name)); + rpc::commands.call_catch("method.set_key", rpc::make_target(), rpc::create_object_list(*itr, "!view_" + m_name)); } inline void diff --git a/src/main.cc b/src/main.cc index 6d63b7b1..7c27bf59 100644 --- a/src/main.cc +++ b/src/main.cc @@ -188,47 +188,47 @@ main(int argc, char** argv) { rpc::parse_command_multiple (rpc::make_target(), -// "system.method.insert = test.value,value\n" -// "system.method.insert = test.value2,value,6\n" +// "method.insert = test.value,value\n" +// "method.insert = test.value2,value,6\n" -// "system.method.insert = test.string,string,6\n" -// "system.method.insert = test.bool,bool,true\n" +// "method.insert = test.string,string,6\n" +// "method.insert = test.bool,bool,true\n" - "system.method.insert = test.method.simple,simple,\"print=simple_test_,$argument.0=\"\n" + "method.insert = test.method.simple,simple,\"print=simple_test_,$argument.0=\"\n" - "system.method.insert = event.download.inserted,multi\n" - "system.method.insert = event.download.inserted_new,multi\n" - "system.method.insert = event.download.inserted_session,multi\n" - "system.method.insert = event.download.erased,multi\n" - "system.method.insert = event.download.opened,multi\n" - "system.method.insert = event.download.closed,multi\n" - "system.method.insert = event.download.resumed,multi\n" - "system.method.insert = event.download.paused,multi\n" + "method.insert = event.download.inserted,multi\n" + "method.insert = event.download.inserted_new,multi\n" + "method.insert = event.download.inserted_session,multi\n" + "method.insert = event.download.erased,multi\n" + "method.insert = event.download.opened,multi\n" + "method.insert = event.download.closed,multi\n" + "method.insert = event.download.resumed,multi\n" + "method.insert = event.download.paused,multi\n" - "system.method.insert = event.download.finished,multi\n" - "system.method.insert = event.download.hash_done,multi\n" - "system.method.insert = event.download.hash_failed,multi\n" - "system.method.insert = event.download.hash_final_failed,multi\n" - "system.method.insert = event.download.hash_removed,multi\n" - "system.method.insert = event.download.hash_queued,multi\n" + "method.insert = event.download.finished,multi\n" + "method.insert = event.download.hash_done,multi\n" + "method.insert = event.download.hash_failed,multi\n" + "method.insert = event.download.hash_final_failed,multi\n" + "method.insert = event.download.hash_removed,multi\n" + "method.insert = event.download.hash_queued,multi\n" - "system.method.set_key = event.download.inserted, 1_connect_logs, d.initialize_logs=\n" - "system.method.set_key = event.download.inserted_new, 1_prepare, \"branch=d.get_state=,view.set_visible=started,view.set_visible=stopped ;d.save_full_session=\"\n" - "system.method.set_key = event.download.inserted_session, 1_prepare, \"branch=d.get_state=,view.set_visible=started,view.set_visible=stopped\"\n" + "method.set_key = event.download.inserted, 1_connect_logs, d.initialize_logs=\n" + "method.set_key = event.download.inserted_new, 1_prepare, \"branch=d.get_state=,view.set_visible=started,view.set_visible=stopped ;d.save_full_session=\"\n" + "method.set_key = event.download.inserted_session, 1_prepare, \"branch=d.get_state=,view.set_visible=started,view.set_visible=stopped\"\n" - "system.method.set_key = event.download.erased, !_download_list, ui.unfocus_download=\n" - "system.method.set_key = event.download.erased, ~_delete_tied, d.delete_tied=\n" + "method.set_key = event.download.erased, !_download_list, ui.unfocus_download=\n" + "method.set_key = event.download.erased, ~_delete_tied, d.delete_tied=\n" - "system.method.insert = ratio.enable, simple|const,group.seeding.ratio.enable=\n" - "system.method.insert = ratio.disable,simple|const,group.seeding.ratio.disable=\n" - "system.method.insert = ratio.min, simple|const,group.seeding.ratio.min=\n" - "system.method.insert = ratio.max, simple|const,group.seeding.ratio.max=\n" - "system.method.insert = ratio.upload, simple|const,group.seeding.ratio.upload=\n" - "system.method.insert = ratio.min.set, simple|const,group.seeding.ratio.min.set=$argument.0=\n" - "system.method.insert = ratio.max.set, simple|const,group.seeding.ratio.max.set=$argument.0=\n" - "system.method.insert = ratio.upload.set,simple|const,group.seeding.ratio.upload.set=$argument.0=\n" + "method.insert = ratio.enable, simple|const,group.seeding.ratio.enable=\n" + "method.insert = ratio.disable,simple|const,group.seeding.ratio.disable=\n" + "method.insert = ratio.min, simple|const,group.seeding.ratio.min=\n" + "method.insert = ratio.max, simple|const,group.seeding.ratio.max=\n" + "method.insert = ratio.upload, simple|const,group.seeding.ratio.upload=\n" + "method.insert = ratio.min.set, simple|const,group.seeding.ratio.min.set=$argument.0=\n" + "method.insert = ratio.max.set, simple|const,group.seeding.ratio.max.set=$argument.0=\n" + "method.insert = ratio.upload.set,simple|const,group.seeding.ratio.upload.set=$argument.0=\n" - "system.method.insert = group.insert_persistent_view,simple|const," + "method.insert = group.insert_persistent_view,simple|const," "view_add=$argument.0=,view.persistent=$argument.0=,\"group.insert=$argument.0=,$argument.0=\"\n" // Allow setting 'group.view' as constant, so that we can't @@ -321,28 +321,32 @@ main(int argc, char** argv) { // - command_tracker.cc // - command_ui.cc - "system.method.insert = get_handshake_log,redirect|const,log.handshake\n" - "system.method.insert = set_handshake_log,redirect|const,log.handshake.set\n" - "system.method.insert = get_log.tracker,redirect|const,log.tracker\n" - "system.method.insert = set_log.tracker,redirect|const,log.tracker.set\n" + "method.insert = system.method.insert,redirect|const,method.insert\n" + "method.insert = system.method.set,redirect|const,method.set\n" + "method.insert = system.method.set_key,redirect|const,method.set_key\n" - "system.method.insert = get_name,redirect|const,system.session_name\n" - "system.method.insert = set_name,redirect|const,system.session_name.set\n" - "system.method.insert = system.file_allocate,redirect|const,system.file.allocate\n" - "system.method.insert = system.file_allocate.set,redirect|const,system.file.allocate.set\n" + "method.insert = get_handshake_log,redirect|const,log.handshake\n" + "method.insert = set_handshake_log,redirect|const,log.handshake.set\n" + "method.insert = get_log.tracker,redirect|const,log.tracker\n" + "method.insert = set_log.tracker,redirect|const,log.tracker.set\n" - "system.method.insert = get_preload_type,redirect|const,pieces.preload.type\n" - "system.method.insert = get_preload_min_size,redirect|const,pieces.preload.min_size\n" - "system.method.insert = get_preload_required_rate,redirect|const,pieces.preload.min_rate\n" - "system.method.insert = set_preload_type,redirect|const,pieces.preload.type.set\n" - "system.method.insert = set_preload_min_size,redirect|const,pieces.preload.min_size.set\n" - "system.method.insert = set_preload_required_rate,redirect|const,pieces.preload.min_rate.set\n" - "system.method.insert = get_stats_preloaded,redirect|const,pieces.stats_preloaded\n" - "system.method.insert = get_stats_not_preloaded,redirect|const,pieces.stats_not_preloaded\n" + "method.insert = get_name,redirect|const,system.session_name\n" + "method.insert = set_name,redirect|const,system.session_name.set\n" + "method.insert = system.file_allocate,redirect|const,system.file.allocate\n" + "method.insert = system.file_allocate.set,redirect|const,system.file.allocate.set\n" - "system.method.insert = get_memory_usage,redirect|const,pieces.memory.current\n" - "system.method.insert = get_max_memory_usage,redirect|const,pieces.memory.max\n" - "system.method.insert = set_max_memory_usage,redirect|const,pieces.memory.max.set\n" + "method.insert = get_preload_type,redirect|const,pieces.preload.type\n" + "method.insert = get_preload_min_size,redirect|const,pieces.preload.min_size\n" + "method.insert = get_preload_required_rate,redirect|const,pieces.preload.min_rate\n" + "method.insert = set_preload_type,redirect|const,pieces.preload.type.set\n" + "method.insert = set_preload_min_size,redirect|const,pieces.preload.min_size.set\n" + "method.insert = set_preload_required_rate,redirect|const,pieces.preload.min_rate.set\n" + "method.insert = get_stats_preloaded,redirect|const,pieces.stats_preloaded\n" + "method.insert = get_stats_not_preloaded,redirect|const,pieces.stats_not_preloaded\n" + + "method.insert = get_memory_usage,redirect|const,pieces.memory.current\n" + "method.insert = get_max_memory_usage,redirect|const,pieces.memory.max\n" + "method.insert = set_max_memory_usage,redirect|const,pieces.memory.max.set\n" ); if (OptionParser::has_flag('n', argc, argv))