mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-08-11 04:32:30 +00:00
* Added separate '-I' and '-K' switches, the former is for testing rtorrent code, the latter for webui's.
git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@1178 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
@@ -361,6 +361,7 @@ system_method_list_keys(const torrent::Object::string_type& args) {
|
||||
void
|
||||
initialize_command_dynamic() {
|
||||
CMD2_VAR_BOOL ("method.use_deprecated", true);
|
||||
CMD2_VAR_VALUE ("method.use_intermediate", 1);
|
||||
|
||||
CMD2_ANY_LIST ("method.insert", std::tr1::bind(&system_method_insert, std::tr1::placeholders::_2));
|
||||
|
||||
|
||||
@@ -322,9 +322,6 @@ initialize_command_events() {
|
||||
CMD2_ANY_LIST ("schedule2", std::tr1::bind(&apply_schedule, std::tr1::placeholders::_2));
|
||||
CMD2_ANY_STRING_V("schedule_remove2", std::tr1::bind(&rpc::CommandScheduler::erase_str, control->command_scheduler(), std::tr1::placeholders::_2));
|
||||
|
||||
CMD2_REDIRECT_GENERIC("schedule", "schedule2");
|
||||
CMD2_REDIRECT_GENERIC("schedule_remove", "schedule_remove2");
|
||||
|
||||
CMD2_ANY_STRING_V("import", std::tr1::bind(&apply_import, std::tr1::placeholders::_2));
|
||||
CMD2_ANY_STRING_V("try_import", std::tr1::bind(&apply_try_import, std::tr1::placeholders::_2));
|
||||
|
||||
|
||||
@@ -130,13 +130,20 @@ void initialize_commands();
|
||||
rpc::commands.create_redirect(from_key, to_key, rpc::CommandMap::flag_public_xmlrpc | rpc::CommandMap::flag_dont_delete);
|
||||
#define CMD2_REDIRECT_GENERIC(from_key, to_key) \
|
||||
rpc::commands.create_redirect(from_key, to_key, rpc::CommandMap::flag_public_xmlrpc | rpc::CommandMap::flag_no_target | rpc::CommandMap::flag_dont_delete);
|
||||
#define CMD2_REDIRECT_GENERIC_NO_EXPORT(from_key, to_key) \
|
||||
rpc::commands.create_redirect(from_key, to_key, rpc::CommandMap::flag_no_target | rpc::CommandMap::flag_dont_delete);
|
||||
#define CMD2_REDIRECT_FILE(from_key, to_key) \
|
||||
rpc::commands.create_redirect(from_key, to_key, rpc::CommandMap::flag_public_xmlrpc | rpc::CommandMap::flag_file_target | rpc::CommandMap::flag_dont_delete);
|
||||
#define CMD2_REDIRECT_TRACKER(from_key, to_key) \
|
||||
rpc::commands.create_redirect(from_key, to_key, rpc::CommandMap::flag_public_xmlrpc | rpc::CommandMap::flag_tracker_target | rpc::CommandMap::flag_dont_delete);
|
||||
|
||||
#define CMD2_REDIRECT_GENERIC_STR(from_key, to_key) \
|
||||
rpc::commands.create_redirect(create_new_key<0>(from_key, ""), create_new_key<0>(to_key, ""), rpc::CommandMap::flag_public_xmlrpc | rpc::CommandMap::flag_no_target | rpc::CommandMap::flag_delete_key);
|
||||
#define CMD2_REDIRECT_GENERIC_STR(from_key, to_key) \
|
||||
rpc::commands.create_redirect(create_new_key<0>(from_key, ""), create_new_key<0>(to_key, ""), \
|
||||
rpc::CommandMap::flag_public_xmlrpc | rpc::CommandMap::flag_no_target | rpc::CommandMap::flag_delete_key);
|
||||
|
||||
#define CMD2_REDIRECT_GENERIC_STR_NO_EXPORT(from_key, to_key) \
|
||||
rpc::commands.create_redirect(create_new_key<0>(from_key, ""), create_new_key<0>(to_key, ""), \
|
||||
rpc::CommandMap::flag_no_target | rpc::CommandMap::flag_delete_key);
|
||||
|
||||
//
|
||||
// Conversion of return types:
|
||||
|
||||
+16
-2
@@ -160,14 +160,14 @@ group_insert(const torrent::Object::list_type& args) {
|
||||
|
||||
rpc::commands.call("method.insert", rpc::create_object_list("group2." + name + ".view", "string", view));
|
||||
|
||||
rpc::commands.call("method.insert", rpc::create_object_list("group2." + name + ".ratio.enable", "simple", "schedule2=group." + name + ".ratio,5,60,on_ratio=" + name));
|
||||
rpc::commands.call("method.insert", rpc::create_object_list("group2." + name + ".ratio.enable", "simple", "schedule22=group." + name + ".ratio,5,60,on_ratio=" + name));
|
||||
rpc::commands.call("method.insert", rpc::create_object_list("group2." + name + ".ratio.disable", "simple", "schedule_remove2=group." + name + ".ratio"));
|
||||
rpc::commands.call("method.insert", rpc::create_object_list("group." + name + ".ratio.command", "simple", "d.try_close= ;d.ignore_commands.set=1"));
|
||||
rpc::commands.call("method.insert", rpc::create_object_list("group2." + name + ".ratio.min", "value", (int64_t)200));
|
||||
rpc::commands.call("method.insert", rpc::create_object_list("group2." + name + ".ratio.max", "value", (int64_t)300));
|
||||
rpc::commands.call("method.insert", rpc::create_object_list("group2." + name + ".ratio.upload", "value", (int64_t)20 << 20));
|
||||
|
||||
if (rpc::call_command_value("method.use_deprecated")) {
|
||||
if (rpc::call_command_value("method.use_intermediate") == 1) {
|
||||
// Deprecated in 0.7.0:
|
||||
|
||||
CMD2_REDIRECT_GENERIC_STR("group." + name + ".view", "group2." + name + ".view");
|
||||
@@ -180,6 +180,20 @@ group_insert(const torrent::Object::list_type& args) {
|
||||
CMD2_REDIRECT_GENERIC_STR("group." + name + ".ratio.max.set", "group2." + name + ".ratio.max.set");
|
||||
CMD2_REDIRECT_GENERIC_STR("group." + name + ".ratio.upload", "group2." + name + ".ratio.upload");
|
||||
CMD2_REDIRECT_GENERIC_STR("group." + name + ".ratio.upload.set", "group2." + name + ".ratio.upload.set");
|
||||
|
||||
} if (rpc::call_command_value("method.use_intermediate") == 2) {
|
||||
// Deprecated in 0.7.0:
|
||||
|
||||
CMD2_REDIRECT_GENERIC_STR_NO_EXPORT("group." + name + ".view", "group2." + name + ".view");
|
||||
CMD2_REDIRECT_GENERIC_STR_NO_EXPORT("group." + name + ".view.set", "group2." + name + ".view.set");
|
||||
CMD2_REDIRECT_GENERIC_STR_NO_EXPORT("group." + name + ".ratio.enable", "group2." + name + ".ratio.enable");
|
||||
CMD2_REDIRECT_GENERIC_STR_NO_EXPORT("group." + name + ".ratio.disable", "group2." + name + ".ratio.disable");
|
||||
CMD2_REDIRECT_GENERIC_STR_NO_EXPORT("group." + name + ".ratio.min", "group2." + name + ".ratio.min");
|
||||
CMD2_REDIRECT_GENERIC_STR_NO_EXPORT("group." + name + ".ratio.min.set", "group2." + name + ".ratio.min.set");
|
||||
CMD2_REDIRECT_GENERIC_STR_NO_EXPORT("group." + name + ".ratio.max", "group2." + name + ".ratio.max");
|
||||
CMD2_REDIRECT_GENERIC_STR_NO_EXPORT("group." + name + ".ratio.max.set", "group2." + name + ".ratio.max.set");
|
||||
CMD2_REDIRECT_GENERIC_STR_NO_EXPORT("group." + name + ".ratio.upload", "group2." + name + ".ratio.upload");
|
||||
CMD2_REDIRECT_GENERIC_STR_NO_EXPORT("group." + name + ".ratio.upload.set", "group2." + name + ".ratio.upload.set");
|
||||
}
|
||||
|
||||
return name;
|
||||
|
||||
+41
-17
@@ -88,6 +88,8 @@ parse_options(Control* c, int argc, char** argv) {
|
||||
optionParser.insert_flag('h', sigc::ptr_fun(&print_help));
|
||||
optionParser.insert_flag('n', OptionParser::Slot());
|
||||
optionParser.insert_flag('D', OptionParser::Slot());
|
||||
optionParser.insert_flag('I', OptionParser::Slot());
|
||||
optionParser.insert_flag('K', OptionParser::Slot());
|
||||
|
||||
optionParser.insert_option('b', sigc::bind<0>(sigc::ptr_fun(&rpc::call_command_set_string), "network.bind_address.set"));
|
||||
optionParser.insert_option('d', sigc::bind<0>(sigc::ptr_fun(&rpc::call_command_set_string), "directory.default.set"));
|
||||
@@ -188,13 +190,20 @@ main(int argc, char** argv) {
|
||||
// torrent::ConnectionManager* are valid etc.
|
||||
initialize_commands();
|
||||
|
||||
if (OptionParser::has_flag('D', argc, argv))
|
||||
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.");
|
||||
}
|
||||
|
||||
if (OptionParser::has_flag('I', argc, argv)) {
|
||||
rpc::call_command_set_value("method.use_intermediate.set", 0);
|
||||
control->core()->push_log("Disabled intermediate commands.");
|
||||
}
|
||||
|
||||
if (OptionParser::has_flag('K', argc, argv)) {
|
||||
rpc::call_command_set_value("method.use_intermediate.set", 2);
|
||||
control->core()->push_log("Allowing intermediate commands without xmlrpc.");
|
||||
}
|
||||
|
||||
rpc::parse_command_multiple
|
||||
(rpc::make_target(),
|
||||
@@ -292,12 +301,12 @@ main(int argc, char** argv) {
|
||||
"view.sort_new = seeding,less=d.state_changed=\n"
|
||||
"view.sort_current = seeding,less=d.state_changed=\n"
|
||||
|
||||
"schedule = view.main,10,10,\"view.sort=main,20\"\n"
|
||||
"schedule = view.name,10,10,\"view.sort=name,20\"\n"
|
||||
"schedule2 = view.main,10,10,\"view.sort=main,20\"\n"
|
||||
"schedule2 = view.name,10,10,\"view.sort=name,20\"\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"
|
||||
"schedule2 = session_save,1200,1200,session.save=\n"
|
||||
"schedule2 = low_diskspace,5,60,close_low_diskspace=500M\n"
|
||||
"schedule2 = prune_file_status,3600,86400,system.file_status_cache.prune=\n"
|
||||
|
||||
"protocol.encryption.set=allow_incoming,prefer_plaintext,enable_retry\n"
|
||||
);
|
||||
@@ -305,7 +314,7 @@ main(int argc, char** argv) {
|
||||
// Functions that might not get depracted as they are nice for
|
||||
// configuration files, and thus might do with just some
|
||||
// cleanup.
|
||||
CMD2_REDIRECT_GENERIC("upload_rate", "throttle.global_up.max_rate.set_kb");
|
||||
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");
|
||||
@@ -350,10 +359,30 @@ main(int argc, char** argv) {
|
||||
CMD2_REDIRECT_GENERIC("directory", "directory.default.set");
|
||||
CMD2_REDIRECT_GENERIC("session", "session.path.set");
|
||||
|
||||
CMD2_REDIRECT_GENERIC("execute", "execute2");
|
||||
CMD2_REDIRECT ("key_layout", "keys.layout.set");
|
||||
|
||||
// Deprecated commands. Don't use these anymore.
|
||||
|
||||
if (rpc::call_command_value("method.use_intermediate") == 1) {
|
||||
CMD2_REDIRECT_GENERIC("execute", "execute2");
|
||||
|
||||
CMD2_REDIRECT_GENERIC("group.insert", "group2.insert");
|
||||
CMD2_REDIRECT_GENERIC("group.insert_persistent_view", "group2.insert_persistent_view");
|
||||
|
||||
CMD2_REDIRECT_GENERIC("schedule", "schedule2");
|
||||
CMD2_REDIRECT_GENERIC("schedule_remove", "schedule_remove2");
|
||||
|
||||
} else if (rpc::call_command_value("method.use_intermediate") == 2) {
|
||||
// Allow for use in config files, etc, just don't export it.
|
||||
CMD2_REDIRECT_GENERIC_NO_EXPORT("execute", "execute2");
|
||||
|
||||
CMD2_REDIRECT_GENERIC_NO_EXPORT("group.insert", "group2.insert");
|
||||
CMD2_REDIRECT_GENERIC_NO_EXPORT("group.insert_persistent_view", "group2.insert_persistent_view");
|
||||
|
||||
CMD2_REDIRECT_GENERIC_NO_EXPORT("schedule", "schedule2");
|
||||
CMD2_REDIRECT_GENERIC_NO_EXPORT("schedule_remove", "schedule_remove2");
|
||||
}
|
||||
|
||||
if (rpc::call_command_value("method.use_deprecated")) {
|
||||
// Deprecated in 0.7.0:
|
||||
|
||||
@@ -373,9 +402,6 @@ main(int argc, char** argv) {
|
||||
|
||||
CMD2_REDIRECT ("session_save", "session.save");
|
||||
|
||||
CMD2_REDIRECT_GENERIC("group.insert", "group2.insert");
|
||||
CMD2_REDIRECT_GENERIC("group.insert_persistent_view", "group2.insert_persistent_view");
|
||||
|
||||
CMD2_REDIRECT ("get_handshake_log", "log.handshake");
|
||||
CMD2_REDIRECT_GENERIC("set_handshake_log", "log.handshake.set");
|
||||
CMD2_REDIRECT ("get_log.tracker", "log.tracker");
|
||||
@@ -414,8 +440,6 @@ main(int argc, char** argv) {
|
||||
CMD2_REDIRECT_GENERIC("get_max_memory_usage", "pieces.memory.max");
|
||||
CMD2_REDIRECT_GENERIC("set_max_memory_usage", "pieces.memory.max.set");
|
||||
|
||||
CMD2_REDIRECT ("key_layout", "keys.layout.set");
|
||||
|
||||
CMD2_REDIRECT_GENERIC("load", "load.normal");
|
||||
CMD2_REDIRECT_GENERIC("load_verbose", "load.verbose");
|
||||
CMD2_REDIRECT_GENERIC("load_start", "load.start");
|
||||
|
||||
@@ -80,7 +80,8 @@ CommandMap::insert(key_type key, int flags, const char* parm, const char* doc) {
|
||||
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())
|
||||
if (rpc::xmlrpc.is_valid() && (flags & flag_public_xmlrpc))
|
||||
// if (rpc::xmlrpc.is_valid())
|
||||
rpc::xmlrpc.insert_command(key, parm, doc);
|
||||
|
||||
return base_type::insert(itr, value_type(key, command_map_data_type(flags, parm, doc)));
|
||||
@@ -134,10 +135,10 @@ CommandMap::create_redirect(key_type key_new, key_type key_dest, int flags) {
|
||||
|
||||
dest_itr->second.m_flags |= flag_has_redirects;
|
||||
|
||||
flags |= dest_itr->second.m_flags & ~(flag_delete_key | flag_has_redirects);
|
||||
flags |= dest_itr->second.m_flags & ~(flag_delete_key | flag_has_redirects | flag_public_xmlrpc);
|
||||
|
||||
// TODO: This is not honoring the public_xmlrpc flags!!!
|
||||
if (rpc::xmlrpc.is_valid())
|
||||
if (rpc::xmlrpc.is_valid() && (flags & flag_public_xmlrpc))
|
||||
rpc::xmlrpc.insert_command(key_new, dest_itr->second.m_parm, dest_itr->second.m_doc);
|
||||
|
||||
iterator itr = base_type::insert(base_type::end(),
|
||||
|
||||
Reference in New Issue
Block a user