changeset 328:b9cb459bf93a

Irccdctl: bring back server-invite
author David Demelier <markand@malikania.fr>
date Mon, 07 Nov 2016 21:32:37 +0100
parents 365c03f6e43f
children bc7f65897762
files irccdctl/cli-server-invite.cpp irccdctl/cli-server-invite.hpp
diffstat 2 files changed, 103 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/irccdctl/cli-server-invite.cpp	Mon Nov 07 21:32:37 2016 +0100
@@ -0,0 +1,50 @@
+/*
+ * command-server-invite.cpp -- implementation of irccdctl server-invite
+ *
+ * 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 "cli-server-invite.hpp"
+
+namespace irccd {
+
+namespace cli {
+
+ServerInviteCli::ServerInviteCli()
+    : Cli("server-invite",
+          "invite someone",
+          "server-invite server nickname channel",
+          "Invite the specified target on the channel.\n\n"
+          "Example:\n"
+          "\tirccdctl server-invite freenode xorg62 #staff")
+{
+}
+
+void ServerInviteCli::exec(Irccdctl &irccdctl, const std::vector<std::string> &args)
+{
+    if (args.size() < 3)
+        throw std::invalid_argument("server-invite requires 3 arguments");
+
+    check(request(irccdctl, {
+        { "command",    "server-invite" },
+        { "server",     args[0]         },
+        { "target",     args[1]         },
+        { "channel",    args[2]         }
+    }));
+}
+
+} // !cli
+
+} // !irccd
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/irccdctl/cli-server-invite.hpp	Mon Nov 07 21:32:37 2016 +0100
@@ -0,0 +1,53 @@
+/*
+ * cli-server-invite.hpp -- implementation of irccdctl server-invite
+ *
+ * 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 IRCCDCTL_CLI_SERVER_INVITE_HPP
+#define IRCCDCTL_CLI_SERVER_INVITE_HPP
+
+/**
+ * \file cli-server-invite.hpp
+ * \brief Implementation of irccdctl server-invite.
+ */
+
+#include "cli.hpp"
+
+namespace irccd {
+
+namespace cli {
+
+/**
+ * \brief Implementation of irccdctl server-invite.
+ */
+class ServerInviteCli : public Cli {
+public:
+    /**
+     * Default constructor.
+     */
+    ServerInviteCli();
+
+    /**
+     * \copydoc Cli::exec
+     */
+    void exec(Irccdctl &irccdctl, const std::vector<std::string> &args) override;
+};
+
+} // !cli
+
+} // !irccd
+
+#endif // !IRCCDCTL_CLI_SERVER_INVITE_HPP