* Put both global and download specific commands in a single

CommandMap.


git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@914 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
rakshasa
2007-06-17 03:14:38 +00:00
parent 297b4b5f1d
commit e9db89e6d6
36 changed files with 330 additions and 345 deletions
+5 -4
View File
@@ -44,6 +44,7 @@
#include <torrent/data/file_list_iterator.h>
#include "core/download.h"
#include "rpc/parse_commands.h"
#include "text_element_lambda.h"
#include "text_element_string.h"
@@ -92,8 +93,8 @@ te_string(Return (torrent::FileList::*fptr)() const, int flags = TextElementStri
}
inline TextElementStringBase*
te_variable_string(const std::string& variable, int flags = TextElementStringBase::flag_normal, int attributes = Attributes::a_invalid) {
return text_element_string_slot(rak::bind2nd(std::mem_fun(&core::Download::get_std_string), variable), flags, attributes);
te_variable_string(const char* variable, int flags = TextElementStringBase::flag_normal, int attributes = Attributes::a_invalid) {
return text_element_string_slot(rak::bind1st(std::ptr_fun(&rpc::call_command_d_string), variable), flags, attributes);
}
// Value stuff:
@@ -117,8 +118,8 @@ te_value(Return (torrent::File::*fptr)() const, int flags = TextElementValueBase
}
inline TextElementValueBase*
te_variable_value(const std::string& variable, int flags = TextElementValueBase::flag_normal, int attributes = Attributes::a_invalid) {
return text_element_value_slot(rak::bind2nd(std::mem_fun(&core::Download::get_std_value), variable), flags, attributes);
te_variable_value(const char* variable, int flags = TextElementValueBase::flag_normal, int attributes = Attributes::a_invalid) {
return text_element_value_slot(rak::bind1st(std::ptr_fun(&rpc::call_command_d_value), variable), flags, attributes);
}
template <typename Return>
+4 -3
View File
@@ -52,6 +52,7 @@
#include "core/download.h"
#include "core/manager.h"
#include "rpc/parse_commands.h"
#include "control.h"
#include "globals.h"
@@ -159,8 +160,8 @@ print_download_info(char* first, char* last, core::Download* d) {
}
first = print_buffer(first, last, " [%c%c R: %3.2f",
d->get_string("get_tied_to_file").empty() ? ' ' : 'T',
d->get_value("get_ignore_commands") == 0 ? ' ' : 'I',
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',
d->download()->bytes_done() > 0 ? (double)(100 * d->download()->up_rate()->total() / d->download()->bytes_done()) / 100 : 0.0);
if (d->priority() != 2)
@@ -178,7 +179,7 @@ char*
print_download_status(char* first, char* last, core::Download* d) {
if (d->is_active())
;
else if (d->get_value("get_hashing") != 0)
else if (rpc::call_command_d_value("get_d_hashing", d) != 0)
first = print_buffer(first, last, "Hashing: ");
else if (!d->is_active())
first = print_buffer(first, last, "Inactive: ");