* Added 'system.method.get', 'ui.current_view.set' and 'group.insert'

commands.

* Enabled different ratio settings for different groups of
downloads.


git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@1079 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
rakshasa
2008-11-10 18:52:36 +00:00
parent 66a2af991a
commit de8a11c4fd
10 changed files with 138 additions and 10 deletions
+14 -1
View File
@@ -180,6 +180,18 @@ system_method_erase(__UNUSED rpc::target_type target, const torrent::Object& raw
return torrent::Object();
}
torrent::Object
system_method_get(__UNUSED rpc::target_type target, const torrent::Object& rawArgs) {
rpc::CommandFunction* function;
rpc::CommandMap::iterator itr = rpc::commands.find(rawArgs.as_string().c_str());
if (itr == rpc::commands.end() ||
(function = dynamic_cast<rpc::CommandFunction*>(itr->second.m_variable)) == NULL)
throw torrent::input_error("Command not modifiable or wrong type.");
return torrent::Object(function->command());
}
torrent::Object
system_method_set(__UNUSED rpc::target_type target, const torrent::Object& rawArgs) {
const torrent::Object::list_type& args = rawArgs.as_list();
@@ -190,7 +202,7 @@ system_method_set(__UNUSED rpc::target_type target, const torrent::Object& rawAr
rpc::CommandFunction* function;
rpc::CommandMap::iterator itr = rpc::commands.find(args.front().as_string().c_str());
if (!rpc::commands.is_modifiable(itr) ||
if (itr == rpc::commands.end() || !rpc::commands.is_modifiable(itr) ||
(function = dynamic_cast<rpc::CommandFunction*>(itr->second.m_variable)) == NULL)
throw torrent::input_error("Command not modifiable or wrong type.");
@@ -262,6 +274,7 @@ void
initialize_command_dynamic() {
CMD_N ("system.method.insert", rak::ptr_fn(&system_method_insert));
CMD_N_STRING("system.method.erase", rak::ptr_fn(&system_method_erase));
CMD_N_STRING("system.method.get", rak::ptr_fn(&system_method_get));
CMD_N ("system.method.set", rak::ptr_fn(&system_method_set));
CMD_N ("system.method.set_key", rak::ptr_fn(&system_method_set_key));
CMD_N ("system.method.has_key", rak::ptr_fn(&system_method_has_key));