Mercurial > irccd
diff irccdctl/cli.cpp @ 802:f26bb089232d
irccdctl: fix alias invocations
author | David Demelier <markand@malikania.fr> |
---|---|
date | Mon, 12 Nov 2018 21:42:23 +0100 |
parents | 3c090c1ff4f0 |
children | d55a64c6586b |
line wrap: on
line diff
--- a/irccdctl/cli.cpp Mon Nov 12 21:47:00 2018 +0100 +++ b/irccdctl/cli.cpp Mon Nov 12 21:42:23 2018 +0100 @@ -187,7 +187,7 @@ void get_event(ctl::controller& ctl, std::string fmt) { - ctl.read([&ctl, fmt] (auto code, auto message) { + ctl.recv([&ctl, fmt] (auto code, auto message) { if (code) throw std::system_error(code); @@ -268,25 +268,22 @@ void cli::recv_response(ctl::controller& ctl, nlohmann::json req, handler_t handler) { - ctl.read([&ctl, req, handler, this] (auto code, auto message) { + ctl.recv([&ctl, req, handler, this] (auto code, auto message) { if (code) throw std::system_error(code); const auto c = deserializer(message).get<std::string>("command"); - if (!c) { + if (!c) recv_response(ctl, std::move(req), std::move(handler)); - return; - } - - if (handler) + else if (handler) handler(std::move(message)); }); } void cli::request(ctl::controller& ctl, nlohmann::json req, handler_t handler) { - ctl.write(req, [&ctl, req, handler, this] (auto code) { + ctl.send(req, [&ctl, req, handler, this] (auto code) { if (code) throw std::system_error(code);