Mercurial > irccd
comparison irccdctl/rule_move_cli.cpp @ 644:aae6d5a2b28d
Irccd: change how configuration is loaded
author | David Demelier <markand@malikania.fr> |
---|---|
date | Fri, 23 Mar 2018 14:00:03 +0100 |
parents | 27587ff92a64 |
children | 903415e8ee2e |
comparison
equal
deleted
inserted
replaced
643:eff84e503c26 | 644:aae6d5a2b28d |
---|---|
32 void rule_move_cli::exec(ctl::controller& ctl, const std::vector<std::string>& args) | 32 void rule_move_cli::exec(ctl::controller& ctl, const std::vector<std::string>& args) |
33 { | 33 { |
34 if (args.size() < 2) | 34 if (args.size() < 2) |
35 throw std::invalid_argument("rule-move requires 2 arguments"); | 35 throw std::invalid_argument("rule-move requires 2 arguments"); |
36 | 36 |
37 int from = string_util::to_int<int>(args[0]); | 37 const auto from = string_util::to_int<int>(args[0]); |
38 int to = string_util::to_int<int>(args[1]); | 38 const auto to = string_util::to_int<int>(args[1]); |
39 | |
40 if (!from) | |
41 throw std::invalid_argument("invalid source argument"); | |
42 if (!to) | |
43 throw std::invalid_argument("invalid destination argument"); | |
39 | 44 |
40 request(ctl, { | 45 request(ctl, { |
41 { "command", "rule-move" }, | 46 { "command", "rule-move" }, |
42 { "from", from }, | 47 { "from", *from }, |
43 { "to", to } | 48 { "to", *to } |
44 }); | 49 }); |
45 } | 50 } |
46 | 51 |
47 } // !ctl | 52 } // !ctl |
48 | 53 |