diff options
author | xsmile | 2018-05-05 17:26:48 +0200 |
---|---|---|
committer | xsmile | 2018-05-05 17:26:48 +0200 |
commit | b2d2007e7745da76cbd1798482e8407fa18f9700 (patch) | |
tree | 1bda87da70310711ffb32741335b9d61ee4ca503 /command_pyroscope.cc | |
parent | 2dc12354ffe0f0bfabb7bcdae9480109ce7d2b34 (diff) | |
download | aur-b2d2007e7745da76cbd1798482e8407fa18f9700.tar.gz |
update
Diffstat (limited to 'command_pyroscope.cc')
-rw-r--r-- | command_pyroscope.cc | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/command_pyroscope.cc b/command_pyroscope.cc index c1797a9b750a..480158e09294 100644 --- a/command_pyroscope.cc +++ b/command_pyroscope.cc @@ -513,6 +513,27 @@ d_multicall_filtered(const torrent::Object::list_type& args) { } +/* throttle.names= + + Returns a list of all defined throttle names, + including the built-in ones (i.e. '' and NULL). + + https://github.com/pyroscope/rtorrent-ps/issues/65 + */ +torrent::Object cmd_throttle_names() { + torrent::Object result = torrent::Object::create_list(); + torrent::Object::list_type& resultList = result.as_list(); + + resultList.push_back(std::string()); + for (core::ThrottleMap::const_iterator itr = control->core()->throttles().begin(); + itr != control->core()->throttles().end(); itr++) { + resultList.push_back(itr->first); + } + + return result; +} + + torrent::Object::value_type apply_string_contains(bool ignore_case, const torrent::Object::list_type& args) { if (args.size() < 2) { throw torrent::input_error("string.contains[_i] takes at least two arguments!"); @@ -679,13 +700,14 @@ void initialize_command_pyroscope() { #endif #if RT_HEX_VERSION <= 0x000906 - // these are merged into 0.9.7+ mainline! + // these are merged into 0.9.7+ mainline! (well, maybe, PRs are ignored) CMD2_ANY_STRING("system.env", _cxxstd_::bind(&cmd_system_env, _cxxstd_::placeholders::_2)); CMD2_ANY("ui.current_view", _cxxstd_::bind(&cmd_ui_current_view)); CMD2_ANY_LIST("system.random", &apply_random); CMD2_ANY_LIST("d.multicall.filtered", _cxxstd_::bind(&d_multicall_filtered, _cxxstd_::placeholders::_2)); #endif + CMD2_ANY("throttle.names", _cxxstd_::bind(&cmd_throttle_names)); CMD2_ANY_LIST("string.contains", &cmd_string_contains); CMD2_ANY_LIST("string.contains_i", &cmd_string_contains_i); CMD2_ANY_LIST("string.map", &cmd_string_map); |