* Fixed more commands.

git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@1177 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
rakshasa
2010-10-05 03:36:14 +00:00
parent c12f698c95
commit 033e30af04
7 changed files with 82 additions and 61 deletions
+2 -2
View File
@@ -1,4 +1,4 @@
AC_INIT(rtorrent, 0.8.6, jaris@ifi.uio.no)
AC_INIT(rtorrent, 0.8.7, jaris@ifi.uio.no)
AM_INIT_AUTOMAKE
AM_CONFIG_HEADER(config.h)
@@ -35,7 +35,7 @@ PKG_CHECK_MODULES(libcurl, libcurl >= 7.15.4,
CXXFLAGS="$CXXFLAGS $libcurl_CFLAGS";
LIBS="$LIBS $libcurl_LIBS")
PKG_CHECK_MODULES(libtorrent, libtorrent >= 0.12.6,
PKG_CHECK_MODULES(libtorrent, libtorrent >= 0.12.7,
CXXFLAGS="$CXXFLAGS $libtorrent_CFLAGS";
LIBS="$LIBS $libtorrent_LIBS")
+20 -19
View File
@@ -127,8 +127,8 @@ system_get_cwd() {
}
torrent::Object
system_set_cwd(const torrent::Object& rawArgs) {
if (::chdir(rawArgs.as_string().c_str()) != 0)
system_set_cwd(const torrent::Object::string_type& rawArgs) {
if (::chdir(rawArgs.c_str()) != 0)
throw torrent::input_error("Could not change current working directory.");
return torrent::Object();
@@ -222,9 +222,6 @@ initialize_command_local() {
CMD2_VAR_VALUE ("system.file.max_size", -1);
CMD2_VAR_VALUE ("system.file.split_size", -1);
CMD2_VAR_STRING ("system.file.split_suffix", ".part");
CMD2_VAR_STRING ("system.session_name", "");
CMD2_VAR_BOOL ("system.session.use_lock", true);
CMD2_VAR_BOOL ("system.session.on_completion", true);
CMD2_ANY ("system.file_status_cache.size", std::tr1::bind(&utils::FileStatusCache::size,
(utils::FileStatusCache::base_type*)control->core()->file_status_cache()));
@@ -238,8 +235,10 @@ initialize_command_local() {
CMD2_ANY ("system.time_seconds", std::tr1::bind(&rak::timer::current_seconds));
CMD2_ANY ("system.time_usec", std::tr1::bind(&rak::timer::current_usec));
// ADD_COMMAND_VALUE_SET_OCT("system.", "umask", std::ptr_fun(&umask));
// ADD_COMMAND_STRING_PREFIX("system.", "cwd", std::ptr_fun(system_set_cwd), rak::ptr_fun(&system_get_cwd));
CMD2_ANY_VALUE_V ("system.umask.set", std::tr1::bind(&umask, std::tr1::placeholders::_2));
CMD2_ANY ("system.cwd", std::tr1::bind(&system_get_cwd));
CMD2_ANY_STRING ("system.cwd.set", std::tr1::bind(&system_set_cwd, std::tr1::placeholders::_2));
CMD2_ANY ("pieces.sync.always_safe", std::tr1::bind(&CM_t::safe_sync, chunkManager));
CMD2_ANY_VALUE_V ("pieces.sync.always_safe.set", std::tr1::bind(&CM_t::set_safe_sync, chunkManager, std::tr1::placeholders::_2));
@@ -264,25 +263,27 @@ initialize_command_local() {
CMD2_VAR_BOOL ("pieces.hash.on_completion", true);
CMD2_VAR_STRING ("directory.default", "./");
CMD2_VAR_STRING ("directory.default", "./");
// TODO: Clean up.
CMD2_ANY ("get_session", std::tr1::bind(&core::DownloadStore::path, dStore));
CMD2_ANY_STRING_V("set_session", std::tr1::bind(&core::DownloadStore::set_path, dStore, std::tr1::placeholders::_2));
CMD2_ANY_STRING_V("session", std::tr1::bind(&core::DownloadStore::set_path, dStore, std::tr1::placeholders::_2));
CMD2_VAR_STRING ("session.name", "");
CMD2_VAR_BOOL ("session.use_lock", true);
CMD2_VAR_BOOL ("session.on_completion", true);
CMD2_ANY_V ("session_save", std::tr1::bind(&core::DownloadList::session_save, dList));
CMD2_ANY ("session.path", std::tr1::bind(&core::DownloadStore::path, dStore));
CMD2_ANY_STRING_V("session.path.set", std::tr1::bind(&core::DownloadStore::set_path, dStore, std::tr1::placeholders::_2));
CMD2_ANY_V ("session.save", std::tr1::bind(&core::DownloadList::session_save, dList));
#define CMD2_EXECUTE(key, flags) \
CMD2_ANY(key, std::tr1::bind(&rpc::ExecFile::execute_object, &rpc::execFile, std::tr1::placeholders::_2, flags));
CMD2_EXECUTE ("execute2", rpc::ExecFile::flag_expand_tilde | rpc::ExecFile::flag_throw);
CMD2_EXECUTE ("execute_throw", rpc::ExecFile::flag_expand_tilde | rpc::ExecFile::flag_throw);
CMD2_EXECUTE ("execute_nothrow", rpc::ExecFile::flag_expand_tilde);
CMD2_EXECUTE ("execute_raw", rpc::ExecFile::flag_throw);
CMD2_EXECUTE ("execute_raw_nothrow", 0);
CMD2_EXECUTE ("execute_capture", rpc::ExecFile::flag_throw | rpc::ExecFile::flag_expand_tilde | rpc::ExecFile::flag_capture);
CMD2_EXECUTE ("execute_capture_nothrow", rpc::ExecFile::flag_expand_tilde | rpc::ExecFile::flag_capture);
CMD2_EXECUTE ("execute.throw", rpc::ExecFile::flag_expand_tilde | rpc::ExecFile::flag_throw);
CMD2_EXECUTE ("execute.nothrow", rpc::ExecFile::flag_expand_tilde);
CMD2_EXECUTE ("execute.raw", rpc::ExecFile::flag_throw);
CMD2_EXECUTE ("execute.raw_nothrow", 0);
CMD2_EXECUTE ("execute.capture", rpc::ExecFile::flag_throw | rpc::ExecFile::flag_expand_tilde | rpc::ExecFile::flag_capture);
CMD2_EXECUTE ("execute.capture_nothrow", rpc::ExecFile::flag_expand_tilde | rpc::ExecFile::flag_capture);
CMD2_ANY_STRING ("log.execute", std::tr1::bind(&apply_log, std::tr1::placeholders::_2, 0));
CMD2_ANY_STRING ("log.vmmap.dump", std::tr1::bind(&log_vmmap_dump, std::tr1::placeholders::_2));
+1 -1
View File
@@ -108,7 +108,7 @@ Control::initialize() {
m_core->initialize_second();
m_core->listen_open();
m_core->download_store()->enable(rpc::call_command_value("system.session.use_lock"));
m_core->download_store()->enable(rpc::call_command_value("session.use_lock"));
m_core->set_hashing_view(*m_viewManager->find_throw("hashing"));
+1 -1
View File
@@ -589,7 +589,7 @@ DownloadList::confirm_finished(Download* download) {
// the download.
//
// Obsolete.
if (!download->is_active() && rpc::call_command_value("system.session.on_completion") != 0) {
if (!download->is_active() && rpc::call_command_value("session.on_completion") != 0) {
// torrent::resume_save_progress(*download->download(), download->download()->bencode()->get_key("libtorrent_resume"));
control->core()->download_store()->save_resume(download);
}
+52 -37
View File
@@ -98,9 +98,6 @@ parse_options(Control* c, int argc, char** argv) {
optionParser.insert_option('O', sigc::ptr_fun(&rpc::parse_command_single_std));
optionParser.insert_option_list('o', sigc::ptr_fun(&rpc::call_command_set_std_string));
if (OptionParser::has_flag('D', argc, argv))
rpc::call_command_set_value("method.use_deprecated", false);
return optionParser.process(argc, argv);
} catch (torrent::input_error& e) {
@@ -191,6 +188,14 @@ main(int argc, char** argv) {
// torrent::ConnectionManager* are valid etc.
initialize_commands();
if (OptionParser::has_flag('D', argc, argv))
rpc::call_command_set_value("method.use_deprecated.set", false);
if (rpc::call_command_value("method.use_deprecated"))
control->core()->push_log("Allowing deprecated commands.");
else
control->core()->push_log("Disabled deprecated commands.");
rpc::parse_command_multiple
(rpc::make_target(),
// "method.insert = test.value,value\n"
@@ -237,7 +242,7 @@ main(int argc, char** argv) {
"group2.insert = seeding,seeding\n"
"system.session_name = \"$cat=$system.hostname=,:,$system.pid=\"\n"
"session.name = \"$cat=$system.hostname=,:,$system.pid=\"\n"
// Currently not doing any sorting on main.
"view.add = main\n"
@@ -290,7 +295,7 @@ main(int argc, char** argv) {
"schedule = view.main,10,10,\"view.sort=main,20\"\n"
"schedule = view.name,10,10,\"view.sort=name,20\"\n"
"schedule = session_save,1200,1200,session_save=\n"
"schedule = session_save,1200,1200,session.save=\n"
"schedule = low_diskspace,5,60,close_low_diskspace=500M\n"
"schedule = prune_file_status,3600,86400,system.file_status_cache.prune=\n"
@@ -303,13 +308,13 @@ main(int argc, char** argv) {
CMD2_REDIRECT_GENERIC("upload_rate", "throttle.global_up.max_rate.set_kb");
CMD2_REDIRECT_GENERIC("download_rate", "throttle.global_down.max_rate.set_kb");
CMD2_REDIRECT_GENERIC("ratio.enable", "group2.seeding.ratio.enable");
CMD2_REDIRECT_GENERIC("ratio.disable", "group2.seeding.ratio.disable");
CMD2_REDIRECT_GENERIC("ratio.min", "group2.seeding.ratio.min");
CMD2_REDIRECT_GENERIC("ratio.max", "group2.seeding.ratio.max");
CMD2_REDIRECT_GENERIC("ratio.upload", "group2.seeding.ratio.upload");
CMD2_REDIRECT_GENERIC("ratio.min.set", "group2.seeding.ratio.min.set");
CMD2_REDIRECT_GENERIC("ratio.max.set", "group2.seeding.ratio.max.set");
CMD2_REDIRECT_GENERIC("ratio.enable", "group2.seeding.ratio.enable");
CMD2_REDIRECT_GENERIC("ratio.disable", "group2.seeding.ratio.disable");
CMD2_REDIRECT_GENERIC("ratio.min", "group2.seeding.ratio.min");
CMD2_REDIRECT_GENERIC("ratio.max", "group2.seeding.ratio.max");
CMD2_REDIRECT_GENERIC("ratio.upload", "group2.seeding.ratio.upload");
CMD2_REDIRECT_GENERIC("ratio.min.set", "group2.seeding.ratio.min.set");
CMD2_REDIRECT_GENERIC("ratio.max.set", "group2.seeding.ratio.max.set");
CMD2_REDIRECT_GENERIC("ratio.upload.set", "group2.seeding.ratio.upload.set");
CMD2_REDIRECT_GENERIC("encryption", "protocol.encryption.set");
@@ -325,19 +330,25 @@ main(int argc, char** argv) {
CMD2_REDIRECT ("max_uploads", "throttle.max_uploads.set");
CMD2_REDIRECT ("max_uploads_div", "throttle.max_uploads.div.set");
CMD2_REDIRECT ("max_uploads_global", "throttle.max_uploads.global.set");
CMD2_REDIRECT ("max_downloads_div", "throttle.max_downloads.div.set");
CMD2_REDIRECT ("max_uploads_div", "throttle.max_uploads.div.set");
CMD2_REDIRECT ("max_uploads_global", "throttle.max_uploads.global.set");
CMD2_REDIRECT ("max_downloads_div", "throttle.max_downloads.div.set");
CMD2_REDIRECT ("max_downloads_global", "throttle.max_downloads.global.set");
CMD2_REDIRECT ("bind", "network.bind_address.set");
CMD2_REDIRECT ("ip", "network.local_address.set");
CMD2_REDIRECT_GENERIC("max_memory_usage", "pieces.memory.max.set");
CMD2_REDIRECT ("bind", "network.bind_address.set");
CMD2_REDIRECT ("ip", "network.local_address.set");
CMD2_REDIRECT ("port_range", "network.port_range.set");
CMD2_REDIRECT_GENERIC("dht", "dht.mode.set");
CMD2_REDIRECT_GENERIC("dht_port", "dht.port.set");
CMD2_REDIRECT ("port_random", "network.port_random.set");
CMD2_REDIRECT ("proxy_address", "network.proxy_address.set");
CMD2_REDIRECT_GENERIC("directory", "directory.default.set");
CMD2_REDIRECT_GENERIC("session", "session.path.set");
CMD2_REDIRECT_GENERIC("execute", "execute2");
@@ -354,6 +365,14 @@ main(int argc, char** argv) {
CMD2_REDIRECT_GENERIC("system.method.has_key", "method.has_key");
CMD2_REDIRECT_GENERIC("system.method.set_key", "method.set_key");
CMD2_REDIRECT ("get_directory", "directory.default");
CMD2_REDIRECT_GENERIC("set_directory", "directory.default.set");
CMD2_REDIRECT ("get_session", "session.path");
CMD2_REDIRECT_GENERIC("set_session", "session.path.set");
CMD2_REDIRECT ("session_save", "session.save");
CMD2_REDIRECT_GENERIC("group.insert", "group2.insert");
CMD2_REDIRECT_GENERIC("group.insert_persistent_view", "group2.insert_persistent_view");
@@ -362,8 +381,8 @@ main(int argc, char** argv) {
CMD2_REDIRECT ("get_log.tracker", "log.tracker");
CMD2_REDIRECT_GENERIC("set_log.tracker", "log.tracker.set");
CMD2_REDIRECT ("get_name", "system.session_name");
CMD2_REDIRECT_GENERIC("set_name", "system.session_name.set");
CMD2_REDIRECT ("get_name", "session.name");
CMD2_REDIRECT_GENERIC("set_name", "session.name.set");
CMD2_REDIRECT ("system.file_allocate", "system.file.allocate");
CMD2_REDIRECT ("system.file_allocate.set", "system.file.allocate.set");
@@ -391,7 +410,7 @@ main(int argc, char** argv) {
CMD2_REDIRECT_GENERIC("get_safe_sync", "pieces.sync.always_safe");
CMD2_REDIRECT_GENERIC("set_safe_sync", "pieces.sync.always_safe.set");
CMD2_REDIRECT ("get_memory_usage", "pieces.memory.current");
CMD2_REDIRECT ("get_memory_usage", "pieces.memory.current");
CMD2_REDIRECT_GENERIC("get_max_memory_usage", "pieces.memory.max");
CMD2_REDIRECT_GENERIC("set_max_memory_usage", "pieces.memory.max.set");
@@ -547,25 +566,21 @@ main(int argc, char** argv) {
// DHT stuff
//
CMD2_REDIRECT ("dht", "dht.mode.set");
CMD2_REDIRECT ("dht_add_node", "dht.add_node");
CMD2_REDIRECT ("dht_statistics", "dht.statistics");
CMD2_REDIRECT ("get_dht_port", "dht.port");
CMD2_REDIRECT_GENERIC("set_dht_port", "dht.port");
CMD2_REDIRECT_GENERIC("set_dht_port", "dht.port.set");
CMD2_REDIRECT ("get_dht_throttle", "dht.throttle.name");
CMD2_REDIRECT_GENERIC("set_dht_throttle", "dht.throttle.name.set");
CMD2_REDIRECT ("get_directory", "directory.default");
CMD2_REDIRECT_GENERIC("set_directory", "directory.default.set");
//
// Various system stuff:
//
CMD2_REDIRECT ("get_session_lock", "system.session.use_lock");
CMD2_REDIRECT_GENERIC("set_session_lock", "system.session.use_lock.set");
CMD2_REDIRECT ("get_session_on_completion", "system.session.on_completion");
CMD2_REDIRECT_GENERIC("set_session_on_completion", "system.session.on_completion.set");
CMD2_REDIRECT ("get_session_lock", "session.use_lock");
CMD2_REDIRECT_GENERIC("set_session_lock", "session.use_lock.set");
CMD2_REDIRECT ("get_session_on_completion", "session.on_completion");
CMD2_REDIRECT_GENERIC("set_session_on_completion", "session.on_completion.set");
CMD2_REDIRECT ("hash_read_ahead", "system.hash.read_ahead.set");
CMD2_REDIRECT ("get_hash_read_ahead", "system.hash.read_ahead");
@@ -764,21 +779,21 @@ main(int argc, char** argv) {
CMD2_REDIRECT_GENERIC("to_xb", "convert.xb");
CMD2_REDIRECT_GENERIC("to_throttle", "convert.throttle");
// CMD2_REDIRECT_GENERIC("execute_throw", "execute.throw");
// CMD2_REDIRECT_GENERIC("execute_nothrow", "execute.nothrow");
// CMD2_REDIRECT_GENERIC("execute_raw", "execute.raw");
// CMD2_REDIRECT_GENERIC("execute_raw_nothrow", "execute.raw_nothrow");
// CMD2_REDIRECT_GENERIC("execute_capture", "execute.capture");
// CMD2_REDIRECT_GENERIC("execute_capture_nothrow", "execute.capture_nothrow");
CMD2_REDIRECT_GENERIC("execute_throw", "execute.throw");
CMD2_REDIRECT_GENERIC("execute_nothrow", "execute.nothrow");
CMD2_REDIRECT_GENERIC("execute_raw", "execute.raw");
CMD2_REDIRECT_GENERIC("execute_raw_nothrow", "execute.raw_nothrow");
CMD2_REDIRECT_GENERIC("execute_capture", "execute.capture");
CMD2_REDIRECT_GENERIC("execute_capture_nothrow", "execute.capture_nothrow");
}
int firstArg = parse_options(control, argc, argv);
if (OptionParser::has_flag('n', argc, argv))
control->core()->push_log("Ignoring ~/.rtorrent.rc.");
else
rpc::parse_command_single(rpc::make_target(), "try_import = ~/.rtorrent.rc");
int firstArg = parse_options(control, argc, argv);
control->initialize();
// Load session torrents and perform scheduled tasks to ensure
+5
View File
@@ -79,6 +79,7 @@ CommandMap::insert(key_type key, int flags, const char* parm, const char* doc) {
if (itr != base_type::end())
throw torrent::internal_error("CommandMap::insert(...) tried to insert an already existing key.");
// TODO: This is not honoring the public_xmlrpc flags!!!
if (rpc::xmlrpc.is_valid())
rpc::xmlrpc.insert_command(key, parm, doc);
@@ -135,6 +136,10 @@ CommandMap::create_redirect(key_type key_new, key_type key_dest, int flags) {
flags |= dest_itr->second.m_flags & ~(flag_delete_key | flag_has_redirects);
// TODO: This is not honoring the public_xmlrpc flags!!!
if (rpc::xmlrpc.is_valid())
rpc::xmlrpc.insert_command(key_new, dest_itr->second.m_parm, dest_itr->second.m_doc);
iterator itr = base_type::insert(base_type::end(),
value_type(key_new, command_map_data_type(flags,
dest_itr->second.m_parm,
+1 -1
View File
@@ -222,7 +222,7 @@ DownloadList::activate_display(Display displayType) {
case DISPLAY_DOWNLOAD_LIST:
control->ui()->window_title()->set_title("rTorrent " VERSION "/" +
std::string(torrent::version()) + " - " +
rpc::call_command_string("system.session_name"));
rpc::call_command_string("session.name"));
break;
case DISPLAY_LOG:
control->ui()->window_title()->set_title("Log");