# HG changeset patch # User David Demelier # Date 1478722248 -3600 # Node ID fec96574245b5c3197804b711ce7b912d0b5d8c0 # Parent 3f805ae62174187ac94ebe72b1d3918e7ca8f6f7 Irccdctl: bring back server-notice diff -r 3f805ae62174 -r fec96574245b irccdctl/cli-server-notice.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/irccdctl/cli-server-notice.cpp Wed Nov 09 21:10:48 2016 +0100 @@ -0,0 +1,49 @@ +/* + * cli-server-notice.cpp -- implementation of irccdctl server-notice + * + * 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-notice.hpp" + +namespace irccd { + +namespace cli { + +ServerNoticeCli::ServerNoticeCli() + : Cli("server-notice", + "send a private notice", + "server-notice server target message", + "Send a private notice to the specified target.\n\n" + "Example:\n" + "\tirccdctl server-notice freenode jean \"I know you are here.\"") +{ +} + +void ServerNoticeCli::exec(Irccdctl &irccdctl, const std::vector &args) +{ + if (args.size() < 3) + throw std::invalid_argument("server-notice requires 3 arguments"); + + check(request(irccdctl, { + { "server", args[0] }, + { "target", args[1] }, + { "message", args[2] } + })); +} + +} // !cli + +} // !irccd diff -r 3f805ae62174 -r fec96574245b irccdctl/cli-server-notice.hpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/irccdctl/cli-server-notice.hpp Wed Nov 09 21:10:48 2016 +0100 @@ -0,0 +1,53 @@ +/* + * cli-server-notice.hpp -- implementation of irccdctl server-notice + * + * 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_NOTICE_HPP +#define IRCCDCTL_CLI_SERVER_NOTICE_HPP + +/** + * \file cli-server-cnotice.hpp + * \brief Implementation of irccdctl server-notice. + */ + +#include "cli.hpp" + +namespace irccd { + +namespace cli { + +/** + * \brief Implementation of irccdctl server-notice. + */ +class ServerNoticeCli : public Cli { +public: + /** + * Default constructor. + */ + ServerNoticeCli(); + + /** + * \copydoc Cli::exec + */ + void exec(Irccdctl &irccdctl, const std::vector &args) override; +}; + +} // !cli + +} // !irccd + +#endif // !IRCCDCTL_CLI_SERVER_NOTICE_HPP