Mercurial > irccd
comparison irccdctl/server_connect_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 | d615af5e505b |
comparison
equal
deleted
inserted
replaced
643:eff84e503c26 | 644:aae6d5a2b28d |
---|---|
67 auto object = nlohmann::json::object({ | 67 auto object = nlohmann::json::object({ |
68 { "name", copy[0] }, | 68 { "name", copy[0] }, |
69 { "host", copy[1] } | 69 { "host", copy[1] } |
70 }); | 70 }); |
71 | 71 |
72 if (copy.size() == 3) | 72 if (copy.size() == 3) { |
73 object["port"] = string_util::to_int(copy[2]); | 73 const auto port = string_util::to_int(copy[2]); |
74 | |
75 if (!port) | |
76 throw std::invalid_argument("invalid port given"); | |
77 | |
78 object["port"] = *port; | |
79 } | |
74 | 80 |
75 if (result.count("-S") > 0 || result.count("--ssl-verify") > 0) | 81 if (result.count("-S") > 0 || result.count("--ssl-verify") > 0) |
76 object["sslVerify"] = true; | 82 object["sslVerify"] = true; |
77 if (result.count("-s") > 0 || result.count("--ssl") > 0) | 83 if (result.count("-s") > 0 || result.count("--ssl") > 0) |
78 object["ssl"] = true; | 84 object["ssl"] = true; |