# HG changeset patch # User David Demelier # Date 1478520897 -3600 # Node ID 40abc6522cd72046b988faadc661059a09f03f0a # Parent 45065955ba2dac47a5a0607b6efd9461f942dbe1 Irccdctl: bring back server-disconnect diff -r 45065955ba2d -r 40abc6522cd7 irccdctl/cli-plugin-config.hpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/irccdctl/cli-plugin-config.hpp Mon Nov 07 13:14:57 2016 +0100 @@ -0,0 +1,50 @@ +/* + * cli-plugin-config.hpp -- implementation of irccdctl plugin-info + * + * Copyright (c) 2013-2016 David Demelier + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef IRCCDCTL_CLI_PLUGIN_CONFIG_HPP +#define IRCCDCTL_CLI_PLUGIN_CONFIG_HPP + +/** + * \file cli-plugin-config.hpp + * \brief Implementation of irccdctl plugin-config + */ + +#include "cli.hpp" + +namespace irccd { + +namespace cli { + +class PluginConfigCli : public Cli { +public: + /** + * Default constructor. + */ + PluginConfigCli(); + + /** + * \copydoc Cli::exec + */ + void exec(Irccdctl &irccdctl, const std::vector &args) override; +}; + +} // !cli + +} // !irccd + +#endif // !IRCCDCTL_CLI_PLUGIN_CONFIG_HPP diff -r 45065955ba2d -r 40abc6522cd7 irccdctl/cli-server-disconnect.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/irccdctl/cli-server-disconnect.cpp Mon Nov 07 13:14:57 2016 +0100 @@ -0,0 +1,50 @@ +/* + * cli-server-disconnect.cpp -- implementation of irccdctl server-disconnect + * + * Copyright (c) 2013-2016 David Demelier + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#include "cli-server-disconnect.hpp" + +namespace irccd { + +namespace cli { + +ServerDisconnectCli::ServerDisconnectCli() + : Cli("server-disconnect", + "disconnect server", + "server-disconnect [server]", + "Disconnect from a server.\n\n" + "If server is not specified, irccd disconnects all servers.\n\n" + "Example:\n" + "\tirccdctl server-disconnect localhost") +{ +} + +void ServerDisconnectCli::exec(Irccdctl &irccdctl, const std::vector &args) +{ + auto object = nlohmann::json::object({ + { "command", "server-disconnect" } + }); + + if (args.size() > 0) + object["server"] = args[0]; + + check(request(irccdctl, object)); +} + +} // !cli + +} // !irccd diff -r 45065955ba2d -r 40abc6522cd7 irccdctl/cli-server-disconnect.hpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/irccdctl/cli-server-disconnect.hpp Mon Nov 07 13:14:57 2016 +0100 @@ -0,0 +1,53 @@ +/* + * cli-server-disconnect.hpp -- implementation of irccdctl server-disconnect + * + * Copyright (c) 2013-2016 David Demelier + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef IRCCDCTL_CLI_SERVER_DISCONNECT_HPP +#define IRCCDCTL_CLI_SERVER_DISCONNECT_HPP + +/** + * \file cli-server-disconnect.hpp + * \brief Implementation of irccdctl server-disconnect. + */ + +#include "cli.hpp" + +namespace irccd { + +namespace cli { + +/** + * \brief Implementation of irccdctl server-disconnect. + */ +class ServerDisconnectCli : public Cli { +public: + /** + * Default constructor. + */ + ServerDisconnectCli(); + + /** + * \copydoc Cli::exec + */ + void exec(Irccdctl &irccdctl, const std::vector &args) override; +}; + +} // !cli + +} // !irccd + +#endif // !IRCCDCTL_CLI_SERVER_DISCONNECT_HPP