mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-10-17 06:36:18 +00:00
* Fixed a bug where callinging download specific commands through the ui with no torrent selected would cause a crash.
* Added LT_SLIM_VERSION option that will leave out unneeded command redirects from the build. git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@1183 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
@@ -721,10 +721,10 @@ initialize_command_download() {
|
|||||||
CMD2_DL_VALUE_V ("d.peers_min.set", std::tr1::bind(&torrent::ConnectionList::set_min_size, CMD2_BIND_CL, std::tr1::placeholders::_2));
|
CMD2_DL_VALUE_V ("d.peers_min.set", std::tr1::bind(&torrent::ConnectionList::set_min_size, CMD2_BIND_CL, std::tr1::placeholders::_2));
|
||||||
CMD2_DL ("d.peers_max", std::tr1::bind(&torrent::ConnectionList::max_size, CMD2_BIND_CL));
|
CMD2_DL ("d.peers_max", std::tr1::bind(&torrent::ConnectionList::max_size, CMD2_BIND_CL));
|
||||||
CMD2_DL_VALUE_V ("d.peers_max.set", std::tr1::bind(&torrent::ConnectionList::set_max_size, CMD2_BIND_CL, std::tr1::placeholders::_2));
|
CMD2_DL_VALUE_V ("d.peers_max.set", std::tr1::bind(&torrent::ConnectionList::set_max_size, CMD2_BIND_CL, std::tr1::placeholders::_2));
|
||||||
CMD2_DL ("d.uploads_max", std::tr1::bind(&torrent::ConnectionList::max_size, CMD2_BIND_CL));
|
CMD2_DL ("d.uploads_max", std::tr1::bind(&torrent::Download::uploads_max, CMD2_BIND_DL));
|
||||||
CMD2_DL_VALUE_V ("d.uploads_max.set", std::tr1::bind(&torrent::ConnectionList::set_max_size, CMD2_BIND_CL, std::tr1::placeholders::_2));
|
CMD2_DL_VALUE_V ("d.uploads_max.set", std::tr1::bind(&torrent::Download::set_uploads_max, CMD2_BIND_DL, std::tr1::placeholders::_2));
|
||||||
CMD2_DL ("d.peers_connected", std::tr1::bind(&torrent::ConnectionList::size, CMD2_BIND_CL));
|
CMD2_DL ("d.peers_connected", std::tr1::bind(&torrent::ConnectionList::size, CMD2_BIND_CL));
|
||||||
CMD2_DL ("d.peers_not_connected", std::tr1::bind(&torrent::PeerList::available_list_size, CMD2_BIND_PL));
|
CMD2_DL ("d.peers_not_connected", std::tr1::bind(&torrent::PeerList::available_list_size, CMD2_BIND_PL));
|
||||||
|
|
||||||
CMD2_DL ("d.peers_complete", CMD2_ON_DL(peers_complete));
|
CMD2_DL ("d.peers_complete", CMD2_ON_DL(peers_complete));
|
||||||
CMD2_DL ("d.peers_accounted", CMD2_ON_DL(peers_accounted));
|
CMD2_DL ("d.peers_accounted", CMD2_ON_DL(peers_accounted));
|
||||||
|
|||||||
@@ -307,7 +307,8 @@ DownloadFactory::receive_success() {
|
|||||||
torrent::HashString infohash = download->info()->hash();
|
torrent::HashString infohash = download->info()->hash();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
std::for_each(m_commands.begin(), m_commands.end(), rak::bind1st(std::ptr_fun(&rpc::parse_command_d_multiple_std), download));
|
std::for_each(m_commands.begin(), m_commands.end(),
|
||||||
|
rak::bind2nd(std::ptr_fun(&rpc::parse_command_multiple_std), rpc::make_target(download)));
|
||||||
|
|
||||||
if (m_manager->download_list()->find(infohash) == m_manager->download_list()->end())
|
if (m_manager->download_list()->find(infohash) == m_manager->download_list()->end())
|
||||||
throw torrent::input_error("The newly created download was removed.");
|
throw torrent::input_error("The newly created download was removed.");
|
||||||
|
|||||||
@@ -377,6 +377,7 @@ main(int argc, char** argv) {
|
|||||||
CMD2_REDIRECT_GENERIC_NO_EXPORT("schedule_remove", "schedule_remove2");
|
CMD2_REDIRECT_GENERIC_NO_EXPORT("schedule_remove", "schedule_remove2");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if LT_SLIM_VERSION == 1
|
||||||
if (rpc::call_command_value("method.use_deprecated")) {
|
if (rpc::call_command_value("method.use_deprecated")) {
|
||||||
// Deprecated in 0.7.0:
|
// Deprecated in 0.7.0:
|
||||||
|
|
||||||
@@ -804,6 +805,7 @@ main(int argc, char** argv) {
|
|||||||
CMD2_REDIRECT_GENERIC("execute_capture", "execute.capture");
|
CMD2_REDIRECT_GENERIC("execute_capture", "execute.capture");
|
||||||
CMD2_REDIRECT_GENERIC("execute_capture_nothrow", "execute.capture_nothrow");
|
CMD2_REDIRECT_GENERIC("execute_capture_nothrow", "execute.capture_nothrow");
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
int firstArg = parse_options(control, argc, argv);
|
int firstArg = parse_options(control, argc, argv);
|
||||||
|
|
||||||
|
|||||||
@@ -76,6 +76,11 @@ parse_command_single(target_type target, const std::string& cmd) {
|
|||||||
return parse_command(target, cmd.c_str(), cmd.c_str() + cmd.size()).first;
|
return parse_command(target, cmd.c_str(), cmd.c_str() + cmd.size()).first;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline torrent::Object
|
||||||
|
parse_command_multiple_std(const std::string& cmd, target_type target = rpc::make_target()) {
|
||||||
|
return parse_command_multiple(target, cmd.c_str(), cmd.c_str() + cmd.size());
|
||||||
|
}
|
||||||
|
|
||||||
inline void
|
inline void
|
||||||
parse_command_single_std(const std::string& cmd) {
|
parse_command_single_std(const std::string& cmd) {
|
||||||
parse_command(make_target(), cmd.c_str(), cmd.c_str() + cmd.size());
|
parse_command(make_target(), cmd.c_str(), cmd.c_str() + cmd.size());
|
||||||
@@ -91,22 +96,6 @@ parse_command_multiple_d_nothrow(core::Download* download, const std::string& cm
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void
|
|
||||||
parse_command_d_single_std(core::Download* download, const std::string& cmd) {
|
|
||||||
parse_command(make_target(download), cmd.c_str(), cmd.c_str() + cmd.size());
|
|
||||||
}
|
|
||||||
|
|
||||||
inline torrent::Object
|
|
||||||
parse_command_multiple_std(const std::string& cmd) {
|
|
||||||
return parse_command_multiple(make_target(), cmd.c_str(), cmd.c_str() + cmd.size());
|
|
||||||
}
|
|
||||||
|
|
||||||
inline torrent::Object
|
|
||||||
parse_command_d_multiple_std(core::Download* download, const std::string& cmd) {
|
|
||||||
return parse_command_multiple(make_target(download), cmd.c_str(), cmd.c_str() + cmd.size());
|
|
||||||
}
|
|
||||||
|
|
||||||
// inline torrent::Object call_command(const char* key, const torrent::Object& obj, target_type target = target_type((int)CommandMap::target_generic, NULL)) { return commands.call_command(key, obj); }
|
|
||||||
inline torrent::Object call_command (const char* key, const torrent::Object& obj, target_type target = make_target()) { return commands.call_command(key, obj, target); }
|
inline torrent::Object call_command (const char* key, const torrent::Object& obj, target_type target = make_target()) { return commands.call_command(key, obj, target); }
|
||||||
inline torrent::Object call_command_void (const char* key, target_type target = make_target()) { return commands.call_command(key, torrent::Object(), target); }
|
inline torrent::Object call_command_void (const char* key, target_type target = make_target()) { return commands.call_command(key, torrent::Object(), target); }
|
||||||
inline std::string call_command_string(const char* key, target_type target = make_target()) { return commands.call_command(key, torrent::Object(), target).as_string(); }
|
inline std::string call_command_string(const char* key, target_type target = make_target()) { return commands.call_command(key, torrent::Object(), target).as_string(); }
|
||||||
|
|||||||
@@ -318,7 +318,9 @@ DownloadList::receive_exit_input(Input type) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case INPUT_COMMAND:
|
case INPUT_COMMAND:
|
||||||
rpc::parse_command_d_single_std(current_view()->focus() != current_view()->end_visible() ? *current_view()->focus() : NULL, input->str());
|
rpc::parse_command_single(current_view()->focus() != current_view()->end_visible() ?
|
||||||
|
rpc::make_target(*current_view()->focus()) : rpc::make_target(),
|
||||||
|
input->str());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|||||||
Reference in New Issue
Block a user