* Added groups and started reworking the ratio handling.

git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@1078 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
rakshasa
2008-11-09 16:20:57 +00:00
parent 5166253190
commit 66a2af991a
3 changed files with 72 additions and 50 deletions
+13 -5
View File
@@ -67,7 +67,7 @@ create_new_key(const std::string& key, const char postfix[postfix_size]) {
}
// system.method.insert <generic> {name, "simple|private|const", ...}
// system.method.insert <generic> {name, "list|private|const"}
// system.method.insert <generic> {name, "multi|private|const"}
// system.method.insert <generic> {name, "value|private|const"}
// system.method.insert <generic> {name, "value|private|const", value}
// system.method.insert <generic> {name, "bool|private|const"}
@@ -100,7 +100,7 @@ system_method_insert(__UNUSED rpc::target_type target, const torrent::Object& ra
if (options.find("const") != std::string::npos)
flags &= ~rpc::CommandMap::flag_modifiable;
if (options.find("list") != std::string::npos) {
if (options.find("multi") != std::string::npos) {
// Later, make it possible to add functions here.
rpc::Command* command = new rpc::CommandFunctionList();
rpc::Command::any_slot slot = &rpc::CommandFunctionList::call;
@@ -115,7 +115,8 @@ system_method_insert(__UNUSED rpc::target_type target, const torrent::Object& ra
} else if (options.find("value") != std::string::npos ||
options.find("bool") != std::string::npos ||
options.find("string") != std::string::npos) {
options.find("string") != std::string::npos ||
options.find("list") != std::string::npos) {
rpc::CommandVariable *command;
rpc::Command::cleaned_slot getSlot;
rpc::Command::cleaned_slot setSlot;
@@ -128,10 +129,15 @@ system_method_insert(__UNUSED rpc::target_type target, const torrent::Object& ra
command = new rpc::CommandVariable(int64_t());
getSlot = &rpc::CommandVariable::get_bool;
setSlot = &rpc::CommandVariable::set_bool;
} else {
} else if (options.find("string") != std::string::npos) {
command = new rpc::CommandVariable(std::string());
getSlot = &rpc::CommandVariable::get_string;
setSlot = &rpc::CommandVariable::set_string;
} else {
// command = new rpc::CommandVariable(torrent::Object::create_list());
// getSlot = &rpc::CommandVariable::get_string;
// setSlot = &rpc::CommandVariable::set_string;
throw torrent::input_error("No support for 'list' variable type.");
}
// Only allow deletion after adding a flag that ensures we search
@@ -140,7 +146,9 @@ system_method_insert(__UNUSED rpc::target_type target, const torrent::Object& ra
flags &= ~rpc::CommandMap::flag_modifiable;
rpc::commands.insert_type(create_new_key<0>(rawKey, ""), command, getSlot, flags, NULL, NULL);
rpc::commands.insert_type(create_new_key<5>(rawKey, ".set"), command, setSlot, flags | rpc::CommandMap::flag_dont_delete, NULL, NULL);
if (options.find("static") == std::string::npos)
rpc::commands.insert_type(create_new_key<5>(rawKey, ".set"), command, setSlot, flags | rpc::CommandMap::flag_dont_delete, NULL, NULL);
if (++itrArgs != args.end())
(*setSlot)(command, NULL, *itrArgs);