From 6ca373d2935d91b9106d56a212f89b8e4a112bda Mon Sep 17 00:00:00 2001 From: rakshasa Date: Sun, 12 Aug 2007 18:41:09 +0000 Subject: [PATCH] * Renamed all commands to from e.g "get_d_*" to "d.get_*". Remember to update your rc file. git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@953 e378c898-3ddf-0310-93e7-cc216c733640 --- src/command_download.cc | 56 ++++++++++++++--------------- src/command_events.cc | 16 ++++----- src/command_file.cc | 10 +++--- src/command_tracker.cc | 10 +++--- src/core/download_factory.cc | 34 +++++++++--------- src/core/download_list.cc | 62 ++++++++++++++++----------------- src/core/manager.cc | 10 +++--- src/core/view_manager.cc | 22 ++++++------ src/display/utils.cc | 10 +++--- src/ui/download.cc | 14 ++++---- src/ui/download_list.cc | 4 +-- src/ui/element_download_list.cc | 14 ++++---- 12 files changed, 131 insertions(+), 131 deletions(-) diff --git a/src/command_download.cc b/src/command_download.cc index 24ff9b56..476ad4e3 100644 --- a/src/command_download.cc +++ b/src/command_download.cc @@ -100,21 +100,21 @@ apply_d_change_link(int changeType, core::Download* download, const torrent::Obj std::string link; if (type == "base_path") { - target = rpc::call_command_d_string("get_d_base_path", download); - link = rak::path_expand(prefix + rpc::call_command_d_string("get_d_base_path", download) + postfix); + target = rpc::call_command_d_string("d.get_base_path", download); + link = rak::path_expand(prefix + rpc::call_command_d_string("d.get_base_path", download) + postfix); } else if (type == "base_filename") { - target = rpc::call_command_d_string("get_d_base_path", download); - link = rak::path_expand(prefix + rpc::call_command_d_string("get_d_base_filename", download) + postfix); + target = rpc::call_command_d_string("d.get_base_path", download); + link = rak::path_expand(prefix + rpc::call_command_d_string("d.get_base_filename", download) + postfix); } else if (type == "tied") { - link = rak::path_expand(rpc::call_command_d_string("get_d_tied_to_file", download)); + link = rak::path_expand(rpc::call_command_d_string("d.get_tied_to_file", download)); if (link.empty()) return torrent::Object(); link = rak::path_expand(prefix + link + postfix); - target = rpc::call_command_d_string("get_d_base_path", download); + target = rpc::call_command_d_string("d.get_base_path", download); } else { throw torrent::input_error("Unknown type argument."); @@ -148,7 +148,7 @@ apply_d_change_link(int changeType, core::Download* download, const torrent::Obj void apply_d_delete_tied(core::Download* download) { - const std::string& tie = rpc::call_command_d_string("get_d_tied_to_file", download); + const std::string& tie = rpc::call_command_d_string("d.get_tied_to_file", download); if (tie.empty()) return; @@ -156,7 +156,7 @@ apply_d_delete_tied(core::Download* download) { if (::unlink(rak::path_expand(tie).c_str()) == -1) control->core()->push_log_std("Could not unlink tied file: " + std::string(rak::error_number::current().c_str())); - rpc::call_command_d("set_d_tied_to_file", download, std::string()); + rpc::call_command_d("d.set_tied_to_file", download, std::string()); } void @@ -221,48 +221,48 @@ apply_d_ratio(core::Download* download) { rpc::commands.insert_download(key, commandDownloadSlotsItr++, &rpc::CommandDownloadSlot::function, rpc::CommandMap::flag_dont_delete | rpc::CommandMap::flag_public_xmlrpc, parm, doc); #define ADD_CD_VOID(key, slot) \ - ADD_CD_SLOT_PUBLIC("get_d_" key, call_unknown, rpc::object_d_fn(slot), "i:", "") + ADD_CD_SLOT_PUBLIC("d.get_" key, call_unknown, rpc::object_d_fn(slot), "i:", "") #define ADD_CD_V_VOID(key, slot) \ - ADD_CD_SLOT_PUBLIC("d_" key, call_unknown, rpc::object_d_fn(slot), "i:", "") + ADD_CD_SLOT_PUBLIC("d." key, call_unknown, rpc::object_d_fn(slot), "i:", "") #define ADD_CD_F_VOID(key, slot) \ - ADD_CD_SLOT_PUBLIC("d_" key, call_unknown, rpc::object_void_d_fn(slot), "i:", "") + ADD_CD_SLOT_PUBLIC("d." key, call_unknown, rpc::object_void_d_fn(slot), "i:", "") #define ADD_CD_LIST(key, slot) \ ADD_CD_SLOT_PUBLIC(key, call_list, slot, "i:", "") #define ADD_CD_VARIABLE_VALUE(key, firstKey, secondKey) \ - ADD_CD_SLOT_PUBLIC("get_d_" key, call_unknown, rpc::get_variable_d_fn(firstKey, secondKey), "i:", ""); \ - ADD_CD_SLOT("set_d_" key, call_value, rpc::set_variable_d_fn(firstKey, secondKey), "i:i", ""); + ADD_CD_SLOT_PUBLIC("d.get_" key, call_unknown, rpc::get_variable_d_fn(firstKey, secondKey), "i:", ""); \ + ADD_CD_SLOT("d.set_" key, call_value, rpc::set_variable_d_fn(firstKey, secondKey), "i:i", ""); #define ADD_CD_VARIABLE_VALUE_PUBLIC(key, firstKey, secondKey) \ - ADD_CD_SLOT_PUBLIC("get_d_" key, call_unknown, rpc::get_variable_d_fn(firstKey, secondKey), "i:", ""); \ - ADD_CD_SLOT_PUBLIC("set_d_" key, call_value, rpc::set_variable_d_fn(firstKey, secondKey), "i:i", ""); + ADD_CD_SLOT_PUBLIC("d.get_" key, call_unknown, rpc::get_variable_d_fn(firstKey, secondKey), "i:", ""); \ + ADD_CD_SLOT_PUBLIC("d.set_" key, call_value, rpc::set_variable_d_fn(firstKey, secondKey), "i:i", ""); #define ADD_CD_VARIABLE_STRING(key, firstKey, secondKey) \ - ADD_CD_SLOT_PUBLIC("get_d_" key, call_unknown, rpc::get_variable_d_fn(firstKey, secondKey), "i:", ""); \ - ADD_CD_SLOT("set_d_" key, call_string, rpc::set_variable_d_fn(firstKey, secondKey), "i:s", ""); + ADD_CD_SLOT_PUBLIC("d.get_" key, call_unknown, rpc::get_variable_d_fn(firstKey, secondKey), "i:", ""); \ + ADD_CD_SLOT("d.set_" key, call_string, rpc::set_variable_d_fn(firstKey, secondKey), "i:s", ""); #define ADD_CD_VALUE_UNI(key, get) \ - ADD_CD_SLOT_PUBLIC("get_d_" key, call_unknown, rpc::object_void_d_fn(get), "i:", "") + ADD_CD_SLOT_PUBLIC("d.get_" key, call_unknown, rpc::object_void_d_fn(get), "i:", "") #define ADD_CD_VALUE_BI(key, set, get) \ - ADD_CD_SLOT_PUBLIC("set_d_" key, call_value, rpc::object_value_d_fn(set), "i:i", "") \ - ADD_CD_SLOT_PUBLIC("get_d_" key, call_unknown, rpc::object_void_d_fn(get), "i:", "") + ADD_CD_SLOT_PUBLIC("d.set_" key, call_value, rpc::object_value_d_fn(set), "i:i", "") \ + ADD_CD_SLOT_PUBLIC("d.get_" key, call_unknown, rpc::object_void_d_fn(get), "i:", "") #define ADD_CD_VALUE_MEM_BI(key, target, set, get) \ ADD_CD_VALUE_BI(key, rak::on2(std::mem_fun(target), std::mem_fun(set)), rak::on(std::mem_fun(target), std::mem_fun(get))); #define ADD_CD_VALUE_MEM_UNI(key, target, get) \ - ADD_CD_SLOT_PUBLIC("get_d_" key, call_unknown, rpc::object_void_d_fn(rak::on(rak::on(std::mem_fun(&core::Download::download), std::mem_fun(target)), std::mem_fun(get))), "i:", ""); + ADD_CD_SLOT_PUBLIC("d.get_" key, call_unknown, rpc::object_void_d_fn(rak::on(rak::on(std::mem_fun(&core::Download::download), std::mem_fun(target)), std::mem_fun(get))), "i:", ""); #define ADD_CD_STRING_UNI(key, get) \ - ADD_CD_SLOT_PUBLIC("get_d_" key, call_unknown, rpc::object_void_d_fn(get), "s:", "") + ADD_CD_SLOT_PUBLIC("d.get_" key, call_unknown, rpc::object_void_d_fn(get), "s:", "") #define ADD_CD_STRING_BI(key, set, get) \ - ADD_CD_SLOT_PUBLIC("set_d_" key, call_string, rpc::object_string_d_fn(set), "i:s", "") \ - ADD_CD_SLOT_PUBLIC("get_d_" key, call_unknown, rpc::object_void_d_fn(get), "s:", "") + ADD_CD_SLOT_PUBLIC("d.set_" key, call_string, rpc::object_string_d_fn(set), "i:s", "") \ + ADD_CD_SLOT_PUBLIC("d.get_" key, call_unknown, rpc::object_void_d_fn(get), "s:", "") void add_copy_to_download(const char* src, const char* dest) { @@ -324,10 +324,10 @@ initialize_command_download() { ADD_CD_STRING_BI("connection_current", std::ptr_fun(&apply_d_connection_type), std::ptr_fun(&retrieve_d_connection_type)); - add_copy_to_download("get_connection_leech", "get_d_connection_leech"); - add_copy_to_download("set_connection_leech", "set_d_connection_leech"); - add_copy_to_download("get_connection_seed", "get_d_connection_seed"); - add_copy_to_download("set_connection_seed", "set_d_connection_seed"); + add_copy_to_download("get_connection_leech", "d.get_connection_leech"); + add_copy_to_download("set_connection_leech", "d.set_connection_leech"); + add_copy_to_download("get_connection_seed", "d.get_connection_seed"); + add_copy_to_download("set_connection_seed", "d.set_connection_seed"); ADD_CD_VALUE_MEM_BI("max_file_size", &core::Download::file_list, &torrent::FileList::set_max_file_size, &torrent::FileList::max_file_size); diff --git a/src/command_events.cc b/src/command_events.cc index 672967aa..b07fc874 100644 --- a/src/command_events.cc +++ b/src/command_events.cc @@ -105,7 +105,7 @@ apply_stop_on_ratio(const torrent::Object& rawArgs) { if ((totalUpload >= minUpload && totalUpload * 100 >= totalDone * minRatio) || (maxRatio > 0 && totalUpload * 100 > totalDone * maxRatio)) { downloadList->stop_try(*itr); - rpc::call_command_d("set_d_ignore_commands", *itr, (int64_t)1); + rpc::call_command_d("d.set_ignore_commands", *itr, (int64_t)1); } ++itr; @@ -117,11 +117,11 @@ apply_stop_on_ratio(const torrent::Object& rawArgs) { torrent::Object apply_start_tied() { for (core::DownloadList::iterator itr = control->core()->download_list()->begin(); itr != control->core()->download_list()->end(); ++itr) { - if (rpc::call_command_d_value("get_d_state", *itr) == 1) + if (rpc::call_command_d_value("d.get_state", *itr) == 1) continue; rak::file_stat fs; - const std::string& tiedToFile = rpc::call_command_d_string("get_d_tied_to_file", *itr); + const std::string& tiedToFile = rpc::call_command_d_string("d.get_tied_to_file", *itr); if (!tiedToFile.empty() && fs.update(rak::path_expand(tiedToFile))) control->core()->download_list()->start_try(*itr); @@ -133,11 +133,11 @@ apply_start_tied() { torrent::Object apply_stop_untied() { for (core::DownloadList::iterator itr = control->core()->download_list()->begin(); itr != control->core()->download_list()->end(); ++itr) { - if (rpc::call_command_d_value("get_d_state", *itr) == 0) + if (rpc::call_command_d_value("d.get_state", *itr) == 0) continue; rak::file_stat fs; - const std::string& tiedToFile = rpc::call_command_d_string("get_d_tied_to_file", *itr); + const std::string& tiedToFile = rpc::call_command_d_string("d.get_tied_to_file", *itr); if (!tiedToFile.empty() && !fs.update(rak::path_expand(tiedToFile))) control->core()->download_list()->stop_try(*itr); @@ -150,7 +150,7 @@ torrent::Object apply_close_untied() { for (core::DownloadList::iterator itr = control->core()->download_list()->begin(); itr != control->core()->download_list()->end(); ++itr) { rak::file_stat fs; - const std::string& tiedToFile = rpc::call_command_d_string("get_d_tied_to_file", *itr); + const std::string& tiedToFile = rpc::call_command_d_string("d.get_tied_to_file", *itr); if (!tiedToFile.empty() && !fs.update(rak::path_expand(tiedToFile)) && control->core()->download_list()->stop_try(*itr)) control->core()->download_list()->close(*itr); @@ -163,11 +163,11 @@ torrent::Object apply_remove_untied() { for (core::DownloadList::iterator itr = control->core()->download_list()->begin(); itr != control->core()->download_list()->end(); ) { rak::file_stat fs; - const std::string& tiedToFile = rpc::call_command_d_string("get_d_tied_to_file", *itr); + const std::string& tiedToFile = rpc::call_command_d_string("d.get_tied_to_file", *itr); if (!tiedToFile.empty() && !fs.update(rak::path_expand(tiedToFile))) { // Need to clear tied_to_file so it doesn't try to delete it. - rpc::call_command_d("set_d_tied_to_file", *itr, std::string()); + rpc::call_command_d("d.set_tied_to_file", *itr, std::string()); itr = control->core()->download_list()->erase(itr); diff --git a/src/command_file.cc b/src/command_file.cc index 19d91392..def35071 100644 --- a/src/command_file.cc +++ b/src/command_file.cc @@ -96,17 +96,17 @@ apply_f_path_depth(torrent::File* file) { rpc::commands.insert_file(key, commandFileSlotsItr++, &rpc::CommandFileSlot::function, rpc::CommandMap::flag_dont_delete | rpc::CommandMap::flag_public_xmlrpc, parm, doc); #define ADD_CF_VOID(key, slot) \ - ADD_CF_SLOT_PUBLIC("get_f_" key, call_unknown, rpc::object_f_fn(slot), "i:", "") + ADD_CF_SLOT_PUBLIC("f.get_" key, call_unknown, rpc::object_f_fn(slot), "i:", "") #define ADD_CF_VALUE_UNI(key, get) \ - ADD_CF_SLOT_PUBLIC("get_f_" key, call_unknown, rpc::object_void_f_fn(get), "i:", "") + ADD_CF_SLOT_PUBLIC("f.get_" key, call_unknown, rpc::object_void_f_fn(get), "i:", "") #define ADD_CF_VALUE_BI(key, set, get) \ - ADD_CF_SLOT_PUBLIC("set_f_" key, call_value, rpc::object_value_f_fn(set), "i:i", "") \ - ADD_CF_SLOT_PUBLIC("get_f_" key, call_unknown, rpc::object_void_f_fn(get), "i:", "") + ADD_CF_SLOT_PUBLIC("f.set_" key, call_value, rpc::object_value_f_fn(set), "i:i", "") \ + ADD_CF_SLOT_PUBLIC("f.get_" key, call_unknown, rpc::object_void_f_fn(get), "i:", "") #define ADD_CF_STRING_UNI(key, get) \ - ADD_CF_SLOT_PUBLIC("get_f_" key, call_unknown, rpc::object_void_f_fn(get), "s:", "") + ADD_CF_SLOT_PUBLIC("f.get_" key, call_unknown, rpc::object_void_f_fn(get), "s:", "") void initialize_command_file() { diff --git a/src/command_tracker.cc b/src/command_tracker.cc index b016f34b..41197938 100644 --- a/src/command_tracker.cc +++ b/src/command_tracker.cc @@ -64,17 +64,17 @@ apply_t_set_enabled(torrent::Tracker* tracker, int64_t state) { rpc::commands.insert_tracker(key, commandTrackerSlotsItr++, &rpc::CommandTrackerSlot::function, rpc::CommandMap::flag_dont_delete | rpc::CommandMap::flag_public_xmlrpc, parm, doc); #define ADD_CT_VOID(key, slot) \ - ADD_CT_SLOT_PUBLIC("get_t_" key, call_unknown, rpc::object_t_fn(slot), "i:", "") + ADD_CT_SLOT_PUBLIC("t.get_" key, call_unknown, rpc::object_t_fn(slot), "i:", "") #define ADD_CT_VALUE_UNI(key, get) \ - ADD_CT_SLOT_PUBLIC("get_t_" key, call_unknown, rpc::object_void_t_fn(get), "i:", "") + ADD_CT_SLOT_PUBLIC("t.get_" key, call_unknown, rpc::object_void_t_fn(get), "i:", "") #define ADD_CT_VALUE_BI(key, set, get) \ - ADD_CT_SLOT_PUBLIC("set_t_" key, call_value, rpc::object_value_t_fn(set), "i:i", "") \ - ADD_CT_SLOT_PUBLIC("get_t_" key, call_unknown, rpc::object_void_t_fn(get), "i:", "") + ADD_CT_SLOT_PUBLIC("t.set_" key, call_value, rpc::object_value_t_fn(set), "i:i", "") \ + ADD_CT_SLOT_PUBLIC("t.get_" key, call_unknown, rpc::object_void_t_fn(get), "i:", "") #define ADD_CT_STRING_UNI(key, get) \ - ADD_CT_SLOT_PUBLIC("get_t_" key, call_unknown, rpc::object_void_t_fn(get), "s:", "") + ADD_CT_SLOT_PUBLIC("t.get_" key, call_unknown, rpc::object_void_t_fn(get), "s:", "") void initialize_command_tracker() { diff --git a/src/core/download_factory.cc b/src/core/download_factory.cc index 26c04d7e..4e102ca7 100644 --- a/src/core/download_factory.cc +++ b/src/core/download_factory.cc @@ -173,27 +173,27 @@ DownloadFactory::receive_success() { initialize_rtorrent(download, rtorrent); // Move to 'rtorrent'. - rpc::call_command_d("set_d_connection_leech", download, m_variables["connection_leech"]); - rpc::call_command_d("set_d_connection_seed", download, m_variables["connection_seed"]); + rpc::call_command_d("d.set_connection_leech", download, m_variables["connection_leech"]); + rpc::call_command_d("d.set_connection_seed", download, m_variables["connection_seed"]); - rpc::call_command_d("set_d_max_uploads", download, rpc::call_command_void("get_max_uploads")); - rpc::call_command_d("set_d_min_peers", download, rpc::call_command_void("get_min_peers")); - rpc::call_command_d("set_d_max_peers", download, rpc::call_command_void("get_max_peers")); - rpc::call_command_d("set_d_tracker_numwant", download, rpc::call_command_void("get_tracker_numwant")); + rpc::call_command_d("d.set_max_uploads", download, rpc::call_command_void("get_max_uploads")); + rpc::call_command_d("d.set_min_peers", download, rpc::call_command_void("get_min_peers")); + rpc::call_command_d("d.set_max_peers", download, rpc::call_command_void("get_max_peers")); + rpc::call_command_d("d.set_tracker_numwant", download, rpc::call_command_void("get_tracker_numwant")); - if (rpc::call_command_d_value("get_d_complete", download) != 0) { + if (rpc::call_command_d_value("d.get_complete", download) != 0) { if (rpc::call_command_value("get_min_peers_seed") >= 0) - rpc::call_command_d("set_d_min_peers", download, rpc::call_command_void("get_min_peers_seed")); + rpc::call_command_d("d.set_min_peers", download, rpc::call_command_void("get_min_peers_seed")); if (rpc::call_command_value("get_max_peers_seed") >= 0) - rpc::call_command_d("set_d_max_peers", download, rpc::call_command_void("get_max_peers_seed")); + rpc::call_command_d("d.set_max_peers", download, rpc::call_command_void("get_max_peers_seed")); } if (!rpc::call_command_value("get_use_udp_trackers")) download->enable_udp_trackers(false); if (rpc::call_command_value("get_max_file_size") > 0) - rpc::call_command_d("set_d_max_file_size", download, rpc::call_command_void("get_max_file_size")); + rpc::call_command_d("d.set_max_file_size", download, rpc::call_command_void("get_max_file_size")); // Check first if we already have these values set in the session // torrent, so that it is safe to change the values. @@ -205,12 +205,12 @@ DownloadFactory::receive_success() { rpc::call_command_string("split_suffix")); if (!rtorrent->has_key_string("directory")) - rpc::call_command_d("set_d_directory", download, m_variables["directory"]); + rpc::call_command_d("d.set_directory", download, m_variables["directory"]); else - rpc::call_command_d("set_d_directory", download, rtorrent->get_key("directory")); + rpc::call_command_d("d.set_directory", download, rtorrent->get_key("directory")); if (!m_session && m_variables["tied_to_file"].as_value()) - rpc::call_command_d("set_d_tied_to_file", download, m_uri); + rpc::call_command_d("d.set_tied_to_file", download, m_uri); torrent::Object& resumeObject = root->has_key_map("libtorrent_resume") ? root->get_key("libtorrent_resume") @@ -262,8 +262,8 @@ DownloadFactory::receive_success() { if (m_session) { // This torrent was queued for hashing or hashing when the session // file was saved. Or it was in a started state. - if (rpc::call_command_d_value("get_d_hashing", download) != Download::variable_hashing_stopped || - rpc::call_command_d_value("get_d_state", download) != 0) + if (rpc::call_command_d_value("d.get_hashing", download) != Download::variable_hashing_stopped || + rpc::call_command_d_value("d.get_state", download) != 0) m_manager->download_list()->resume(download); } else { @@ -312,9 +312,9 @@ DownloadFactory::initialize_rtorrent(Download* download, torrent::Object* rtorre rtorrent->insert_key("tied_to_file", std::string()); if (rtorrent->has_key_value("priority")) - rpc::call_command_d("set_d_priority", download, rtorrent->get_key_value("priority") % 4); + rpc::call_command_d("d.set_priority", download, rtorrent->get_key_value("priority") % 4); else - rpc::call_command_d("set_d_priority", download, (int64_t)2); + rpc::call_command_d("d.set_priority", download, (int64_t)2); if (rtorrent->has_key_value("key")) { download->tracker_list()->set_key(rtorrent->get_key_value("key")); diff --git a/src/core/download_list.cc b/src/core/download_list.cc index 377ea4eb..91c72960 100644 --- a/src/core/download_list.cc +++ b/src/core/download_list.cc @@ -269,7 +269,7 @@ DownloadList::close_throw(Download* download) { download->download()->close(); - if (!download->is_hash_failed() && rpc::call_command_d_value("get_d_hashing", download) != Download::variable_hashing_stopped) + if (!download->is_hash_failed() && rpc::call_command_d_value("d.get_hashing", download) != Download::variable_hashing_stopped) throw torrent::internal_error("DownloadList::close_throw(...) called but we're going into a hashing loop."); std::for_each(slot_map_hash_removed().begin(), slot_map_hash_removed().end(), download_list_call(download)); @@ -283,7 +283,7 @@ DownloadList::start_normal(Download* download) { // Clear hash failed as we're doing a manual start and want to try // hashing again. download->set_hash_failed(false); - rpc::call_command_d("set_d_state", download, (int64_t)1); + rpc::call_command_d("d.set_state", download, (int64_t)1); resume(download); } @@ -295,12 +295,12 @@ DownloadList::start_try(Download* download) { // Also don't start if the state is one of those that indicate we // were manually stopped? - if (download->is_hash_failed() || rpc::call_command_d_value("get_d_ignore_commands", download) != 0) + if (download->is_hash_failed() || rpc::call_command_d_value("d.get_ignore_commands", download) != 0) return false; // Don't clear the hash failed as this function is used by scripts, // etc. - rpc::call_command_d("set_d_state", download, (int64_t)1); + rpc::call_command_d("d.set_state", download, (int64_t)1); resume(download); return true; @@ -310,7 +310,7 @@ void DownloadList::stop_normal(Download* download) { check_contains(download); - rpc::call_command_d("set_d_state", download, (int64_t)0); + rpc::call_command_d("d.set_state", download, (int64_t)0); pause(download); } @@ -319,10 +319,10 @@ bool DownloadList::stop_try(Download* download) { check_contains(download); - if (rpc::call_command_d_value("get_d_ignore_commands", download) != 0) + if (rpc::call_command_d_value("d.get_ignore_commands", download) != 0) return false; - rpc::call_command_d("set_d_state", download, (int64_t)0); + rpc::call_command_d("d.set_state", download, (int64_t)0); pause(download); return true; @@ -348,8 +348,8 @@ DownloadList::resume(Download* download) { if (download->is_hash_failed()) return; - if (rpc::call_command_d_value("get_d_hashing", download) == Download::variable_hashing_stopped) - rpc::call_command_d("set_d_hashing", download, Download::variable_hashing_initial); + if (rpc::call_command_d_value("d.get_hashing", download) == Download::variable_hashing_stopped) + rpc::call_command_d("d.set_hashing", download, Download::variable_hashing_initial); std::for_each(slot_map_hash_queued().begin(), slot_map_hash_queued().end(), download_list_call(download)); return; @@ -358,12 +358,12 @@ DownloadList::resume(Download* download) { // This will never actually do anything due to the above hash check. // open_throw(download); - rpc::call_command_d("set_d_state_changed", download, cachedTime.seconds()); + rpc::call_command_d("d.set_state_changed", download, cachedTime.seconds()); if (download->is_done()) { - rpc::call_command_d("set_d_connection_current", download, rpc::call_command_d_void("get_d_connection_seed", download)); + rpc::call_command_d("d.set_connection_current", download, rpc::call_command_d_void("d.get_connection_seed", download)); } else { - rpc::call_command_d("set_d_connection_current", download, rpc::call_command_d_void("get_d_connection_leech", download)); + rpc::call_command_d("d.set_connection_current", download, rpc::call_command_d_void("d.get_connection_leech", download)); // For the moment, clear the resume data so we force hash-check // on non-complete downloads after a crash. This shouldn't be @@ -392,9 +392,9 @@ DownloadList::pause(Download* download) { // Always clear hashing on pause. When a hashing request is added, // it should have cleared the hash resume data. - if (rpc::call_command_d_value("get_d_hashing", download) != Download::variable_hashing_stopped) { + if (rpc::call_command_d_value("d.get_hashing", download) != Download::variable_hashing_stopped) { download->download()->hash_stop(); - rpc::call_command_d_set_value("set_d_hashing", download, Download::variable_hashing_stopped); + rpc::call_command_d_set_value("d.set_hashing", download, Download::variable_hashing_stopped); std::for_each(slot_map_hash_removed().begin(), slot_map_hash_removed().end(), download_list_call(download)); } @@ -407,7 +407,7 @@ DownloadList::pause(Download* download) { std::for_each(slot_map_stop().begin(), slot_map_stop().end(), download_list_call(download)); - rpc::call_command_d("set_d_state_changed", download, cachedTime.seconds()); + rpc::call_command_d("d.set_state_changed", download, cachedTime.seconds()); // Save the state after all the slots, etc have been called so we // include the modifications they may make. @@ -424,7 +424,7 @@ DownloadList::check_hash(Download* download) { try { - if (rpc::call_command_d_value("get_d_hashing", download) != Download::variable_hashing_stopped) + if (rpc::call_command_d_value("d.get_hashing", download) != Download::variable_hashing_stopped) return; hash_queue(download, Download::variable_hashing_rehash); @@ -457,8 +457,8 @@ DownloadList::hash_done(Download* download) { // confirm all the data, avoiding large BW usage on f.ex. the // ReiserFS bug with >4GB files. - int64_t hashing = rpc::call_command_d_value("get_d_hashing", download); - rpc::call_command_d_set_value("set_d_hashing", download, Download::variable_hashing_stopped); + int64_t hashing = rpc::call_command_d_value("d.get_hashing", download); + rpc::call_command_d_set_value("d.set_hashing", download, Download::variable_hashing_stopped); switch (hashing) { case Download::variable_hashing_initial: @@ -467,17 +467,17 @@ DownloadList::hash_done(Download* download) { // If the download was previously completed but the files were // f.ex deleted, then we clear the state and complete. - if (rpc::call_command_d_value("get_d_complete", download) && !download->is_done()) { - rpc::call_command_d("set_d_state", download, (int64_t)0); + if (rpc::call_command_d_value("d.get_complete", download) && !download->is_done()) { + rpc::call_command_d("d.set_state", download, (int64_t)0); download->set_message("Download registered as completed, but hash check returned unfinished chunks."); } // Save resume data so we update time-stamps and priorities if // they were invalid/changed while loading/hashing. - rpc::call_command_d("set_d_complete", download, (int64_t)download->is_done()); + rpc::call_command_d("d.set_complete", download, (int64_t)download->is_done()); torrent::resume_save_progress(*download->download(), download->download()->bencode()->get_key("libtorrent_resume")); - if (rpc::call_command_d_value("get_d_state", download) == 1) + if (rpc::call_command_d_value("d.get_state", download) == 1) resume(download); break; @@ -507,14 +507,14 @@ void DownloadList::hash_queue(Download* download, int type) { check_contains(download); - if (rpc::call_command_d_value("get_d_hashing", download) != Download::variable_hashing_stopped) + if (rpc::call_command_d_value("d.get_hashing", download) != Download::variable_hashing_stopped) throw torrent::internal_error("DownloadList::hash_queue(...) hashing already queued."); close_throw(download); torrent::resume_clear_progress(*download->download(), download->download()->bencode()->get_key("libtorrent_resume")); download->set_hash_failed(false); - rpc::call_command_d_set_value("set_d_hashing", download, type); + rpc::call_command_d_set_value("d.set_hashing", download, type); if (download->is_open()) throw torrent::internal_error("DownloadList::hash_clear(...) download still open."); @@ -543,16 +543,16 @@ void DownloadList::confirm_finished(Download* download) { check_contains(download); - rpc::call_command_d("set_d_complete", download, (int64_t)1); + rpc::call_command_d("d.set_complete", download, (int64_t)1); - rpc::call_command_d("set_d_connection_current", download, rpc::call_command_d_void("get_d_connection_seed", download)); + rpc::call_command_d("d.set_connection_current", download, rpc::call_command_d_void("d.get_connection_seed", download)); download->set_priority(download->priority()); - if (rpc::call_command_d_value("get_d_min_peers", download) == rpc::call_command_value("get_min_peers") && rpc::call_command_value("get_min_peers_seed") >= 0) - rpc::call_command_d("set_d_min_peers", download, rpc::call_command_void("get_min_peers_seed")); + if (rpc::call_command_d_value("d.get_min_peers", download) == rpc::call_command_value("get_min_peers") && rpc::call_command_value("get_min_peers_seed") >= 0) + rpc::call_command_d("d.set_min_peers", download, rpc::call_command_void("get_min_peers_seed")); - if (rpc::call_command_d_value("get_d_max_peers", download) == rpc::call_command_value("get_max_peers") && rpc::call_command_value("get_max_peers_seed") >= 0) - rpc::call_command_d("set_d_max_peers", download, rpc::call_command_void("get_max_peers_seed")); + if (rpc::call_command_d_value("d.get_max_peers", download) == rpc::call_command_value("get_max_peers") && rpc::call_command_value("get_max_peers_seed") >= 0) + rpc::call_command_d("d.set_max_peers", download, rpc::call_command_void("get_max_peers_seed")); // Do this before the slots are called in case one of them closes // the download. @@ -570,7 +570,7 @@ DownloadList::confirm_finished(Download* download) { close_throw(download); std::for_each(slot_map_finished().begin(), slot_map_finished().end(), download_list_call(download)); - if (!download->is_active() && rpc::call_command_d_value("get_d_state", download) == 1) + if (!download->is_active() && rpc::call_command_d_value("d.get_state", download) == 1) resume(download); } diff --git a/src/core/manager.cc b/src/core/manager.cc index 826abf8e..d6a8f86b 100644 --- a/src/core/manager.cc +++ b/src/core/manager.cc @@ -230,7 +230,7 @@ Manager::initialize_second() { m_downloadList->slot_map_insert()["1_connect_storage_log"] = sigc::bind(sigc::ptr_fun(&connect_signal_storage_log), sigc::mem_fun(m_logComplete, &Log::push_front)); m_downloadList->slot_map_insert()["1_connect_tracker_dump"] = sigc::bind(sigc::ptr_fun(&connect_signal_tracker_dump), sigc::ptr_fun(&receive_tracker_dump)); - m_downloadList->slot_map_erase()["9_delete_tied"] = sigc::bind<0>(&rpc::call_command_d_v_void, "d_delete_tied"); + m_downloadList->slot_map_erase()["9_delete_tied"] = sigc::bind<0>(&rpc::call_command_d_v_void, "d.delete_tied"); torrent::connection_manager()->set_signal_handshake_log(sigc::mem_fun(this, &Manager::handshake_log)); } @@ -460,7 +460,7 @@ path_expand(std::vector* paths, const std::string& pattern) { bool manager_equal_tied(const std::string& path, Download* download) { - return path == rpc::call_command_d_string("get_d_tied_to_file", download); + return path == rpc::call_command_d_string("d.get_tied_to_file", download); } void @@ -504,7 +504,7 @@ Manager::receive_hashing_changed() { continue; bool tryQuick = - rpc::call_command_d_value("get_d_hashing", *itr) == Download::variable_hashing_initial && + rpc::call_command_d_value("d.get_hashing", *itr) == Download::variable_hashing_initial && (*itr)->download()->file_list()->bitfield()->empty(); if (!tryQuick && foundHashing) @@ -527,7 +527,7 @@ Manager::receive_hashing_changed() { (*itr)->download()->hash_stop(); if (foundHashing) { - rpc::call_command_d_set_value("set_d_hashing", *itr, Download::variable_hashing_rehash); + rpc::call_command_d_set_value("d.set_hashing", *itr, Download::variable_hashing_rehash); continue; } } @@ -538,7 +538,7 @@ Manager::receive_hashing_changed() { } catch (torrent::local_error& e) { if (tryQuick) { // Make sure we don't repeat the quick hashing. - rpc::call_command_d_set_value("set_d_hashing", *itr, Download::variable_hashing_rehash); + rpc::call_command_d_set_value("d.set_hashing", *itr, Download::variable_hashing_rehash); } else { (*itr)->set_hash_failed(true); diff --git a/src/core/view_manager.cc b/src/core/view_manager.cc index 1d6b64b9..d1ee77b5 100644 --- a/src/core/view_manager.cc +++ b/src/core/view_manager.cc @@ -136,19 +136,19 @@ ViewManager::ViewManager(DownloadList* dl) : m_sort["name"] = new ViewSortName(); m_sort["name_reverse"] = new ViewSortReverse(new ViewSortName()); - m_sort["stopped"] = new ViewSortVariableValue("get_d_state"); - m_sort["started"] = new ViewSortVariableValue("get_d_state", true); - m_sort["complete"] = new ViewSortVariableValue("get_d_complete"); - m_sort["incomplete"] = new ViewSortVariableValue("get_d_complete", true); + m_sort["stopped"] = new ViewSortVariableValue("d.get_state"); + m_sort["started"] = new ViewSortVariableValue("d.get_state", true); + m_sort["complete"] = new ViewSortVariableValue("d.get_complete"); + m_sort["incomplete"] = new ViewSortVariableValue("d.get_complete", true); - m_sort["state_changed"] = new ViewSortVariableValue("get_d_state_changed"); - m_sort["state_changed_reverse"] = new ViewSortVariableValue("get_d_state_changed", true); + m_sort["state_changed"] = new ViewSortVariableValue("d.get_state_changed"); + m_sort["state_changed_reverse"] = new ViewSortVariableValue("d.get_state_changed", true); - m_filter["started"] = new ViewFilterVariableValue("get_d_state", 1); - m_filter["stopped"] = new ViewFilterVariableValue("get_d_state", 0); - m_filter["complete"] = new ViewFilterVariableValue("get_d_complete", 0, true); - m_filter["incomplete"] = new ViewFilterVariableValue("get_d_complete", 0); - m_filter["hashing"] = new ViewFilterVariableValue("get_d_hashing", 0, true); + m_filter["started"] = new ViewFilterVariableValue("d.get_state", 1); + m_filter["stopped"] = new ViewFilterVariableValue("d.get_state", 0); + m_filter["complete"] = new ViewFilterVariableValue("d.get_complete", 0, true); + m_filter["incomplete"] = new ViewFilterVariableValue("d.get_complete", 0); + m_filter["hashing"] = new ViewFilterVariableValue("d.get_hashing", 0, true); } void diff --git a/src/display/utils.cc b/src/display/utils.cc index ffe49972..1a0cf71e 100644 --- a/src/display/utils.cc +++ b/src/display/utils.cc @@ -160,12 +160,12 @@ print_download_info(char* first, char* last, core::Download* d) { } first = print_buffer(first, last, " [%c%c R: %4.2f", - rpc::call_command_d_string("get_d_tied_to_file", d).empty() ? ' ' : 'T', - rpc::call_command_d_value("get_d_ignore_commands", d) == 0 ? ' ' : 'I', - (double)rpc::call_command_d_value("get_d_ratio", d) / 1000.0); + rpc::call_command_d_string("d.get_tied_to_file", d).empty() ? ' ' : 'T', + rpc::call_command_d_value("d.get_ignore_commands", d) == 0 ? ' ' : 'I', + (double)rpc::call_command_d_value("d.get_ratio", d) / 1000.0); if (d->priority() != 2) - first = print_buffer(first, last, " %s]", rpc::call_command_d_string("get_d_priority_str", d).c_str()); + first = print_buffer(first, last, " %s]", rpc::call_command_d_string("d.get_priority_str", d).c_str()); else first = print_buffer(first, last, "]"); @@ -179,7 +179,7 @@ char* print_download_status(char* first, char* last, core::Download* d) { if (d->is_active()) ; - else if (rpc::call_command_d_value("get_d_hashing", d) != 0) + else if (rpc::call_command_d_value("d.get_hashing", d) != 0) first = print_buffer(first, last, "Hashing: "); else if (!d->is_active()) first = print_buffer(first, last, "Inactive: "); diff --git a/src/ui/download.cc b/src/ui/download.cc index 289a661f..8934a3f6 100644 --- a/src/ui/download.cc +++ b/src/ui/download.cc @@ -154,16 +154,16 @@ Download::create_info() { element->push_back(""); element->push_column("Directory:", te_string(&torrent::FileList::root_dir)); - element->push_column("Tied to file:", te_variable_string("get_d_tied_to_file")); + element->push_column("Tied to file:", te_variable_string("d.get_tied_to_file")); element->push_column("File stats:", te_branch(&core::Download::c_file_list, &torrent::FileList::is_multi_file, te_string("multi"), te_string("single")), " ", te_value(&torrent::FileList::size_files), " files"); element->push_back(""); element->push_column("Chunks:", te_value(&torrent::FileList::completed_chunks), " / ", te_value(&torrent::FileList::size_chunks), " * ", te_value(&torrent::FileList::chunk_size)); - element->push_column("Priority:", te_variable_value("get_d_priority")); + element->push_column("Priority:", te_variable_value("d.get_priority")); - element->push_column("State changed:", te_variable_value("get_d_state_changed", value_base::flag_timer | value_base::flag_elapsed)); + element->push_column("State changed:", te_variable_value("d.get_state_changed", value_base::flag_timer | value_base::flag_elapsed)); element->push_back(""); element->push_column("Memory usage:", te_value(&torrent::ChunkManager::memory_usage, value_base::flag_mb), " MB"); @@ -172,15 +172,15 @@ Download::create_info() { element->push_column("Safe diskspace:", te_value(&torrent::ChunkManager::safe_free_diskspace, value_base::flag_mb), " MB"); element->push_back(""); - element->push_column("Connection type:", te_variable_string("get_d_connection_current")); + element->push_column("Connection type:", te_variable_string("d.get_connection_current")); element->push_column("Safe sync:", te_branch(&torrent::ChunkManager::safe_sync, torrent::chunk_manager(), te_string("yes"), te_string("no"))); element->push_column("Send buffer:", te_value(&torrent::ConnectionManager::send_buffer_size, value_base::flag_kb), " KB"); element->push_column("Receive buffer:", te_value(&torrent::ConnectionManager::receive_buffer_size, value_base::flag_kb), " KB"); element->push_back(""); - element->push_column("Upload:", te_variable_value("get_d_up_rate", value_base::flag_kb), " KB / ", te_variable_value("get_d_up_total", value_base::flag_xb)); - element->push_column("Download:", te_variable_value("get_d_down_rate", value_base::flag_kb), " KB / ", te_variable_value("get_d_down_total", value_base::flag_xb)); - element->push_column("Skipped:", te_variable_value("get_d_skip_rate", value_base::flag_kb), " KB / ", te_variable_value("get_d_skip_total", value_base::flag_xb)); + element->push_column("Upload:", te_variable_value("d.get_up_rate", value_base::flag_kb), " KB / ", te_variable_value("d.get_up_total", value_base::flag_xb)); + element->push_column("Download:", te_variable_value("d.get_down_rate", value_base::flag_kb), " KB / ", te_variable_value("d.get_down_total", value_base::flag_xb)); + element->push_column("Skipped:", te_variable_value("d.get_skip_rate", value_base::flag_kb), " KB / ", te_variable_value("d.get_skip_total", value_base::flag_xb)); element->push_column("Preload:", te_value(&torrent::ChunkManager::preload_type), " / ", te_value(&torrent::ChunkManager::stats_preloaded), " / ", te_value(&torrent::ChunkManager::stats_not_preloaded)); element->set_column_width(element->column_width() + 1); diff --git a/src/ui/download_list.cc b/src/ui/download_list.cc index abe2222a..20cd9bef 100644 --- a/src/ui/download_list.cc +++ b/src/ui/download_list.cc @@ -288,8 +288,8 @@ DownloadList::receive_exit_input(Input type) { if (current_view()->focus() == current_view()->end_visible()) throw torrent::input_error("No download in focus to change root directory."); - rpc::call_command_d("set_d_directory", *current_view()->focus(), rak::trim(input->str())); - control->core()->push_log_std("New root directory \"" + rpc::call_command_d_string("get_d_directory", *current_view()->focus()) + "\" for torrent."); + rpc::call_command_d("d.set_directory", *current_view()->focus(), rak::trim(input->str())); + control->core()->push_log_std("New root directory \"" + rpc::call_command_d_string("d.get_directory", *current_view()->focus()) + "\" for torrent."); break; case INPUT_COMMAND: diff --git a/src/ui/element_download_list.cc b/src/ui/element_download_list.cc index c283df52..b85546bb 100644 --- a/src/ui/element_download_list.cc +++ b/src/ui/element_download_list.cc @@ -152,7 +152,7 @@ ElementDownloadList::receive_stop_download() { if (m_view->focus() == m_view->end_visible()) return; - if (rpc::call_command_d_value("get_d_state", *m_view->focus()) == 1) + if (rpc::call_command_d_value("d.get_state", *m_view->focus()) == 1) control->core()->download_list()->stop_normal(*m_view->focus()); else control->core()->download_list()->erase_ptr(*m_view->focus()); @@ -167,7 +167,7 @@ ElementDownloadList::receive_close_download() { core::Download* download = *m_view->focus(); - rpc::call_command_d("set_d_ignore_commands", download, (int64_t)1); + rpc::call_command_d("d.set_ignore_commands", download, (int64_t)1); control->core()->download_list()->stop_normal(download); control->core()->download_list()->close(download); @@ -206,11 +206,11 @@ ElementDownloadList::receive_ignore_ratio() { if (m_view->focus() == m_view->end_visible()) return; - if (rpc::call_command_d_value("get_d_ignore_commands", *m_view->focus()) != 0) { - rpc::call_command_d_set_value("set_d_ignore_commands", *m_view->focus(), (int64_t)0); + if (rpc::call_command_d_value("d.get_ignore_commands", *m_view->focus()) != 0) { + rpc::call_command_d_set_value("d.set_ignore_commands", *m_view->focus(), (int64_t)0); control->core()->push_log("Torrent set to heed commands."); } else { - rpc::call_command_d_set_value("set_d_ignore_commands", *m_view->focus(), (int64_t)1); + rpc::call_command_d_set_value("d.set_ignore_commands", *m_view->focus(), (int64_t)1); control->core()->push_log("Torrent set to ignore commands."); } } @@ -220,10 +220,10 @@ ElementDownloadList::receive_clear_tied() { if (m_view->focus() == m_view->end_visible()) return; - const std::string& tiedFile = rpc::call_command_d_string("get_d_tied_to_file", *m_view->focus()); + const std::string& tiedFile = rpc::call_command_d_string("d.get_tied_to_file", *m_view->focus()); if (!tiedFile.empty()) { - rpc::call_command_d_void("d_delete_tied", *m_view->focus()); + rpc::call_command_d_void("d.delete_tied", *m_view->focus()); control->core()->push_log("Cleared tied to file association for the selected download."); }