* Cleaning up command names. The deprecated commands will be redirected.

git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@1131 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
rakshasa
2010-02-16 17:29:53 +00:00
parent 31abf85846
commit 3cae3d37be
15 changed files with 130 additions and 108 deletions
+13 -1
View File
@@ -77,6 +77,10 @@ create_new_key(const std::string& key, const char postfix[postfix_size]) {
//
// Add a new user-defined method called 'name' and any number of
// lines.
//
// TODO: Make a static version of this that doesn't need to be called
// as a command, and which takes advantage of static const char
// strings, etc.
torrent::Object
system_method_insert(__UNUSED rpc::target_type target, const torrent::Object& rawArgs) {
const torrent::Object::list_type& args = rawArgs.as_list();
@@ -96,7 +100,6 @@ system_method_insert(__UNUSED rpc::target_type target, const torrent::Object& ra
if (options.find("private") != std::string::npos)
flags &= ~rpc::CommandMap::flag_public_xmlrpc;
if (options.find("const") != std::string::npos)
flags &= ~rpc::CommandMap::flag_modifiable;
@@ -113,6 +116,15 @@ system_method_insert(__UNUSED rpc::target_type target, const torrent::Object& ra
rpc::commands.insert_type(create_new_key<0>(rawKey, ""), command, slot, flags, NULL, NULL);
} else if (options.find("redirect") != std::string::npos) {
if (++itrArgs == args.end())
throw torrent::input_error("Invalid argument count.");
rpc::Command::any_slot slot = &rpc::CommandFunction::call_redirect;
rpc::Command* command = new rpc::CommandFunction(itrArgs->as_string());
rpc::commands.insert_type(create_new_key<0>(rawKey, ""), command, slot, flags, NULL, NULL);
} else if (options.find("value") != std::string::npos ||
options.find("bool") != std::string::npos ||
options.find("string") != std::string::npos ||