* Proper fault handling for bad SCGI requests.

* Cleaned up duplicate code in 'xmlrpc.cc'.

* Cleaned up 'parse_commands.h'.


git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@966 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
rakshasa
2007-08-27 23:00:48 +00:00
parent 02b790c0bf
commit 32b74ffc48
19 changed files with 161 additions and 191 deletions
+6 -2
View File
@@ -92,9 +92,13 @@ te_string(Return (torrent::FileList::*fptr)() const, int flags = TextElementStri
return text_element_string_slot(rak::on(std::mem_fun(&core::Download::file_list), std::mem_fun(fptr)), flags, attributes);
}
// TMP HACK
inline std::string te_call_command_d_string(const char* key, core::Download* download) { return rpc::commands.call_command(key, torrent::Object(), rpc::make_target(download)).as_string(); }
inline int64_t te_call_command_d_value(const char* key, core::Download* download) { return rpc::commands.call_command(key, torrent::Object(), rpc::make_target(download)).as_value(); }
inline TextElementStringBase*
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);
return text_element_string_slot(rak::bind1st(std::ptr_fun(&te_call_command_d_string), variable), flags, attributes);
}
// Value stuff:
@@ -119,7 +123,7 @@ te_value(Return (torrent::File::*fptr)() const, int flags = TextElementValueBase
inline TextElementValueBase*
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);
return text_element_value_slot(rak::bind1st(std::ptr_fun(&te_call_command_d_value), variable), flags, attributes);
}
template <typename Return>
+5 -5
View File
@@ -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("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);
rpc::call_command_string("d.get_tied_to_file", rpc::make_target(d)).empty() ? ' ' : 'T',
rpc::call_command_value("d.get_ignore_commands", rpc::make_target(d)) == 0 ? ' ' : 'I',
(double)rpc::call_command_value("d.get_ratio", rpc::make_target(d)) / 1000.0);
if (d->priority() != 2)
first = print_buffer(first, last, " %s]", rpc::call_command_d_string("d.get_priority_str", d).c_str());
first = print_buffer(first, last, " %s]", rpc::call_command_string("d.get_priority_str", rpc::make_target(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("d.get_hashing", d) != 0)
else if (rpc::call_command_value("d.get_hashing", rpc::make_target(d)) != 0)
first = print_buffer(first, last, "Hashing: ");
else if (!d->is_active())
first = print_buffer(first, last, "Inactive: ");