diff irccdctl/cli.cpp @ 355:ace71e2b8e2a

Irccd: add server-topic support again
author David Demelier <markand@malikania.fr>
date Mon, 14 Nov 2016 21:40:10 +0100
parents b59767d7f3d3
children 6d598fea2689
line wrap: on
line diff
--- a/irccdctl/cli.cpp	Mon Nov 14 21:02:44 2016 +0100
+++ b/irccdctl/cli.cpp	Mon Nov 14 21:40:10 2016 +0100
@@ -803,6 +803,33 @@
     check(request(irccdctl, object));
 }
 
+/*
+ * ServerTopicCli.
+ * ------------------------------------------------------------------
+ */
+
+ServerTopicCli::ServerTopicCli()
+    : Cli("server-topic",
+          "change channel topic",
+          "server-topic server channel topic",
+          "Change the topic of the specified channel.\n\n"
+          "Example:\n"
+          "\tirccdctl server-topic freenode #wmfs \"This is the best channel\"")
+{
+}
+
+void ServerTopicCli::exec(Irccdctl &irccdctl, const std::vector<std::string> &args)
+{
+    if (args.size() < 3)
+        throw std::invalid_argument("server-topic requires 3 arguments");
+
+    check(request(irccdctl, {
+        { "server",     args[0] },
+        { "channel",    args[1] },
+        { "topic",      args[2] }
+    }));
+}
+
 } // !cli
 
 } // !irccd