From adef434bc37803472953304450e15e1e2b807e05 Mon Sep 17 00:00:00 2001 From: rakshasa Date: Tue, 2 Aug 2011 06:09:37 +0000 Subject: [PATCH] * Added 'd.disconnect.seeders' and 'd.accepting_seeders{,.enable,.disable}' commands. git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@1260 e378c898-3ddf-0310-93e7-cc216c733640 --- src/command_download.cc | 9 +++++++++ src/ui/download.cc | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/command_download.cc b/src/command_download.cc index 6fc92701..fb0842da 100644 --- a/src/command_download.cc +++ b/src/command_download.cc @@ -563,6 +563,9 @@ d_list_remove(core::Download* download, const torrent::Object& rawArgs, const ch #define CMD2_BIND_PL std::bind(&core::Download::c_peer_list, std::placeholders::_1) #define CMD2_BIND_TL std::bind(&core::Download::tracker_list, std::placeholders::_1) +#define CMD2_BIND_INFO std::bind(&core::Download::info, std::placeholders::_1) +#define CMD2_BIND_DATA std::bind(&core::Download::data, std::placeholders::_1) + #define CMD2_DL_VAR_VALUE(key, first_key, second_key) \ CMD2_DL(key, std::bind(&download_get_variable, std::placeholders::_1, first_key, second_key)); \ CMD2_DL_VALUE_P(key ".set", std::bind(&download_set_variable_value, \ @@ -761,6 +764,12 @@ initialize_command_download() { CMD2_DL ("d.peers_complete", CMD2_ON_DL(peers_complete)); CMD2_DL ("d.peers_accounted", CMD2_ON_DL(peers_accounted)); + CMD2_DL_V ("d.disconnect.seeders", std::bind(&torrent::ConnectionList::erase_seeders, CMD2_BIND_CL)); + + CMD2_DL ("d.accepting_seeders", CMD2_ON_INFO(is_accepting_seeders)); + CMD2_DL_V ("d.accepting_seeders.enable", std::bind(&torrent::DownloadInfo::public_set_flags, CMD2_BIND_INFO, torrent::DownloadInfo::flag_accepting_seeders)); + CMD2_DL_V ("d.accepting_seeders.disable", std::bind(&torrent::DownloadInfo::public_unset_flags, CMD2_BIND_INFO, torrent::DownloadInfo::flag_accepting_seeders)); + CMD2_DL ("d.throttle_name", std::bind(&download_get_variable, std::placeholders::_1, "rtorrent", "throttle_name")); CMD2_DL_STRING_V("d.throttle_name.set", std::bind(&core::Download::set_throttle_name, std::placeholders::_1, std::placeholders::_2)); diff --git a/src/ui/download.cc b/src/ui/download.cc index 08c9b9f7..e2395576 100644 --- a/src/ui/download.cc +++ b/src/ui/download.cc @@ -176,7 +176,7 @@ Download::create_info() { element->push_column("Safe diskspace:", te_command("cat=$convert.mb=$pieces.sync.safe_free_diskspace=,\" MB\"")); element->push_back(""); - element->push_column("Connection type:", te_command("d.connection_current=")); + element->push_column("Connection type:", te_command("cat=(d.connection_current),\" \",(if,(d.accepting_seeders),"",\"no_seeders\")")); element->push_column("Choke heuristic:", te_command("cat=(d.up.choke_heuristics),\", \",(d.down.choke_heuristics),\", \",(d.group)")); element->push_column("Safe sync:", te_command("if=$pieces.sync.always_safe=,yes,no")); element->push_column("Send buffer:", te_command("cat=$convert.kb=$network.send_buffer.size=,\" KB\""));