# HG changeset patch # User David Demelier # Date 1478693009 -3600 # Node ID 9d09b8d882f396c4c3a74887b9648ca7abeedefb # Parent 4f1fb35ef30ec4f8c65d4fa7d02a6d41842eb741 Irccdctl: bring back server-me (and fix server side) diff -r 4f1fb35ef30e -r 9d09b8d882f3 irccdctl/cli-server-me.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/irccdctl/cli-server-me.cpp Wed Nov 09 13:03:29 2016 +0100 @@ -0,0 +1,49 @@ +/* + * cli-server-me.cpp -- implementation of irccdctl server-me + * + * Copyright (c) 2013-2016 David Demelier + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#include "cli-server-me.hpp" + +namespace irccd { + +namespace cli { + +ServerMeCli::ServerMeCli() + : Cli("server-me", + "send an action emote", + "server-me server target message", + "Send an action emote.\n\n" + "Example:\n" + "\tirccdctl server-me freenode #staff \"going back soon\"") +{ +} + +void ServerMeCli::exec(Irccdctl &irccdctl, const std::vector &args) +{ + if (args.size() < 3) + throw std::runtime_error("server-me requires 3 arguments"); + + check(request(irccdctl, { + { "server", args[0] }, + { "target", args[1] }, + { "message", args[2] } + })); +} + +} // !cli + +} // !irccd diff -r 4f1fb35ef30e -r 9d09b8d882f3 irccdctl/cli-server-me.hpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/irccdctl/cli-server-me.hpp Wed Nov 09 13:03:29 2016 +0100 @@ -0,0 +1,53 @@ +/* + * cli-server-me.hpp -- implementation of irccdctl server-me + * + * Copyright (c) 2013-2016 David Demelier + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef IRCCDCTL_CLI_SERVER_ME_HPP +#define IRCCDCTL_CLI_SERVER_ME_HPP + +/** + * \file cli-server-me.hpp + * \brief Implementation of irccdctl server-me. + */ + +#include "cli.hpp" + +namespace irccd { + +namespace cli { + +/** + * \brief Implementation of irccdctl server-me. + */ +class ServerMeCli : public Cli { +public: + /** + * Default constructor. + */ + ServerMeCli(); + + /** + * \copydoc Command::exec + */ + void exec(Irccdctl &irccdctl, const std::vector &args) override; +}; + +} // !cli + +} // !irccd + +#endif // !_IRCCDCTL_COMMAND_SERVER_ME_H_ diff -r 4f1fb35ef30e -r 9d09b8d882f3 libirccd/irccd/cmd-server-me.cpp --- a/libirccd/irccd/cmd-server-me.cpp Tue Nov 08 22:39:55 2016 +0100 +++ b/libirccd/irccd/cmd-server-me.cpp Wed Nov 09 13:03:29 2016 +0100 @@ -38,7 +38,7 @@ util::json::requireString(args, "target"), util::json::requireString(args, "message") ); - client.success("server-message"); + client.success("server-me"); } } // !command