Mercurial > irccd
changeset 346:a6c3d73d9641
Irccd: unify commands
author | David Demelier <markand@malikania.fr> |
---|---|
date | Sun, 13 Nov 2016 10:00:20 +0100 |
parents | 006452e4a997 |
children | ec43b9ac3df7 |
files | irccd/main.cpp irccdctl/main.cpp libirccd/CMakeLists.txt libirccd/irccd/cmd-plugin-config.cpp libirccd/irccd/cmd-plugin-config.hpp libirccd/irccd/cmd-plugin-info.cpp libirccd/irccd/cmd-plugin-info.hpp libirccd/irccd/cmd-plugin-list.cpp libirccd/irccd/cmd-plugin-list.hpp libirccd/irccd/cmd-plugin-load.cpp libirccd/irccd/cmd-plugin-load.hpp libirccd/irccd/cmd-plugin-reload.cpp libirccd/irccd/cmd-plugin-reload.hpp libirccd/irccd/cmd-plugin-unload.cpp libirccd/irccd/cmd-plugin-unload.hpp libirccd/irccd/cmd-server-cmode.cpp libirccd/irccd/cmd-server-cmode.hpp libirccd/irccd/cmd-server-cnotice.cpp libirccd/irccd/cmd-server-cnotice.hpp libirccd/irccd/cmd-server-connect.cpp libirccd/irccd/cmd-server-connect.hpp libirccd/irccd/cmd-server-disconnect.cpp libirccd/irccd/cmd-server-disconnect.hpp libirccd/irccd/cmd-server-info.cpp libirccd/irccd/cmd-server-info.hpp libirccd/irccd/cmd-server-invite.cpp libirccd/irccd/cmd-server-invite.hpp libirccd/irccd/cmd-server-join.cpp libirccd/irccd/cmd-server-join.hpp libirccd/irccd/cmd-server-kick.cpp libirccd/irccd/cmd-server-kick.hpp libirccd/irccd/cmd-server-list.cpp libirccd/irccd/cmd-server-list.hpp libirccd/irccd/cmd-server-me.cpp libirccd/irccd/cmd-server-me.hpp libirccd/irccd/cmd-server-message.cpp libirccd/irccd/cmd-server-message.hpp libirccd/irccd/cmd-server-mode.cpp libirccd/irccd/cmd-server-mode.hpp libirccd/irccd/cmd-server-nick.cpp libirccd/irccd/cmd-server-nick.hpp libirccd/irccd/cmd-server-notice.cpp libirccd/irccd/cmd-server-notice.hpp libirccd/irccd/cmd-server-part.cpp libirccd/irccd/cmd-server-part.hpp libirccd/irccd/cmd-server-reconnect.cpp libirccd/irccd/cmd-server-reconnect.hpp libirccd/irccd/cmd-server-topic.cpp libirccd/irccd/cmd-server-topic.hpp libirccd/irccd/command.cpp libirccd/irccd/command.hpp tests/cmd-plugin-config/main.cpp tests/cmd-plugin-info/main.cpp tests/cmd-plugin-list/main.cpp tests/cmd-plugin-load/main.cpp tests/cmd-plugin-reload/main.cpp tests/cmd-plugin-unload/main.cpp tests/cmd-server-cmode/main.cpp tests/cmd-server-cnotice/main.cpp tests/cmd-server-connect/main.cpp tests/cmd-server-disconnect/main.cpp tests/cmd-server-info/main.cpp tests/cmd-server-invite/main.cpp tests/cmd-server-join/main.cpp tests/cmd-server-kick/main.cpp tests/cmd-server-list/main.cpp tests/cmd-server-me/main.cpp tests/cmd-server-message/main.cpp tests/cmd-server-mode/main.cpp tests/cmd-server-nick/main.cpp tests/cmd-server-notice/main.cpp tests/cmd-server-part/main.cpp tests/cmd-server-reconnect/main.cpp tests/cmd-server-topic/main.cpp |
diffstat | 74 files changed, 835 insertions(+), 2486 deletions(-) [+] |
line wrap: on
line diff
--- a/irccd/main.cpp Sun Nov 13 09:45:54 2016 +0100 +++ b/irccd/main.cpp Sun Nov 13 10:00:20 2016 +0100 @@ -35,26 +35,7 @@ #include <format.h> -#include "cmd-plugin-config.hpp" -#include "cmd-plugin-reload.hpp" -#include "cmd-plugin-unload.hpp" -#include "cmd-server-cmode.hpp" -#include "cmd-server-cnotice.hpp" -#include "cmd-server-connect.hpp" -#include "cmd-server-disconnect.hpp" -#include "cmd-server-info.hpp" -#include "cmd-server-invite.hpp" -#include "cmd-server-join.hpp" -#include "cmd-server-kick.hpp" -#include "cmd-server-list.hpp" -#include "cmd-server-me.hpp" -#include "cmd-server-message.hpp" -#include "cmd-server-mode.hpp" -#include "cmd-server-nick.hpp" -#include "cmd-server-notice.hpp" -#include "cmd-server-part.hpp" -#include "cmd-server-reconnect.hpp" - +#include "command.hpp" #include "logger.hpp" #include "options.hpp" #include "path.hpp"
--- a/irccdctl/main.cpp Sun Nov 13 09:45:54 2016 +0100 +++ b/irccdctl/main.cpp Sun Nov 13 10:00:20 2016 +0100 @@ -19,27 +19,6 @@ #include "client.hpp" #include "irccdctl.hpp" #include "cli.hpp" -#if 0 -#include "cli-plugin-config.hpp" -#include "cli-plugin-reload.hpp" -#include "cli-plugin-unload.hpp" -#include "cli-server-cmode.hpp" -#include "cli-server-cnotice.hpp" -#include "cli-server-connect.hpp" -#include "cli-server-disconnect.hpp" -#include "cli-server-info.hpp" -#include "cli-server-invite.hpp" -#include "cli-server-join.hpp" -#include "cli-server-kick.hpp" -#include "cli-server-list.hpp" -#include "cli-server-me.hpp" -#include "cli-server-message.hpp" -#include "cli-server-mode.hpp" -#include "cli-server-nick.hpp" -#include "cli-server-notice.hpp" -#include "cli-server-part.hpp" -#include "cli-server-reconnect.hpp" -#endif using namespace irccd;
--- a/libirccd/CMakeLists.txt Sun Nov 13 09:45:54 2016 +0100 +++ b/libirccd/CMakeLists.txt Sun Nov 13 10:00:20 2016 +0100 @@ -2,29 +2,6 @@ set( HEADERS - ${libirccd_SOURCE_DIR}/irccd/cmd-plugin-config.hpp - ${libirccd_SOURCE_DIR}/irccd/cmd-plugin-info.hpp - ${libirccd_SOURCE_DIR}/irccd/cmd-plugin-list.hpp - ${libirccd_SOURCE_DIR}/irccd/cmd-plugin-load.hpp - ${libirccd_SOURCE_DIR}/irccd/cmd-plugin-reload.hpp - ${libirccd_SOURCE_DIR}/irccd/cmd-plugin-unload.hpp - ${libirccd_SOURCE_DIR}/irccd/cmd-server-cmode.hpp - ${libirccd_SOURCE_DIR}/irccd/cmd-server-cnotice.hpp - ${libirccd_SOURCE_DIR}/irccd/cmd-server-connect.hpp - ${libirccd_SOURCE_DIR}/irccd/cmd-server-disconnect.hpp - ${libirccd_SOURCE_DIR}/irccd/cmd-server-info.hpp - ${libirccd_SOURCE_DIR}/irccd/cmd-server-invite.hpp - ${libirccd_SOURCE_DIR}/irccd/cmd-server-join.hpp - ${libirccd_SOURCE_DIR}/irccd/cmd-server-kick.hpp - ${libirccd_SOURCE_DIR}/irccd/cmd-server-list.hpp - ${libirccd_SOURCE_DIR}/irccd/cmd-server-me.hpp - ${libirccd_SOURCE_DIR}/irccd/cmd-server-message.hpp - ${libirccd_SOURCE_DIR}/irccd/cmd-server-mode.hpp - ${libirccd_SOURCE_DIR}/irccd/cmd-server-nick.hpp - ${libirccd_SOURCE_DIR}/irccd/cmd-server-notice.hpp - ${libirccd_SOURCE_DIR}/irccd/cmd-server-part.hpp - ${libirccd_SOURCE_DIR}/irccd/cmd-server-reconnect.hpp - ${libirccd_SOURCE_DIR}/irccd/cmd-server-topic.hpp ${libirccd_SOURCE_DIR}/irccd/command.hpp ${libirccd_SOURCE_DIR}/irccd/config.hpp ${libirccd_SOURCE_DIR}/irccd/dynlib.hpp @@ -44,29 +21,7 @@ set( SOURCES - ${libirccd_SOURCE_DIR}/irccd/cmd-plugin-config.cpp - ${libirccd_SOURCE_DIR}/irccd/cmd-plugin-info.cpp - ${libirccd_SOURCE_DIR}/irccd/cmd-plugin-list.cpp - ${libirccd_SOURCE_DIR}/irccd/cmd-plugin-load.cpp - ${libirccd_SOURCE_DIR}/irccd/cmd-plugin-reload.cpp - ${libirccd_SOURCE_DIR}/irccd/cmd-plugin-unload.cpp - ${libirccd_SOURCE_DIR}/irccd/cmd-server-cmode.cpp - ${libirccd_SOURCE_DIR}/irccd/cmd-server-cnotice.cpp - ${libirccd_SOURCE_DIR}/irccd/cmd-server-connect.cpp - ${libirccd_SOURCE_DIR}/irccd/cmd-server-disconnect.cpp - ${libirccd_SOURCE_DIR}/irccd/cmd-server-info.cpp - ${libirccd_SOURCE_DIR}/irccd/cmd-server-invite.cpp - ${libirccd_SOURCE_DIR}/irccd/cmd-server-join.cpp - ${libirccd_SOURCE_DIR}/irccd/cmd-server-kick.cpp - ${libirccd_SOURCE_DIR}/irccd/cmd-server-list.cpp - ${libirccd_SOURCE_DIR}/irccd/cmd-server-me.cpp - ${libirccd_SOURCE_DIR}/irccd/cmd-server-message.cpp - ${libirccd_SOURCE_DIR}/irccd/cmd-server-mode.cpp - ${libirccd_SOURCE_DIR}/irccd/cmd-server-nick.cpp - ${libirccd_SOURCE_DIR}/irccd/cmd-server-notice.cpp - ${libirccd_SOURCE_DIR}/irccd/cmd-server-part.cpp - ${libirccd_SOURCE_DIR}/irccd/cmd-server-reconnect.cpp - ${libirccd_SOURCE_DIR}/irccd/cmd-server-topic.cpp + ${libirccd_SOURCE_DIR}/irccd/command.cpp ${libirccd_SOURCE_DIR}/irccd/config.cpp ${libirccd_SOURCE_DIR}/irccd/irccd.cpp ${libirccd_SOURCE_DIR}/irccd/plugin-dynlib.cpp
--- a/libirccd/irccd/cmd-plugin-config.cpp Sun Nov 13 09:45:54 2016 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,92 +0,0 @@ -/* - * cmd-plugin-config.cpp -- implementation of plugin-config command - * - * Copyright (c) 2013-2016 David Demelier <markand@malikania.fr> - * - * 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 "irccd.hpp" -#include "cmd-plugin-config.hpp" -#include "service-plugin.hpp" -#include "transport.hpp" -#include "util.hpp" - -namespace irccd { - -namespace command { - -namespace { - -void execSet(Irccd &, TransportClient &client, Plugin &plugin, const nlohmann::json &args) -{ - assert(args.count("value") > 0); - - auto var = args.find("variable"); - auto value = args.find("value"); - - if (var == args.end() || !var->is_string()) - client.error("plugin-config", "missing 'variable' property (string expected)"); - else if (!value->is_string()) - client.error("plugin-config", "invalid 'value' property (string expected)"); - else { - auto config = plugin.config(); - - config[*var] = *value; - plugin.setConfig(config); - client.success("plugin-config"); - } -} - -void execGet(Irccd &, TransportClient &client, Plugin &plugin, const nlohmann::json &args) -{ - auto variables = nlohmann::json::object(); - auto var = args.find("variable"); - - if (var != args.end() && var->is_string()) - variables[var->get<std::string>()] = plugin.config()[*var]; - else - for (const auto &pair : plugin.config()) - variables[pair.first] = pair.second; - - /* - * Don't put all variables into the response, put them into a sub property - * 'variables' instead. - * - * It's easier for the client to iterate over all. - */ - client.success("plugin-config", { - { "variables", variables } - }); -} - -} // !namespace - -PluginConfigCommand::PluginConfigCommand() - : Command("plugin-config") -{ -} - -void PluginConfigCommand::exec(Irccd &irccd, TransportClient &client, const nlohmann::json &args) -{ - auto plugin = irccd.plugins().require(util::json::requireIdentifier(args, "plugin")); - - if (args.count("value") > 0) - execSet(irccd, client, *plugin, args); - else - execGet(irccd, client, *plugin, args); -} - -} // !command - -} // !irccd
--- a/libirccd/irccd/cmd-plugin-config.hpp Sun Nov 13 09:45:54 2016 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +0,0 @@ -/* - * cmd-plugin-config.hpp -- implementation of plugin-config command - * - * Copyright (c) 2013-2016 David Demelier <markand@malikania.fr> - * - * 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 IRCCD_CMD_PLUGIN_CONFIG_HPP -#define IRCCD_CMD_PLUGIN_CONFIG_HPP - -/** - * \file cmd-plugin-config.hpp - * \brief Implementation of plugin-config transport command. - */ - -#include "command.hpp" - -namespace irccd { - -namespace command { - -/** - * \brief Implementation of plugin-config transport command. - */ -class PluginConfigCommand : public Command { -public: - /** - * Constructor. - */ - IRCCD_EXPORT PluginConfigCommand(); - - /** - * \copydoc Command::exec - */ - IRCCD_EXPORT void exec(Irccd &irccd, TransportClient &client, const nlohmann::json &args) override; -}; - -} // !command - -} // !irccd - -#endif // !IRCCD_CMD_PLUGIN_CONFIG_HPP
--- a/libirccd/irccd/cmd-plugin-info.cpp Sun Nov 13 09:45:54 2016 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,52 +0,0 @@ -/* - * cmd-plugin-info.cpp -- implementation of plugin-info command - * - * Copyright (c) 2013-2016 David Demelier <markand@malikania.fr> - * - * 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 <iostream> - -#include "cmd-plugin-info.hpp" -#include "irccd.hpp" -#include "plugin.hpp" -#include "service-plugin.hpp" -#include "transport.hpp" -#include "util.hpp" - -namespace irccd { - -namespace command { - -PluginInfoCommand::PluginInfoCommand() - : Command("plugin-info") -{ -} - -void PluginInfoCommand::exec(Irccd &irccd, TransportClient &client, const nlohmann::json &args) -{ - auto plugin = irccd.plugins().require(util::json::requireIdentifier(args, "plugin")); - - client.success("plugin-info", { - { "author", plugin->author() }, - { "license", plugin->license() }, - { "summary", plugin->summary() }, - { "version", plugin->version() } - }); -} - -} // !command - -} // !irccd -
--- a/libirccd/irccd/cmd-plugin-info.hpp Sun Nov 13 09:45:54 2016 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +0,0 @@ -/* - * cmd-plugin-info.hpp -- implementation of plugin-info command - * - * Copyright (c) 2013-2016 David Demelier <markand@malikania.fr> - * - * 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 IRCCD_CMD_PLUGIN_INFO_HPP -#define IRCCD_CMD_PLUGIN_INFO_HPP - -/** - * \file cmd-plugin-info.hpp - * \brief Implementation of plugin-info transport command. - */ - -#include "command.hpp" - -namespace irccd { - -namespace command { - -/** - * \brief Implementation of plugin-info transport command. - */ -class PluginInfoCommand : public Command { -public: - /** - * Constructor. - */ - IRCCD_EXPORT PluginInfoCommand(); - - /** - * \copydoc Command::exec - */ - IRCCD_EXPORT void exec(Irccd &irccd, TransportClient &client, const nlohmann::json &args) override; -}; - -} // !command - -} // !irccd - -#endif // !IRCCD_CMD_PLUGIN_INFO_HPP
--- a/libirccd/irccd/cmd-plugin-list.cpp Sun Nov 13 09:45:54 2016 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,51 +0,0 @@ -/* - * cmd-plugin-list.cpp -- implementation of plugin-list transport command - * - * Copyright (c) 2013-2016 David Demelier <markand@malikania.fr> - * - * 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 <iostream> - -#include "cmd-plugin-list.hpp" -#include "irccd.hpp" -#include "plugin.hpp" -#include "service-plugin.hpp" -#include "transport.hpp" -#include "util.hpp" - -namespace irccd { - -namespace command { - -PluginListCommand::PluginListCommand() - : Command("plugin-list") -{ -} - -void PluginListCommand::exec(Irccd &irccd, TransportClient &client, const nlohmann::json &) -{ - auto list = nlohmann::json::array(); - - for (const auto &plugin : irccd.plugins().list()) - list += plugin->name(); - - client.success("plugin-list", { - { "list", list } - }); -} - -} // !command - -} // !irccd
--- a/libirccd/irccd/cmd-plugin-list.hpp Sun Nov 13 09:45:54 2016 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +0,0 @@ -/* - * cmd-plugin-list.hpp -- implementation of plugin-list transport command - * - * Copyright (c) 2013-2016 David Demelier <markand@malikania.fr> - * - * 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 IRCCD_CMD_PLUGIN_LIST_HPP -#define IRCCD_CMD_PLUGIN_LIST_HPP - -/** - * \file cmd-plugin-list.hpp - * \brief Implementation of plugin-list transport command. - */ - -#include "command.hpp" - -namespace irccd { - -namespace command { - -/** - * \brief Implementation of plugin-list transport command. - */ -class PluginListCommand : public Command { -public: - /** - * Constructor. - */ - IRCCD_EXPORT PluginListCommand(); - - /** - * \copydoc Command::exec - */ - IRCCD_EXPORT void exec(Irccd &irccd, TransportClient &client, const nlohmann::json &request) override; -}; - -} // !command - -} // !irccd - -#endif // !IRCCD_CMD_PLUGIN_LIST_HPP
--- a/libirccd/irccd/cmd-plugin-load.cpp Sun Nov 13 09:45:54 2016 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,42 +0,0 @@ -/* - * cmd-plugin-load.cpp -- implementation of plugin-load transport command - * - * Copyright (c) 2013-2016 David Demelier <markand@malikania.fr> - * - * 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 "cmd-plugin-load.hpp" -#include "irccd.hpp" -#include "service-plugin.hpp" -#include "transport.hpp" -#include "util.hpp" - -namespace irccd { - -namespace command { - -PluginLoadCommand::PluginLoadCommand() - : Command("plugin-load") -{ -} - -void PluginLoadCommand::exec(Irccd &irccd, TransportClient &client, const nlohmann::json &args) -{ - irccd.plugins().load(util::json::requireIdentifier(args, "plugin")); - client.success("plugin-load"); -} - -} // !command - -} // !irccd
--- a/libirccd/irccd/cmd-plugin-load.hpp Sun Nov 13 09:45:54 2016 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +0,0 @@ -/* - * cmd-plugin-load.hpp -- implementation of plugin-load transport command - * - * Copyright (c) 2013-2016 David Demelier <markand@malikania.fr> - * - * 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 IRCCD_CMD_PLUGIN_LOAD_HPP -#define IRCCD_CMD_PLUGIN_LOAD_HPP - -/** - * \file cmd-plugin-load.hpp - * \brief Implementation of plugin-load transport command. - */ - -#include "command.hpp" - -namespace irccd { - -namespace command { - -/** - * \brief Implementation of plugin-load transport command. - */ -class PluginLoadCommand : public Command { -public: - /** - * Constructor. - */ - IRCCD_EXPORT PluginLoadCommand(); - - /** - * \copydoc Command::exec - */ - IRCCD_EXPORT void exec(Irccd &irccd, TransportClient &client, const nlohmann::json &args) override; -}; - -} // !command - -} // !irccd - -#endif // !IRCCD_CMD_PLUGIN_LOAD_HPP
--- a/libirccd/irccd/cmd-plugin-reload.cpp Sun Nov 13 09:45:54 2016 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,43 +0,0 @@ -/* - * cmd-plugin-reload.cpp -- implementation of plugin-reload transport command - * - * Copyright (c) 2013-2016 David Demelier <markand@malikania.fr> - * - * 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 "cmd-plugin-reload.hpp" -#include "irccd.hpp" -#include "plugin.hpp" -#include "service-plugin.hpp" -#include "transport.hpp" -#include "util.hpp" - -namespace irccd { - -namespace command { - -PluginReloadCommand::PluginReloadCommand() - : Command("plugin-reload") -{ -} - -void PluginReloadCommand::exec(Irccd &irccd, TransportClient &client, const nlohmann::json &args) -{ - irccd.plugins().require(util::json::requireIdentifier(args, "plugin"))->onReload(irccd); - client.success("plugin-reload"); -} - -} // !command - -} // !irccd
--- a/libirccd/irccd/cmd-plugin-reload.hpp Sun Nov 13 09:45:54 2016 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +0,0 @@ -/* - * cmd-plugin-reload.hpp -- implementation of plugin-reload transport command - * - * Copyright (c) 2013-2016 David Demelier <markand@malikania.fr> - * - * 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 IRCCD_CMD_PLUGIN_RELOAD_HPP -#define IRCCD_CMD_PLUGIN_RELOAD_HPP - -/** - * \file cmd-plugin-reload.hpp - * \brief Implementation of plugin-reload transport command. - */ - -#include "command.hpp" - -namespace irccd { - -namespace command { - -/** - * \brief Implementation of plugin-reload transport command. - */ -class PluginReloadCommand : public Command { -public: - /** - * Constructor. - */ - IRCCD_EXPORT PluginReloadCommand(); - - /** - * \copydoc Command::exec - */ - IRCCD_EXPORT void exec(Irccd &irccd, TransportClient &client, const nlohmann::json &args) override; -}; - -} // !command - -} // !irccd - -#endif // !IRCCD_CMD_PLUGIN_RELOAD_HPP
--- a/libirccd/irccd/cmd-plugin-unload.cpp Sun Nov 13 09:45:54 2016 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,42 +0,0 @@ -/* - * cmd-plugin-unload.cpp -- implementation of plugin-unload transport command - * - * Copyright (c) 2013-2016 David Demelier <markand@malikania.fr> - * - * 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 "cmd-plugin-unload.hpp" -#include "irccd.hpp" -#include "service-plugin.hpp" -#include "transport.hpp" -#include "util.hpp" - -namespace irccd { - -namespace command { - -PluginUnloadCommand::PluginUnloadCommand() - : Command("plugin-unload") -{ -} - -void PluginUnloadCommand::exec(Irccd &irccd, TransportClient &client, const nlohmann::json &args) -{ - irccd.plugins().unload(util::json::requireIdentifier(args, "plugin")); - client.success("plugin-unload"); -} - -} // !command - -} // !irccd
--- a/libirccd/irccd/cmd-plugin-unload.hpp Sun Nov 13 09:45:54 2016 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +0,0 @@ -/* - * cmd-plugin-unload.hpp -- implementation of plugin-unload transport command - * - * Copyright (c) 2013-2016 David Demelier <markand@malikania.fr> - * - * 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 IRCCD_CMD_PLUGIN_UNLOAD_HPP -#define IRCCD_CMD_PLUGIN_UNLOAD_HPP - -/** - * \file cmd-plugin-unload.hpp - * \brief Implementation of plugin-unload transport command. - */ - -#include "command.hpp" - -namespace irccd { - -namespace command { - -/** - * \brief Implementation of plugin-unload transport command. - */ -class PluginUnloadCommand : public Command { -public: - /** - * Constructor. - */ - IRCCD_EXPORT PluginUnloadCommand(); - - /** - * \copydoc Command::exec - */ - IRCCD_EXPORT void exec(Irccd &irccd, TransportClient &client, const nlohmann::json &args) override; -}; - -} // !command - -} // !irccd - -#endif // !IRCCD_CMD_PLUGIN_UNLOAD_HPP
--- a/libirccd/irccd/cmd-server-cmode.cpp Sun Nov 13 09:45:54 2016 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ -/* - * cmd-server-cmode.cpp -- implementation of server-cmode transport command - * - * Copyright (c) 2013-2016 David Demelier <markand@malikania.fr> - * - * 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 "cmd-server-cmode.hpp" -#include "irccd.hpp" -#include "server.hpp" -#include "service-server.hpp" -#include "transport.hpp" -#include "util.hpp" - -namespace irccd { - -namespace command { - -ServerChannelModeCommand::ServerChannelModeCommand() - : Command("server-cmode") -{ -} - -void ServerChannelModeCommand::exec(Irccd &irccd, TransportClient &client, const nlohmann::json &args) -{ - irccd.servers().require(util::json::requireIdentifier(args, "server"))->cmode( - util::json::requireString(args, "channel"), - util::json::requireString(args, "mode") - ); - client.success("server-cmode"); -} - -} // !command - -} // !irccd -
--- a/libirccd/irccd/cmd-server-cmode.hpp Sun Nov 13 09:45:54 2016 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +0,0 @@ -/* - * cmd-server-cmode.hpp -- implementation of server-cmode transport command - * - * Copyright (c) 2013-2016 David Demelier <markand@malikania.fr> - * - * 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 IRCCD_CMD_SERVER_CMODE_HPP -#define IRCCD_CMD_SERVER_CMODE_HPP - -/** - * \file cmd-server-cmode.hpp - * \brief Implementation of server-cmode transport command. - */ - -#include "command.hpp" - -namespace irccd { - -namespace command { - -/** - * \brief Implementation of server-cmode transport command. - */ -class ServerChannelModeCommand : public Command { -public: - /** - * Constructor. - */ - IRCCD_EXPORT ServerChannelModeCommand(); - - /** - * \copydoc Command::exec - */ - IRCCD_EXPORT void exec(Irccd &irccd, TransportClient &client, const nlohmann::json &args) override; -}; - -} // !command - -} // !irccd - -#endif // !IRCCD_CMD_SERVER_CMODE_HPP
--- a/libirccd/irccd/cmd-server-cnotice.cpp Sun Nov 13 09:45:54 2016 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,46 +0,0 @@ -/* - * cmd-server-cnotice.cpp -- implementation of server-cnotice transport command - * - * Copyright (c) 2013-2016 David Demelier <markand@malikania.fr> - * - * 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 "cmd-server-cnotice.hpp" -#include "irccd.hpp" -#include "server.hpp" -#include "service-server.hpp" -#include "transport.hpp" -#include "util.hpp" - -namespace irccd { - -namespace command { - -ServerChannelNoticeCommand::ServerChannelNoticeCommand() - : Command("server-cnotice") -{ -} - -void ServerChannelNoticeCommand::exec(Irccd &irccd, TransportClient &client, const nlohmann::json &args) -{ - irccd.servers().require(util::json::requireString(args, "server"))->cnotice( - util::json::requireString(args, "channel"), - util::json::requireString(args, "message") - ); - client.success("server-cnotice"); -} - -} // !command - -} // !irccd
--- a/libirccd/irccd/cmd-server-cnotice.hpp Sun Nov 13 09:45:54 2016 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,62 +0,0 @@ -/* - * cmd-server-cnotice.hpp -- implementation of server-cnotice transport command - * - * Copyright (c) 2013-2016 David Demelier <markand@malikania.fr> - * - * 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 IRCCD_CMD_SERVER_CNOTICE_HPP -#define IRCCD_CMD_SERVER_CNOTICE_HPP - -/** - * \file cmd-server-cnotice.hpp - * \brief Implementation of server-cnotice transport command. - */ - -#include "command.hpp" - -namespace irccd { - -namespace command { - -/** - * \brief Implementation of server-cnotice transport command. - * - * Send a channel notice to the specified channel. - * - * { - * "command": "server-cnotice", - * "server": "the server name", - * "channel": "name", - * "message": "the message" - * } - */ -class ServerChannelNoticeCommand : public Command { -public: - /** - * Constructor. - */ - IRCCD_EXPORT ServerChannelNoticeCommand(); - - /** - * \copydoc Command::exec - */ - IRCCD_EXPORT void exec(Irccd &irccd, TransportClient &client, const nlohmann::json &args) override; -}; - -} // !command - -} // !irccd - -#endif // !IRCCD_CMD_SERVER_CNOTICE_HPP
--- a/libirccd/irccd/cmd-server-connect.cpp Sun Nov 13 09:45:54 2016 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,51 +0,0 @@ -/* - * cmd-server-connect.cpp -- implementation of server-connect transport command - * - * Copyright (c) 2013-2016 David Demelier <markand@malikania.fr> - * - * 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 <limits> - -#include "cmd-server-connect.hpp" -#include "irccd.hpp" -#include "server.hpp" -#include "service-server.hpp" -#include "transport.hpp" -#include "util.hpp" - -namespace irccd { - -namespace command { - -ServerConnectCommand::ServerConnectCommand() - : Command("server-connect") -{ -} - -void ServerConnectCommand::exec(Irccd &irccd, TransportClient &client, const nlohmann::json &args) -{ - auto server = Server::fromJson(args); - - if (irccd.servers().has(server->name())) - client.error("server-connect", "server already exists"); - else { - irccd.servers().add(std::move(server)); - client.success("server-connect"); - } -} - -} // !command - -} // !irccd
--- a/libirccd/irccd/cmd-server-connect.hpp Sun Nov 13 09:45:54 2016 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +0,0 @@ -/* - * cmd-server-connect.hpp -- implementation of server-connect transport command - * - * Copyright (c) 2013-2016 David Demelier <markand@malikania.fr> - * - * 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 IRCCD_CMD_SERVER_CONNECT_HPP -#define IRCCD_CMD_SERVER_CONNECT_HPP - -/** - * \file cmd-server-connect.hpp - * \brief Implementation of server-connect transport command. - */ - -#include "command.hpp" - -namespace irccd { - -namespace command { - -/** - * \brief Implementation of server-connect transport command. - */ -class ServerConnectCommand : public Command { -public: - /** - * Constructor. - */ - IRCCD_EXPORT ServerConnectCommand(); - - /** - * \copydoc Command::exec - */ - IRCCD_EXPORT void exec(Irccd &irccd, TransportClient &client, const nlohmann::json &args) override; -}; - -} // !command - -} // !irccd - -#endif // !IRCCD_CMD_SERVER_CONNECT_HPP
--- a/libirccd/irccd/cmd-server-disconnect.cpp Sun Nov 13 09:45:54 2016 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,48 +0,0 @@ -/* - * cmd-server-disconnect.cpp -- implementation of server-disconnect transport command - * - * Copyright (c) 2013-2016 David Demelier <markand@malikania.fr> - * - * 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 "cmd-server-disconnect.hpp" -#include "irccd.hpp" -#include "server.hpp" -#include "service-server.hpp" -#include "transport.hpp" - -namespace irccd { - -namespace command { - -ServerDisconnectCommand::ServerDisconnectCommand() - : Command("server-disconnect") -{ -} - -void ServerDisconnectCommand::exec(Irccd &irccd, TransportClient &client, const nlohmann::json &args) -{ - auto it = args.find("server"); - - if (it == args.end()) - irccd.servers().clear(); - else - irccd.servers().remove(*it); - - client.success("server-disconnect"); -} - -} // !command - -} // !irccd
--- a/libirccd/irccd/cmd-server-disconnect.hpp Sun Nov 13 09:45:54 2016 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +0,0 @@ -/* - * cmd-server-disconnect.hpp -- implementation of server-disconnect transport command - * - * Copyright (c) 2013-2016 David Demelier <markand@malikania.fr> - * - * 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 IRCCD_CMD_SERVER_DISCONNECT_HPP -#define IRCCD_CMD_SERVER_DISCONNECT_HPP - -/** - * \file cmd-server-disconnect.hpp - * \brief Implementation of server-disconnect transport command. - */ - -#include "command.hpp" -#include "sysconfig.hpp" - -namespace irccd { - -namespace command { - -/** - * \brief Implementation of server-disconnect transport command. - */ -class IRCCD_EXPORT ServerDisconnectCommand : public Command { -public: - /** - * Constructor. - */ - ServerDisconnectCommand(); - - /** - * \copydoc Command::exec - */ - void exec(Irccd &irccd, TransportClient &client, const nlohmann::json &args) override; -}; - -} // !command - -} // !irccd - -#endif // !IRCCD_CMD_SERVER_DISCONNECT_HPP
--- a/libirccd/irccd/cmd-server-info.cpp Sun Nov 13 09:45:54 2016 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,64 +0,0 @@ -/* - * cmd-server-info.cpp -- implementation of server-info transport command - * - * Copyright (c) 2013-2016 David Demelier <markand@malikania.fr> - * - * 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 <iostream> - -#include "cmd-server-info.hpp" -#include "irccd.hpp" -#include "server.hpp" -#include "service-server.hpp" -#include "transport.hpp" -#include "util.hpp" - -namespace irccd { - -namespace command { - -ServerInfoCommand::ServerInfoCommand() - : Command("server-info") -{ -} - -void ServerInfoCommand::exec(Irccd &irccd, TransportClient &client, const nlohmann::json &args) -{ - auto response = nlohmann::json::object(); - auto server = irccd.servers().require(util::json::requireIdentifier(args, "server")); - - // General stuff. - response.push_back({"name", server->name()}); - response.push_back({"host", server->host()}); - response.push_back({"port", server->port()}); - response.push_back({"nickname", server->nickname()}); - response.push_back({"username", server->username()}); - response.push_back({"realname", server->realname()}); - response.push_back({"channels", server->channels()}); - - // Optional stuff. - if (server->flags() & Server::Ipv6) - response.push_back({"ipv6", true}); - if (server->flags() & Server::Ssl) - response.push_back({"ssl", true}); - if (server->flags() & Server::SslVerify) - response.push_back({"sslVerify", true}); - - client.success("server-info", response); -} - -} // !command - -} // !irccd
--- a/libirccd/irccd/cmd-server-info.hpp Sun Nov 13 09:45:54 2016 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +0,0 @@ -/* - * cmd-server-info.hpp -- implementation of server-info transport command - * - * Copyright (c) 2013-2016 David Demelier <markand@malikania.fr> - * - * 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 IRCCD_CMD_SERVER_INFO_HPP -#define IRCCD_CMD_SERVER_INFO_HPP - -/** - * \file cmd-server-info.hpp - * \brief Implementation of server-info transport command. - */ - -#include "command.hpp" -#include "sysconfig.hpp" - -namespace irccd { - -namespace command { - -/** - * \brief Implementation of server-info transport command. - */ -class IRCCD_EXPORT ServerInfoCommand : public Command { -public: - /** - * Constructor. - */ - ServerInfoCommand(); - - /** - * \copydoc Command::exec - */ - void exec(Irccd &irccd, TransportClient &client, const nlohmann::json &args) override; -}; - -} // !command - -} // !irccd - -#endif // !IRCCD_CMD_SERVER_INFO_HPP
--- a/libirccd/irccd/cmd-server-invite.cpp Sun Nov 13 09:45:54 2016 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ -/* - * cmd-server-invite.cpp -- implementation of server-invite transport command - * - * Copyright (c) 2013-2016 David Demelier <markand@malikania.fr> - * - * 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 "cmd-server-invite.hpp" -#include "irccd.hpp" -#include "server.hpp" -#include "service-server.hpp" -#include "transport.hpp" -#include "util.hpp" - -namespace irccd { - -namespace command { - -ServerInviteCommand::ServerInviteCommand() - : Command("server-invite") -{ -} - -void ServerInviteCommand::exec(Irccd &irccd, TransportClient &client, const nlohmann::json &args) -{ - irccd.servers().require(util::json::requireIdentifier(args, "server"))->invite( - util::json::requireString(args, "target"), - util::json::requireString(args, "channel") - ); - client.success("server-invite"); -} - -} // !command - -} // !irccd -
--- a/libirccd/irccd/cmd-server-invite.hpp Sun Nov 13 09:45:54 2016 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +0,0 @@ -/* - * cmd-server-invite.hpp -- implementation of server-invite transport command - * - * Copyright (c) 2013-2016 David Demelier <markand@malikania.fr> - * - * 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 IRCCD_CMD_SERVER_INVITE_HPP -#define IRCCD_CMD_SERVER_INVITE_HPP - -/** - * \file cmd-server-invite.hpp - * \brief Implementation of server-invite transport command. - */ - -#include "command.hpp" - -namespace irccd { - -namespace command { - -/** - * \brief Implementation of server-invite transport command. - */ -class ServerInviteCommand : public Command { -public: - /** - * Constructor. - */ - IRCCD_EXPORT ServerInviteCommand(); - - /** - * \copydoc Command::exec - */ - IRCCD_EXPORT void exec(Irccd &irccd, TransportClient &client, const nlohmann::json &args) override; -}; - -} // !command - -} // !irccd - -#endif // !IRCCD_CMD_SERVER_INVITE_HPP
--- a/libirccd/irccd/cmd-server-join.cpp Sun Nov 13 09:45:54 2016 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,46 +0,0 @@ -/* - * cmd-server-join.cpp -- implementation of server-join transport command - * - * Copyright (c) 2013-2016 David Demelier <markand@malikania.fr> - * - * 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 "cmd-server-join.hpp" -#include "irccd.hpp" -#include "server.hpp" -#include "service-server.hpp" -#include "transport.hpp" -#include "util.hpp" - -namespace irccd { - -namespace command { - -ServerJoinCommand::ServerJoinCommand() - : Command("server-join") -{ -} - -void ServerJoinCommand::exec(Irccd &irccd, TransportClient &client, const nlohmann::json &args) -{ - irccd.servers().require(util::json::requireIdentifier(args, "server"))->join( - util::json::requireString(args, "channel"), - util::json::getString(args, "password") - ); - client.success("server-join"); -} - -} // !command - -} // !irccd
--- a/libirccd/irccd/cmd-server-join.hpp Sun Nov 13 09:45:54 2016 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +0,0 @@ -/* - * cmd-server-join.hpp -- implementation of server-join transport command - * - * Copyright (c) 2013-2016 David Demelier <markand@malikania.fr> - * - * 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 IRCCD_CMD_SERVER_JOIN_HPP -#define IRCCD_CMD_SERVER_JOIN_HPP - -/** - * \file cmd-server-join.hpp - * \brief Implementation of server-join transport command. - */ - -#include "command.hpp" - -namespace irccd { - -namespace command { - -/** - * \brief Implementation of server-join transport command. - */ -class ServerJoinCommand : public Command { -public: - /** - * Constructor. - */ - IRCCD_EXPORT ServerJoinCommand(); - - /** - * \copydoc Command::exec - */ - IRCCD_EXPORT void exec(Irccd &irccd, TransportClient &client, const nlohmann::json &args) override; -}; - -} // !command - -} // !irccd - -#endif // !IRCCD_CMD_SERVER_JOIN_HPP
--- a/libirccd/irccd/cmd-server-kick.cpp Sun Nov 13 09:45:54 2016 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ -/* - * cmd-server-kick.cpp -- implementation of server-kick transport command - * - * Copyright (c) 2013-2016 David Demelier <markand@malikania.fr> - * - * 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 "cmd-server-kick.hpp" -#include "irccd.hpp" -#include "server.hpp" -#include "service-server.hpp" -#include "transport.hpp" -#include "util.hpp" - -namespace irccd { - -namespace command { - -ServerKickCommand::ServerKickCommand() - : Command("server-kick") -{ -} - -void ServerKickCommand::exec(Irccd &irccd, TransportClient &client, const nlohmann::json &args) -{ - irccd.servers().require(util::json::requireIdentifier(args, "server"))->kick( - util::json::requireString(args, "target"), - util::json::requireString(args, "channel"), - util::json::getString(args, "reason") - ); - client.success("server-kick"); -} - -} // !command - -} // !irccd
--- a/libirccd/irccd/cmd-server-kick.hpp Sun Nov 13 09:45:54 2016 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +0,0 @@ -/* - * cmd-server-kick.hpp -- implementation of server-kick transport command - * - * Copyright (c) 2013-2016 David Demelier <markand@malikania.fr> - * - * 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 IRCCD_CMD_SERVER_KICK_HPP -#define IRCCD_CMD_SERVER_KICK_HPP - -/** - * \file cmd-server-kick.hpp - * \brief Implementation of server-kick transport command. - */ - -#include "command.hpp" - -namespace irccd { - -namespace command { - -/** - * \brief Implementation of server-kick transport command. - */ -class ServerKickCommand : public Command { -public: - /** - * Constructor. - */ - IRCCD_EXPORT ServerKickCommand(); - - /** - * \copydoc Command::exec - */ - IRCCD_EXPORT void exec(Irccd &irccd, TransportClient &client, const nlohmann::json &args) override; -}; - -} // !command - -} // !irccd - -#endif // !IRCCD_CMD_SERVER_KICK_HPP
--- a/libirccd/irccd/cmd-server-list.cpp Sun Nov 13 09:45:54 2016 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ -/* - * cmd-server-list.cpp -- implementation of server-list transport command - * - * Copyright (c) 2013-2016 David Demelier <markand@malikania.fr> - * - * 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 <iostream> - -#include "cmd-server-list.hpp" -#include "irccd.hpp" -#include "server.hpp" -#include "service-server.hpp" -#include "transport.hpp" - -namespace irccd { - -namespace command { - -ServerListCommand::ServerListCommand() - : Command("server-list") -{ -} - -void ServerListCommand::exec(Irccd &irccd, TransportClient &client, const nlohmann::json &) -{ - auto json = nlohmann::json::object(); - auto list = nlohmann::json::array(); - - for (const auto &server : irccd.servers().servers()) - list.push_back(server->name()); - - json.push_back({"list", std::move(list)}); - client.success("server-list", json); -} - -} // !command - -} // !irccd
--- a/libirccd/irccd/cmd-server-list.hpp Sun Nov 13 09:45:54 2016 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +0,0 @@ -/* - * cmd-server-list.hpp -- implementation of server-list transport command - * - * Copyright (c) 2013-2016 David Demelier <markand@malikania.fr> - * - * 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 IRCCD_CMD_SERVER_LIST_HPP -#define IRCCD_CMD_SERVER_LIST_HPP - -/** - * \file cmd-server-list.hpp - * \brief Implementation of server-list transport command. - */ - -#include "command.hpp" - -namespace irccd { - -namespace command { - -/** - * \brief Implementation of server-list transport command. - */ -class ServerListCommand : public Command { -public: - /** - * Constructor. - */ - IRCCD_EXPORT ServerListCommand(); - - /** - * \copydoc Command::exec - */ - IRCCD_EXPORT void exec(Irccd &irccd, TransportClient &client, const nlohmann::json &args) override; -}; - -} // !command - -} // !irccd - -#endif // !IRCCD_CMD_SERVER_LIST_HPP
--- a/libirccd/irccd/cmd-server-me.cpp Sun Nov 13 09:45:54 2016 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,46 +0,0 @@ -/* - * cmd-server-me.cpp -- implementation of server-me transport command - * - * Copyright (c) 2013-2016 David Demelier <markand@malikania.fr> - * - * 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 "cmd-server-me.hpp" -#include "irccd.hpp" -#include "transport.hpp" -#include "server.hpp" -#include "service-server.hpp" -#include "util.hpp" - -namespace irccd { - -namespace command { - -ServerMeCommand::ServerMeCommand() - : Command("server-me") -{ -} - -void ServerMeCommand::exec(Irccd &irccd, TransportClient &client, const nlohmann::json &args) -{ - irccd.servers().require(util::json::requireIdentifier(args, "server"))->me( - util::json::requireString(args, "target"), - util::json::requireString(args, "message") - ); - client.success("server-me"); -} - -} // !command - -} // !irccd
--- a/libirccd/irccd/cmd-server-me.hpp Sun Nov 13 09:45:54 2016 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +0,0 @@ -/* - * cmd-server-me.hpp -- implementation of server-me transport command - * - * Copyright (c) 2013-2016 David Demelier <markand@malikania.fr> - * - * 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 IRCCD_CMD_SERVER_ME_HPP -#define IRCCD_CMD_SERVER_ME_HPP - -/** - * \file cmd-server-me.hpp - * \brief Implementation of server-me transport command. - */ - -#include "command.hpp" -#include "sysconfig.hpp" - -namespace irccd { - -namespace command { - -/** - * \brief Implementation of server-me transport command. - */ -class IRCCD_EXPORT ServerMeCommand : public Command { -public: - /** - * Constructor. - */ - ServerMeCommand(); - - /** - * \copydoc Command::exec - */ - void exec(Irccd &irccd, TransportClient &client, const nlohmann::json &args) override; -}; - -} // !command - -} // !irccd - -#endif // !IRCCD_CMD_SERVER_ME_HPP
--- a/libirccd/irccd/cmd-server-message.cpp Sun Nov 13 09:45:54 2016 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,46 +0,0 @@ -/* - * cmd-server-message.cpp -- implementation of server-message transport command - * - * Copyright (c) 2013-2016 David Demelier <markand@malikania.fr> - * - * 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 "cmd-server-message.hpp" -#include "irccd.hpp" -#include "transport.hpp" -#include "server.hpp" -#include "service-server.hpp" -#include "util.hpp" - -namespace irccd { - -namespace command { - -ServerMessageCommand::ServerMessageCommand() - : Command("server-message") -{ -} - -void ServerMessageCommand::exec(Irccd &irccd, TransportClient &client, const nlohmann::json &args) -{ - irccd.servers().require(util::json::requireIdentifier(args, "server"))->message( - util::json::requireString(args, "target"), - util::json::requireString(args, "message") - ); - client.success("server-message"); -} - -} // !command - -} // !irccd
--- a/libirccd/irccd/cmd-server-message.hpp Sun Nov 13 09:45:54 2016 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +0,0 @@ -/* - * cmd-server-message.hpp -- implementation of server-message transport command - * - * Copyright (c) 2013-2016 David Demelier <markand@malikania.fr> - * - * 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 IRCCD_CMD_SERVER_MESSAGE_HPP -#define IRCCD_CMD_SERVER_MESSAGE_HPP - -/** - * \file cmd-server-message.hpp - * \brief Implementation of server-message transport command. - */ - -#include "command.hpp" -#include "sysconfig.hpp" - -namespace irccd { - -namespace command { - -/** - * \brief Implementation of server-message transport command. - */ -class IRCCD_EXPORT ServerMessageCommand : public Command { -public: - /** - * Constructor. - */ - ServerMessageCommand(); - - /** - * \copydoc Command::exec - */ - void exec(Irccd &irccd, TransportClient &client, const nlohmann::json &args) override; -}; - -} // !command - -} // !irccd - -#endif // !IRCCD_CMD_SERVER_MESSAGE_HPP
--- a/libirccd/irccd/cmd-server-mode.cpp Sun Nov 13 09:45:54 2016 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +0,0 @@ -/* - * cmd-server-mode.cpp -- implementation of server-mode transport command - * - * Copyright (c) 2013-2016 David Demelier <markand@malikania.fr> - * - * 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 "cmd-server-mode.hpp" -#include "irccd.hpp" -#include "transport.hpp" -#include "server.hpp" -#include "service-server.hpp" -#include "util.hpp" - -namespace irccd { - -namespace command { - -ServerModeCommand::ServerModeCommand() - : Command("server-mode") -{ -} - -void ServerModeCommand::exec(Irccd &irccd, TransportClient &client, const nlohmann::json &args) -{ - irccd.servers().require(util::json::requireIdentifier(args, "server"))->mode( - util::json::requireString(args, "mode") - ); - client.success("server-mode"); -} - -} // !command - -} // !irccd
--- a/libirccd/irccd/cmd-server-mode.hpp Sun Nov 13 09:45:54 2016 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +0,0 @@ -/* - * cmd-server-mode.hpp -- implementation of server-mode transport command - * - * Copyright (c) 2013-2016 David Demelier <markand@malikania.fr> - * - * 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 IRCCD_CMD_SERVER_MODE_HPP -#define IRCCD_CMD_SERVER_MODE_HPP - -/** - * \file cmd-server-mode.hpp - * \brief Implementation of server-mode transport command. - */ - -#include "command.hpp" -#include "sysconfig.hpp" - -namespace irccd { - -namespace command { - -/** - * \brief Implementation of server-mode transport command. - */ -class IRCCD_EXPORT ServerModeCommand : public Command { -public: - /** - * Constructor. - */ - ServerModeCommand(); - - /** - * \copydoc Command::exec - */ - void exec(Irccd &irccd, TransportClient &client, const nlohmann::json &args) override; -}; - -} // !command - -} // !irccd - -#endif // !IRCCD_CMD_SERVER_MODE_HPP
--- a/libirccd/irccd/cmd-server-nick.cpp Sun Nov 13 09:45:54 2016 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +0,0 @@ -/* - * cmd-server-nick.cpp -- implementation of server-nick transport command - * - * Copyright (c) 2013-2016 David Demelier <markand@malikania.fr> - * - * 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 "cmd-server-nick.hpp" -#include "irccd.hpp" -#include "transport.hpp" -#include "server.hpp" -#include "service-server.hpp" -#include "util.hpp" - -namespace irccd { - -namespace command { - -ServerNickCommand::ServerNickCommand() - : Command("server-nick") -{ -} - -void ServerNickCommand::exec(Irccd &irccd, TransportClient &client, const nlohmann::json &args) -{ - irccd.servers().require(util::json::requireIdentifier(args, "server"))->setNickname( - util::json::requireString(args, "nickname") - ); - client.success("server-nick"); -} - -} // !command - -} // !irccd
--- a/libirccd/irccd/cmd-server-nick.hpp Sun Nov 13 09:45:54 2016 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +0,0 @@ -/* - * cmd-server-nick.hpp -- implementation of server-nick transport command - * - * Copyright (c) 2013-2016 David Demelier <markand@malikania.fr> - * - * 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 IRCCD_CMD_SERVER_NICK_HPP -#define IRCCD_CMD_SERVER_NICK_HPP - -/** - * \file cmd-server-nick.hpp - * \brief Implementation of server-nick transport command. - */ - -#include "command.hpp" -#include "sysconfig.hpp" - -namespace irccd { - -namespace command { - -/** - * \brief Implementation of server-nick transport command. - */ -class IRCCD_EXPORT ServerNickCommand : public Command { -public: - /** - * Constructor. - */ - ServerNickCommand(); - - /** - * \copydoc Command::exec - */ - void exec(Irccd &irccd, TransportClient &client, const nlohmann::json &args) override; -}; - -} // !command - -} // !irccd - -#endif // !IRCCD_CMD_SERVER_NICK_HPP
--- a/libirccd/irccd/cmd-server-notice.cpp Sun Nov 13 09:45:54 2016 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,46 +0,0 @@ -/* - * cmd-server-notice.cpp -- implementation of server-notice transport command - * - * Copyright (c) 2013-2016 David Demelier <markand@malikania.fr> - * - * 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 "cmd-server-notice.hpp" -#include "irccd.hpp" -#include "transport.hpp" -#include "server.hpp" -#include "service-server.hpp" -#include "util.hpp" - -namespace irccd { - -namespace command { - -ServerNoticeCommand::ServerNoticeCommand() - : Command("server-notice") -{ -} - -void ServerNoticeCommand::exec(Irccd &irccd, TransportClient &client, const nlohmann::json &args) -{ - irccd.servers().require(util::json::requireIdentifier(args, "server"))->notice( - util::json::requireString(args, "target"), - util::json::requireString(args, "message") - ); - client.success("server-notice"); -} - -} // !command - -} // !irccd
--- a/libirccd/irccd/cmd-server-notice.hpp Sun Nov 13 09:45:54 2016 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +0,0 @@ -/* - * cmd-server-notice.hpp -- implementation of server-notice transport command - * - * Copyright (c) 2013-2016 David Demelier <markand@malikania.fr> - * - * 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 IRCCD_CMD_SERVER_NOTICE_HPP -#define IRCCD_CMD_SERVER_NOTICE_HPP - -/** - * \file cmd-server-notice.hpp - * \brief Implementation of server-notice transport command. - */ - -#include "command.hpp" -#include "sysconfig.hpp" - -namespace irccd { - -namespace command { - -/** - * \brief Implementation of server-notice transport command. - */ -class IRCCD_EXPORT ServerNoticeCommand : public Command { -public: - /** - * Constructor. - */ - ServerNoticeCommand(); - - /** - * \copydoc Command::exec - */ - void exec(Irccd &irccd, TransportClient &client, const nlohmann::json &args) override; -}; - -} // !command - -} // !irccd - -#endif // !IRCCD_CMD_SERVER_NOTICE_HPP
--- a/libirccd/irccd/cmd-server-part.cpp Sun Nov 13 09:45:54 2016 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,46 +0,0 @@ -/* - * cmd-server-part.cpp -- implementation of server-part transport command - * - * Copyright (c) 2013-2016 David Demelier <markand@malikania.fr> - * - * 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 "cmd-server-part.hpp" -#include "irccd.hpp" -#include "server.hpp" -#include "service-server.hpp" -#include "transport.hpp" -#include "util.hpp" - -namespace irccd { - -namespace command { - -ServerPartCommand::ServerPartCommand() - : Command("server-part") -{ -} - -void ServerPartCommand::exec(Irccd &irccd, TransportClient &client, const nlohmann::json &args) -{ - irccd.servers().require(util::json::requireIdentifier(args, "server"))->part( - util::json::requireString(args, "channel"), - util::json::getString(args, "reason") - ); - client.success("server-part"); -} - -} // !command - -} // !irccd
--- a/libirccd/irccd/cmd-server-part.hpp Sun Nov 13 09:45:54 2016 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,55 +0,0 @@ -/* - * cmd-server-part.hpp -- implementation of server-part transport command - * - * Copyright (c) 2013-2016 David Demelier <markand@malikania.fr> - * - * 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 IRCCD_CMD_SERVER_PART_HPP -#define IRCCD_CMD_SERVER_PART_HPP - -/** - * \file cmd-server-part.hpp - * \brief Implementation of server-part transport command. - */ - -#include "command.hpp" -#include "sysconfig.hpp" - -namespace irccd { - -namespace command { - -/** - * \class ServerPart - * \brief Implementation of server-part transport command. - */ -class IRCCD_EXPORT ServerPartCommand : public Command { -public: - /** - * Constructor. - */ - ServerPartCommand(); - - /** - * \copydoc Command::exec - */ - void exec(Irccd &irccd, TransportClient &client, const nlohmann::json &args) override; -}; - -} // !command - -} // !irccd - -#endif // !IRCCD_CMD_SERVER_PART_HPP
--- a/libirccd/irccd/cmd-server-reconnect.cpp Sun Nov 13 09:45:54 2016 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +0,0 @@ -/* - * cmd-server-reconnect.cpp -- implementation of server-reconnect transport command - * - * Copyright (c) 2013-2016 David Demelier <markand@malikania.fr> - * - * 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 "cmd-server-reconnect.hpp" -#include "irccd.hpp" -#include "server.hpp" -#include "service-server.hpp" -#include "transport.hpp" - -namespace irccd { - -namespace command { - -ServerReconnectCommand::ServerReconnectCommand() - : Command("server-reconnect") -{ -} - -void ServerReconnectCommand::exec(Irccd &irccd, TransportClient &client, const nlohmann::json &args) -{ - auto server = args.find("server"); - - if (server != args.end() && server->is_string()) - irccd.servers().require(*server)->reconnect(); - else - for (auto &server : irccd.servers().servers()) - server->reconnect(); - - client.success("server-reconnect"); -} - -} // !command - -} // !irccd
--- a/libirccd/irccd/cmd-server-reconnect.hpp Sun Nov 13 09:45:54 2016 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +0,0 @@ -/* - * cmd-server-reconnect.hpp -- implementation of server-reconnect transport command - * - * Copyright (c) 2013-2016 David Demelier <markand@malikania.fr> - * - * 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 IRCCD_CMD_SERVER_RECONNECT_HPP -#define IRCCD_CMD_SERVER_RECONNECT_HPP - -/** - * \file cmd-server-reconnect.hpp - * \brief Implementation of server-reconnect transport command. - */ - -#include "command.hpp" - -namespace irccd { - -namespace command { - -/** - * \brief Implementation of server-reconnect transport command. - */ -class ServerReconnectCommand : public Command { -public: - /** - * Constructor. - */ - IRCCD_EXPORT ServerReconnectCommand(); - - /** - * \copydoc Command::exec - */ - IRCCD_EXPORT void exec(Irccd &irccd, TransportClient &client, const nlohmann::json &args) override; -}; - -} // !command - -} // !irccd - -#endif // !IRCCD_CMD_SERVER_RECONNECT_HPP
--- a/libirccd/irccd/cmd-server-topic.cpp Sun Nov 13 09:45:54 2016 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,46 +0,0 @@ -/* - * cmd-server-topic.cpp -- implementation of server-topic transport command - * - * Copyright (c) 2013-2016 David Demelier <markand@malikania.fr> - * - * 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 "cmd-server-topic.hpp" -#include "irccd.hpp" -#include "server.hpp" -#include "service-server.hpp" -#include "transport.hpp" -#include "util.hpp" - -namespace irccd { - -namespace command { - -ServerTopicCommand::ServerTopicCommand() - : Command("server-topic") -{ -} - -void ServerTopicCommand::exec(Irccd &irccd, TransportClient &client, const nlohmann::json &args) -{ - irccd.servers().require(util::json::requireIdentifier(args, "server"))->topic( - util::json::requireString(args, "channel"), - util::json::requireString(args, "topic") - ); - client.success("server-topic"); -} - -} // !command - -} // !irccd
--- a/libirccd/irccd/cmd-server-topic.hpp Sun Nov 13 09:45:54 2016 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +0,0 @@ -/* - * cmd-server-topic.hpp -- implementation of server-topic transport command - * - * Copyright (c) 2013-2016 David Demelier <markand@malikania.fr> - * - * 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 IRCCD_CMD_SERVER_TOPIC_HPP -#define IRCCD_CMD_SERVER_TOPIC_HPP - -/** - * \file cmd-server-topic.hpp - * \brief Implementation of server-topic transport command. - */ - -#include "command.hpp" -#include "sysconfig.hpp" - -namespace irccd { - -namespace command { - -/** - * \brief Implementation of server-topic transport command. - */ -class IRCCD_EXPORT ServerTopicCommand : public Command { -public: - /** - * Constructor. - */ - ServerTopicCommand(); - - /** - * \copydoc Command::exec - */ - void exec(Irccd &irccd, TransportClient &client, const nlohmann::json &args) override; -}; - -} // !command - -} // !irccd - -#endif // !IRCCD_CMD_SERVER_TOPIC_HPP
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libirccd/irccd/command.cpp Sun Nov 13 10:00:20 2016 +0100 @@ -0,0 +1,427 @@ +/* + * cmd-plugin-config.cpp -- implementation of plugin-config command + * + * Copyright (c) 2013-2016 David Demelier <markand@malikania.fr> + * + * 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 "command.hpp" +#include "irccd.hpp" +#include "service-plugin.hpp" +#include "service-server.hpp" +#include "transport.hpp" +#include "util.hpp" + +namespace irccd { + +namespace command { + +namespace { + +void execSet(Irccd &, TransportClient &client, Plugin &plugin, const nlohmann::json &args) +{ + assert(args.count("value") > 0); + + auto var = args.find("variable"); + auto value = args.find("value"); + + if (var == args.end() || !var->is_string()) + client.error("plugin-config", "missing 'variable' property (string expected)"); + else if (!value->is_string()) + client.error("plugin-config", "invalid 'value' property (string expected)"); + else { + auto config = plugin.config(); + + config[*var] = *value; + plugin.setConfig(config); + client.success("plugin-config"); + } +} + +void execGet(Irccd &, TransportClient &client, Plugin &plugin, const nlohmann::json &args) +{ + auto variables = nlohmann::json::object(); + auto var = args.find("variable"); + + if (var != args.end() && var->is_string()) + variables[var->get<std::string>()] = plugin.config()[*var]; + else + for (const auto &pair : plugin.config()) + variables[pair.first] = pair.second; + + /* + * Don't put all variables into the response, put them into a sub property + * 'variables' instead. + * + * It's easier for the client to iterate over all. + */ + client.success("plugin-config", { + { "variables", variables } + }); +} + +} // !namespace + +PluginConfigCommand::PluginConfigCommand() + : Command("plugin-config") +{ +} + +void PluginConfigCommand::exec(Irccd &irccd, TransportClient &client, const nlohmann::json &args) +{ + auto plugin = irccd.plugins().require(util::json::requireIdentifier(args, "plugin")); + + if (args.count("value") > 0) + execSet(irccd, client, *plugin, args); + else + execGet(irccd, client, *plugin, args); +} + + +PluginInfoCommand::PluginInfoCommand() + : Command("plugin-info") +{ +} + +void PluginInfoCommand::exec(Irccd &irccd, TransportClient &client, const nlohmann::json &args) +{ + auto plugin = irccd.plugins().require(util::json::requireIdentifier(args, "plugin")); + + client.success("plugin-info", { + { "author", plugin->author() }, + { "license", plugin->license() }, + { "summary", plugin->summary() }, + { "version", plugin->version() } + }); +} + +PluginListCommand::PluginListCommand() + : Command("plugin-list") +{ +} + +void PluginListCommand::exec(Irccd &irccd, TransportClient &client, const nlohmann::json &) +{ + auto list = nlohmann::json::array(); + + for (const auto &plugin : irccd.plugins().list()) + list += plugin->name(); + + client.success("plugin-list", { + { "list", list } + }); +} + +PluginLoadCommand::PluginLoadCommand() + : Command("plugin-load") +{ +} + +void PluginLoadCommand::exec(Irccd &irccd, TransportClient &client, const nlohmann::json &args) +{ + irccd.plugins().load(util::json::requireIdentifier(args, "plugin")); + client.success("plugin-load"); +} + +PluginReloadCommand::PluginReloadCommand() + : Command("plugin-reload") +{ +} + +void PluginReloadCommand::exec(Irccd &irccd, TransportClient &client, const nlohmann::json &args) +{ + irccd.plugins().require(util::json::requireIdentifier(args, "plugin"))->onReload(irccd); + client.success("plugin-reload"); +} + +PluginUnloadCommand::PluginUnloadCommand() + : Command("plugin-unload") +{ +} + +void PluginUnloadCommand::exec(Irccd &irccd, TransportClient &client, const nlohmann::json &args) +{ + irccd.plugins().unload(util::json::requireIdentifier(args, "plugin")); + client.success("plugin-unload"); +} + +ServerChannelModeCommand::ServerChannelModeCommand() + : Command("server-cmode") +{ +} + +void ServerChannelModeCommand::exec(Irccd &irccd, TransportClient &client, const nlohmann::json &args) +{ + irccd.servers().require(util::json::requireIdentifier(args, "server"))->cmode( + util::json::requireString(args, "channel"), + util::json::requireString(args, "mode") + ); + client.success("server-cmode"); +} + +ServerChannelNoticeCommand::ServerChannelNoticeCommand() + : Command("server-cnotice") +{ +} + +void ServerChannelNoticeCommand::exec(Irccd &irccd, TransportClient &client, const nlohmann::json &args) +{ + irccd.servers().require(util::json::requireString(args, "server"))->cnotice( + util::json::requireString(args, "channel"), + util::json::requireString(args, "message") + ); + client.success("server-cnotice"); +} + +ServerConnectCommand::ServerConnectCommand() + : Command("server-connect") +{ +} + +void ServerConnectCommand::exec(Irccd &irccd, TransportClient &client, const nlohmann::json &args) +{ + auto server = Server::fromJson(args); + + if (irccd.servers().has(server->name())) + client.error("server-connect", "server already exists"); + else { + irccd.servers().add(std::move(server)); + client.success("server-connect"); + } +} + +ServerDisconnectCommand::ServerDisconnectCommand() + : Command("server-disconnect") +{ +} + +void ServerDisconnectCommand::exec(Irccd &irccd, TransportClient &client, const nlohmann::json &args) +{ + auto it = args.find("server"); + + if (it == args.end()) + irccd.servers().clear(); + else + irccd.servers().remove(*it); + + client.success("server-disconnect"); +} + +ServerInfoCommand::ServerInfoCommand() + : Command("server-info") +{ +} + +void ServerInfoCommand::exec(Irccd &irccd, TransportClient &client, const nlohmann::json &args) +{ + auto response = nlohmann::json::object(); + auto server = irccd.servers().require(util::json::requireIdentifier(args, "server")); + + // General stuff. + response.push_back({"name", server->name()}); + response.push_back({"host", server->host()}); + response.push_back({"port", server->port()}); + response.push_back({"nickname", server->nickname()}); + response.push_back({"username", server->username()}); + response.push_back({"realname", server->realname()}); + response.push_back({"channels", server->channels()}); + + // Optional stuff. + if (server->flags() & Server::Ipv6) + response.push_back({"ipv6", true}); + if (server->flags() & Server::Ssl) + response.push_back({"ssl", true}); + if (server->flags() & Server::SslVerify) + response.push_back({"sslVerify", true}); + + client.success("server-info", response); +} + +ServerInviteCommand::ServerInviteCommand() + : Command("server-invite") +{ +} + +void ServerInviteCommand::exec(Irccd &irccd, TransportClient &client, const nlohmann::json &args) +{ + irccd.servers().require(util::json::requireIdentifier(args, "server"))->invite( + util::json::requireString(args, "target"), + util::json::requireString(args, "channel") + ); + client.success("server-invite"); +} + +ServerJoinCommand::ServerJoinCommand() + : Command("server-join") +{ +} + +void ServerJoinCommand::exec(Irccd &irccd, TransportClient &client, const nlohmann::json &args) +{ + irccd.servers().require(util::json::requireIdentifier(args, "server"))->join( + util::json::requireString(args, "channel"), + util::json::getString(args, "password") + ); + client.success("server-join"); +} + +ServerKickCommand::ServerKickCommand() + : Command("server-kick") +{ +} + +void ServerKickCommand::exec(Irccd &irccd, TransportClient &client, const nlohmann::json &args) +{ + irccd.servers().require(util::json::requireIdentifier(args, "server"))->kick( + util::json::requireString(args, "target"), + util::json::requireString(args, "channel"), + util::json::getString(args, "reason") + ); + client.success("server-kick"); +} + +ServerListCommand::ServerListCommand() + : Command("server-list") +{ +} + +void ServerListCommand::exec(Irccd &irccd, TransportClient &client, const nlohmann::json &) +{ + auto json = nlohmann::json::object(); + auto list = nlohmann::json::array(); + + for (const auto &server : irccd.servers().servers()) + list.push_back(server->name()); + + json.push_back({"list", std::move(list)}); + client.success("server-list", json); +} + +ServerMeCommand::ServerMeCommand() + : Command("server-me") +{ +} + +void ServerMeCommand::exec(Irccd &irccd, TransportClient &client, const nlohmann::json &args) +{ + irccd.servers().require(util::json::requireIdentifier(args, "server"))->me( + util::json::requireString(args, "target"), + util::json::requireString(args, "message") + ); + client.success("server-me"); +} + +ServerMessageCommand::ServerMessageCommand() + : Command("server-message") +{ +} + +void ServerMessageCommand::exec(Irccd &irccd, TransportClient &client, const nlohmann::json &args) +{ + irccd.servers().require(util::json::requireIdentifier(args, "server"))->message( + util::json::requireString(args, "target"), + util::json::requireString(args, "message") + ); + client.success("server-message"); +} + +ServerModeCommand::ServerModeCommand() + : Command("server-mode") +{ +} + +void ServerModeCommand::exec(Irccd &irccd, TransportClient &client, const nlohmann::json &args) +{ + irccd.servers().require(util::json::requireIdentifier(args, "server"))->mode( + util::json::requireString(args, "mode") + ); + client.success("server-mode"); +} + +ServerNickCommand::ServerNickCommand() + : Command("server-nick") +{ +} + +void ServerNickCommand::exec(Irccd &irccd, TransportClient &client, const nlohmann::json &args) +{ + irccd.servers().require(util::json::requireIdentifier(args, "server"))->setNickname( + util::json::requireString(args, "nickname") + ); + client.success("server-nick"); +} + +ServerNoticeCommand::ServerNoticeCommand() + : Command("server-notice") +{ +} + +void ServerNoticeCommand::exec(Irccd &irccd, TransportClient &client, const nlohmann::json &args) +{ + irccd.servers().require(util::json::requireIdentifier(args, "server"))->notice( + util::json::requireString(args, "target"), + util::json::requireString(args, "message") + ); + client.success("server-notice"); +} + +ServerPartCommand::ServerPartCommand() + : Command("server-part") +{ +} + +void ServerPartCommand::exec(Irccd &irccd, TransportClient &client, const nlohmann::json &args) +{ + irccd.servers().require(util::json::requireIdentifier(args, "server"))->part( + util::json::requireString(args, "channel"), + util::json::getString(args, "reason") + ); + client.success("server-part"); +} + +ServerReconnectCommand::ServerReconnectCommand() + : Command("server-reconnect") +{ +} + +void ServerReconnectCommand::exec(Irccd &irccd, TransportClient &client, const nlohmann::json &args) +{ + auto server = args.find("server"); + + if (server != args.end() && server->is_string()) + irccd.servers().require(*server)->reconnect(); + else + for (auto &server : irccd.servers().servers()) + server->reconnect(); + + client.success("server-reconnect"); +} + +ServerTopicCommand::ServerTopicCommand() + : Command("server-topic") +{ +} + +void ServerTopicCommand::exec(Irccd &irccd, TransportClient &client, const nlohmann::json &args) +{ + irccd.servers().require(util::json::requireIdentifier(args, "server"))->topic( + util::json::requireString(args, "channel"), + util::json::requireString(args, "topic") + ); + client.success("server-topic"); +} + +} // !command + +} // !irccd
--- a/libirccd/irccd/command.hpp Sun Nov 13 09:45:54 2016 +0100 +++ b/libirccd/irccd/command.hpp Sun Nov 13 10:00:20 2016 +0100 @@ -88,6 +88,388 @@ IRCCD_EXPORT virtual void exec(Irccd &irccd, TransportClient &client, const nlohmann::json &args) = 0; }; +namespace command { + +/** + * \brief Implementation of plugin-config transport command. + */ +class PluginConfigCommand : public Command { +public: + /** + * Constructor. + */ + IRCCD_EXPORT PluginConfigCommand(); + + /** + * \copydoc Command::exec + */ + IRCCD_EXPORT void exec(Irccd &irccd, TransportClient &client, const nlohmann::json &args) override; +}; + +/** + * \brief Implementation of plugin-info transport command. + */ +class PluginInfoCommand : public Command { +public: + /** + * Constructor. + */ + IRCCD_EXPORT PluginInfoCommand(); + + /** + * \copydoc Command::exec + */ + IRCCD_EXPORT void exec(Irccd &irccd, TransportClient &client, const nlohmann::json &args) override; +}; + +/** + * \brief Implementation of plugin-list transport command. + */ +class PluginListCommand : public Command { +public: + /** + * Constructor. + */ + IRCCD_EXPORT PluginListCommand(); + + /** + * \copydoc Command::exec + */ + IRCCD_EXPORT void exec(Irccd &irccd, TransportClient &client, const nlohmann::json &request) override; +}; + +/** + * \brief Implementation of plugin-load transport command. + */ +class PluginLoadCommand : public Command { +public: + /** + * Constructor. + */ + IRCCD_EXPORT PluginLoadCommand(); + + /** + * \copydoc Command::exec + */ + IRCCD_EXPORT void exec(Irccd &irccd, TransportClient &client, const nlohmann::json &args) override; +}; + +/** + * \brief Implementation of plugin-reload transport command. + */ +class PluginReloadCommand : public Command { +public: + /** + * Constructor. + */ + IRCCD_EXPORT PluginReloadCommand(); + + /** + * \copydoc Command::exec + */ + IRCCD_EXPORT void exec(Irccd &irccd, TransportClient &client, const nlohmann::json &args) override; +}; + +/** + * \brief Implementation of plugin-unload transport command. + */ +class PluginUnloadCommand : public Command { +public: + /** + * Constructor. + */ + IRCCD_EXPORT PluginUnloadCommand(); + + /** + * \copydoc Command::exec + */ + IRCCD_EXPORT void exec(Irccd &irccd, TransportClient &client, const nlohmann::json &args) override; +}; + +/** + * \brief Implementation of server-cmode transport command. + */ +class ServerChannelModeCommand : public Command { +public: + /** + * Constructor. + */ + IRCCD_EXPORT ServerChannelModeCommand(); + + /** + * \copydoc Command::exec + */ + IRCCD_EXPORT void exec(Irccd &irccd, TransportClient &client, const nlohmann::json &args) override; +}; + +/** + * \brief Implementation of server-cnotice transport command. + * + * Send a channel notice to the specified channel. + * + * { + * "command": "server-cnotice", + * "server": "the server name", + * "channel": "name", + * "message": "the message" + * } + */ +class ServerChannelNoticeCommand : public Command { +public: + /** + * Constructor. + */ + IRCCD_EXPORT ServerChannelNoticeCommand(); + + /** + * \copydoc Command::exec + */ + IRCCD_EXPORT void exec(Irccd &irccd, TransportClient &client, const nlohmann::json &args) override; +}; + +/** + * \brief Implementation of server-connect transport command. + */ +class ServerConnectCommand : public Command { +public: + /** + * Constructor. + */ + IRCCD_EXPORT ServerConnectCommand(); + + /** + * \copydoc Command::exec + */ + IRCCD_EXPORT void exec(Irccd &irccd, TransportClient &client, const nlohmann::json &args) override; +}; + +/** + * \brief Implementation of server-disconnect transport command. + */ +class IRCCD_EXPORT ServerDisconnectCommand : public Command { +public: + /** + * Constructor. + */ + ServerDisconnectCommand(); + + /** + * \copydoc Command::exec + */ + void exec(Irccd &irccd, TransportClient &client, const nlohmann::json &args) override; +}; + +/** + * \brief Implementation of server-info transport command. + */ +class IRCCD_EXPORT ServerInfoCommand : public Command { +public: + /** + * Constructor. + */ + ServerInfoCommand(); + + /** + * \copydoc Command::exec + */ + void exec(Irccd &irccd, TransportClient &client, const nlohmann::json &args) override; +}; + +/** + * \brief Implementation of server-invite transport command. + */ +class ServerInviteCommand : public Command { +public: + /** + * Constructor. + */ + IRCCD_EXPORT ServerInviteCommand(); + + /** + * \copydoc Command::exec + */ + IRCCD_EXPORT void exec(Irccd &irccd, TransportClient &client, const nlohmann::json &args) override; +}; + +/** + * \brief Implementation of server-join transport command. + */ +class ServerJoinCommand : public Command { +public: + /** + * Constructor. + */ + IRCCD_EXPORT ServerJoinCommand(); + + /** + * \copydoc Command::exec + */ + IRCCD_EXPORT void exec(Irccd &irccd, TransportClient &client, const nlohmann::json &args) override; +}; + +/** + * \brief Implementation of server-kick transport command. + */ +class ServerKickCommand : public Command { +public: + /** + * Constructor. + */ + IRCCD_EXPORT ServerKickCommand(); + + /** + * \copydoc Command::exec + */ + IRCCD_EXPORT void exec(Irccd &irccd, TransportClient &client, const nlohmann::json &args) override; +}; + +/** + * \brief Implementation of server-list transport command. + */ +class ServerListCommand : public Command { +public: + /** + * Constructor. + */ + IRCCD_EXPORT ServerListCommand(); + + /** + * \copydoc Command::exec + */ + IRCCD_EXPORT void exec(Irccd &irccd, TransportClient &client, const nlohmann::json &args) override; +}; + +/** + * \brief Implementation of server-me transport command. + */ +class IRCCD_EXPORT ServerMeCommand : public Command { +public: + /** + * Constructor. + */ + ServerMeCommand(); + + /** + * \copydoc Command::exec + */ + void exec(Irccd &irccd, TransportClient &client, const nlohmann::json &args) override; +}; + +/** + * \brief Implementation of server-message transport command. + */ +class IRCCD_EXPORT ServerMessageCommand : public Command { +public: + /** + * Constructor. + */ + ServerMessageCommand(); + + /** + * \copydoc Command::exec + */ + void exec(Irccd &irccd, TransportClient &client, const nlohmann::json &args) override; +}; + +/** + * \brief Implementation of server-mode transport command. + */ +class IRCCD_EXPORT ServerModeCommand : public Command { +public: + /** + * Constructor. + */ + ServerModeCommand(); + + /** + * \copydoc Command::exec + */ + void exec(Irccd &irccd, TransportClient &client, const nlohmann::json &args) override; +}; + +/** + * \brief Implementation of server-nick transport command. + */ +class IRCCD_EXPORT ServerNickCommand : public Command { +public: + /** + * Constructor. + */ + ServerNickCommand(); + + /** + * \copydoc Command::exec + */ + void exec(Irccd &irccd, TransportClient &client, const nlohmann::json &args) override; +}; + +/** + * \brief Implementation of server-notice transport command. + */ +class IRCCD_EXPORT ServerNoticeCommand : public Command { +public: + /** + * Constructor. + */ + ServerNoticeCommand(); + + /** + * \copydoc Command::exec + */ + void exec(Irccd &irccd, TransportClient &client, const nlohmann::json &args) override; +}; + +/** + * \class ServerPart + * \brief Implementation of server-part transport command. + */ +class IRCCD_EXPORT ServerPartCommand : public Command { +public: + /** + * Constructor. + */ + ServerPartCommand(); + + /** + * \copydoc Command::exec + */ + void exec(Irccd &irccd, TransportClient &client, const nlohmann::json &args) override; +}; + +/** + * \brief Implementation of server-reconnect transport command. + */ +class ServerReconnectCommand : public Command { +public: + /** + * Constructor. + */ + IRCCD_EXPORT ServerReconnectCommand(); + + /** + * \copydoc Command::exec + */ + IRCCD_EXPORT void exec(Irccd &irccd, TransportClient &client, const nlohmann::json &args) override; +}; + +/** + * \brief Implementation of server-topic transport command. + */ +class IRCCD_EXPORT ServerTopicCommand : public Command { +public: + /** + * Constructor. + */ + ServerTopicCommand(); + + /** + * \copydoc Command::exec + */ + void exec(Irccd &irccd, TransportClient &client, const nlohmann::json &args) override; +}; + +} // !command + } // !irccd -#endif // !IRCCD_COMMAND_HPP +#endif // !IRCCD_CMD_SERVER_TOPIC_HPP
--- a/tests/cmd-plugin-config/main.cpp Sun Nov 13 09:45:54 2016 +0100 +++ b/tests/cmd-plugin-config/main.cpp Sun Nov 13 10:00:20 2016 +0100 @@ -16,7 +16,7 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#include <cmd-plugin-config.hpp> +#include <command.hpp> #include <command-tester.hpp> #include <server-tester.hpp> #include <service-plugin.hpp>
--- a/tests/cmd-plugin-info/main.cpp Sun Nov 13 09:45:54 2016 +0100 +++ b/tests/cmd-plugin-info/main.cpp Sun Nov 13 10:00:20 2016 +0100 @@ -16,7 +16,7 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#include <cmd-plugin-info.hpp> +#include <command.hpp> #include <command-tester.hpp> #include <server-tester.hpp> #include <service-plugin.hpp>
--- a/tests/cmd-plugin-list/main.cpp Sun Nov 13 09:45:54 2016 +0100 +++ b/tests/cmd-plugin-list/main.cpp Sun Nov 13 10:00:20 2016 +0100 @@ -16,7 +16,7 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#include <cmd-plugin-list.hpp> +#include <command.hpp> #include <command-tester.hpp> #include <server-tester.hpp> #include <service-plugin.hpp>
--- a/tests/cmd-plugin-load/main.cpp Sun Nov 13 09:45:54 2016 +0100 +++ b/tests/cmd-plugin-load/main.cpp Sun Nov 13 10:00:20 2016 +0100 @@ -16,7 +16,7 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#include <cmd-plugin-load.hpp> +#include <command.hpp> #include <command-tester.hpp> #include <server-tester.hpp> #include <service-plugin.hpp>
--- a/tests/cmd-plugin-reload/main.cpp Sun Nov 13 09:45:54 2016 +0100 +++ b/tests/cmd-plugin-reload/main.cpp Sun Nov 13 10:00:20 2016 +0100 @@ -16,7 +16,7 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#include <cmd-plugin-reload.hpp> +#include <command.hpp> #include <command-tester.hpp> #include <server-tester.hpp> #include <service-plugin.hpp>
--- a/tests/cmd-plugin-unload/main.cpp Sun Nov 13 09:45:54 2016 +0100 +++ b/tests/cmd-plugin-unload/main.cpp Sun Nov 13 10:00:20 2016 +0100 @@ -16,7 +16,7 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#include <cmd-plugin-unload.hpp> +#include <command.hpp> #include <command-tester.hpp> #include <server-tester.hpp> #include <service-plugin.hpp>
--- a/tests/cmd-server-cmode/main.cpp Sun Nov 13 09:45:54 2016 +0100 +++ b/tests/cmd-server-cmode/main.cpp Sun Nov 13 10:00:20 2016 +0100 @@ -16,7 +16,7 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#include <cmd-server-cmode.hpp> +#include <command.hpp> #include <command-tester.hpp> #include <server-tester.hpp>
--- a/tests/cmd-server-cnotice/main.cpp Sun Nov 13 09:45:54 2016 +0100 +++ b/tests/cmd-server-cnotice/main.cpp Sun Nov 13 10:00:20 2016 +0100 @@ -16,7 +16,7 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#include <cmd-server-cnotice.hpp> +#include <command.hpp> #include <command-tester.hpp> #include <server-tester.hpp>
--- a/tests/cmd-server-connect/main.cpp Sun Nov 13 09:45:54 2016 +0100 +++ b/tests/cmd-server-connect/main.cpp Sun Nov 13 10:00:20 2016 +0100 @@ -16,7 +16,7 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#include <cmd-server-connect.hpp> +#include <command.hpp> #include <command-tester.hpp> #include <server-tester.hpp> #include <service-server.hpp>
--- a/tests/cmd-server-disconnect/main.cpp Sun Nov 13 09:45:54 2016 +0100 +++ b/tests/cmd-server-disconnect/main.cpp Sun Nov 13 10:00:20 2016 +0100 @@ -16,7 +16,7 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#include <cmd-server-disconnect.hpp> +#include <command.hpp> #include <command-tester.hpp> #include <server-tester.hpp> #include <service-server.hpp>
--- a/tests/cmd-server-info/main.cpp Sun Nov 13 09:45:54 2016 +0100 +++ b/tests/cmd-server-info/main.cpp Sun Nov 13 10:00:20 2016 +0100 @@ -16,7 +16,7 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#include <cmd-server-info.hpp> +#include <command.hpp> #include <command-tester.hpp> #include <server-tester.hpp> #include <service-server.hpp>
--- a/tests/cmd-server-invite/main.cpp Sun Nov 13 09:45:54 2016 +0100 +++ b/tests/cmd-server-invite/main.cpp Sun Nov 13 10:00:20 2016 +0100 @@ -16,7 +16,7 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#include <cmd-server-invite.hpp> +#include <command.hpp> #include <command-tester.hpp> #include <server-tester.hpp>
--- a/tests/cmd-server-join/main.cpp Sun Nov 13 09:45:54 2016 +0100 +++ b/tests/cmd-server-join/main.cpp Sun Nov 13 10:00:20 2016 +0100 @@ -16,7 +16,7 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#include <cmd-server-join.hpp> +#include <command.hpp> #include <command-tester.hpp> #include <server-tester.hpp>
--- a/tests/cmd-server-kick/main.cpp Sun Nov 13 09:45:54 2016 +0100 +++ b/tests/cmd-server-kick/main.cpp Sun Nov 13 10:00:20 2016 +0100 @@ -16,7 +16,7 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#include <cmd-server-kick.hpp> +#include <command.hpp> #include <command-tester.hpp> #include <server-tester.hpp>
--- a/tests/cmd-server-list/main.cpp Sun Nov 13 09:45:54 2016 +0100 +++ b/tests/cmd-server-list/main.cpp Sun Nov 13 10:00:20 2016 +0100 @@ -16,7 +16,7 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#include <cmd-server-list.hpp> +#include <command.hpp> #include <command-tester.hpp> #include <server-tester.hpp> #include <service-server.hpp>
--- a/tests/cmd-server-me/main.cpp Sun Nov 13 09:45:54 2016 +0100 +++ b/tests/cmd-server-me/main.cpp Sun Nov 13 10:00:20 2016 +0100 @@ -16,7 +16,7 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#include <cmd-server-me.hpp> +#include <command.hpp> #include <command-tester.hpp> #include <server-tester.hpp>
--- a/tests/cmd-server-message/main.cpp Sun Nov 13 09:45:54 2016 +0100 +++ b/tests/cmd-server-message/main.cpp Sun Nov 13 10:00:20 2016 +0100 @@ -16,7 +16,7 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#include <cmd-server-message.hpp> +#include <command.hpp> #include <command-tester.hpp> #include <server-tester.hpp>
--- a/tests/cmd-server-mode/main.cpp Sun Nov 13 09:45:54 2016 +0100 +++ b/tests/cmd-server-mode/main.cpp Sun Nov 13 10:00:20 2016 +0100 @@ -16,7 +16,7 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#include <cmd-server-mode.hpp> +#include <command.hpp> #include <command-tester.hpp> #include <server-tester.hpp>
--- a/tests/cmd-server-nick/main.cpp Sun Nov 13 09:45:54 2016 +0100 +++ b/tests/cmd-server-nick/main.cpp Sun Nov 13 10:00:20 2016 +0100 @@ -16,7 +16,7 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#include <cmd-server-nick.hpp> +#include <command.hpp> #include <command-tester.hpp> #include <server-tester.hpp>
--- a/tests/cmd-server-notice/main.cpp Sun Nov 13 09:45:54 2016 +0100 +++ b/tests/cmd-server-notice/main.cpp Sun Nov 13 10:00:20 2016 +0100 @@ -16,7 +16,7 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#include <cmd-server-notice.hpp> +#include <command.hpp> #include <command-tester.hpp> #include <server-tester.hpp>
--- a/tests/cmd-server-part/main.cpp Sun Nov 13 09:45:54 2016 +0100 +++ b/tests/cmd-server-part/main.cpp Sun Nov 13 10:00:20 2016 +0100 @@ -16,7 +16,7 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#include <cmd-server-part.hpp> +#include <command.hpp> #include <command-tester.hpp> #include <server-tester.hpp>
--- a/tests/cmd-server-reconnect/main.cpp Sun Nov 13 09:45:54 2016 +0100 +++ b/tests/cmd-server-reconnect/main.cpp Sun Nov 13 10:00:20 2016 +0100 @@ -16,7 +16,7 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#include <cmd-server-reconnect.hpp> +#include <command.hpp> #include <command-tester.hpp> #include <server-tester.hpp> #include <service-server.hpp>
--- a/tests/cmd-server-topic/main.cpp Sun Nov 13 09:45:54 2016 +0100 +++ b/tests/cmd-server-topic/main.cpp Sun Nov 13 10:00:20 2016 +0100 @@ -16,7 +16,7 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#include <cmd-server-topic.hpp> +#include <command.hpp> #include <command-tester.hpp> #include <server-tester.hpp>