changeset 574:18e80ec38ac7

Irccd: get rid of user/channel separation, closes #734 Do not make separate events on messages, notices and modes. This was currently added because the original libircclient made these distinctions between the both. In the IRC specification, the channel represents both a nickname and a real channel. Delete: - onChannelMode, - onChannelNotice, - onQuery, - onQueryCommand. Add: - Server.isSelf(target).
author David Demelier <markand@malikania.fr>
date Wed, 29 Nov 2017 14:44:36 +0100
parents 067240931226
children 0902cacbd31d
files MIGRATING.md doc/html/CMakeLists.txt doc/html/api/event/onChannelMode.md doc/html/api/event/onChannelNotice.md doc/html/api/event/onQuery.md doc/html/api/event/onQueryCommand.md doc/html/api/module/Irccd.Server/Irccd.Server.prototype.cmode.md doc/html/api/module/Irccd.Server/Irccd.Server.prototype.cnotice.md doc/html/api/module/Irccd.Server/Irccd.Server.prototype.isSelf.md irccd/main.cpp irccdctl/CMakeLists.txt irccdctl/main.cpp irccdctl/server_mode_cli.cpp irccdctl/server_notice_cli.cpp irccdctl/watch_cli.cpp libirccd-js/irccd/js/js_plugin.cpp libirccd-js/irccd/js/js_plugin.hpp libirccd-js/irccd/js/server_jsapi.cpp libirccd-test/irccd/journal_server.cpp libirccd-test/irccd/journal_server.hpp libirccd/irccd/command.cpp libirccd/irccd/command.hpp libirccd/irccd/dynlib_plugin.cpp libirccd/irccd/dynlib_plugin.hpp libirccd/irccd/plugin.hpp libirccd/irccd/server.cpp libirccd/irccd/server.hpp libirccd/irccd/server_service.cpp libirccd/irccd/server_service.hpp tests/CMakeLists.txt tests/cmd-rule-add/main.cpp tests/cmd-server-cmode/CMakeLists.txt tests/cmd-server-cmode/main.cpp tests/cmd-server-cnotice/CMakeLists.txt tests/cmd-server-cnotice/main.cpp tests/plugin-logger/main.cpp
diffstat 36 files changed, 209 insertions(+), 741 deletions(-) [+]
line wrap: on
line diff
--- a/MIGRATING.md	Wed Nov 29 09:48:40 2017 +0100
+++ b/MIGRATING.md	Wed Nov 29 14:44:36 2017 +0100
@@ -6,27 +6,38 @@
 Migrating from 2.x to 3.x
 -------------------------
 
+### Irccdctl
+
+  - The functions `server-cnotice` and `server-cmode` have been removed, use
+    `server-notice` and `server-mode` instead.
+
+### Network API
+
+  - The requests `server-cnotice` and `server-cmode` have been removed, use
+    `server-notice` and `server-mode` instead,
+  - The request `server-mode` command requires a new argument `channel`.
+
 ### CMake options
 
-  - WITH_CONFDIR has been renamed to WITH_SYSCONFDIR.
+  - `WITH_CONFDIR` has been renamed to `WITH_SYSCONFDIR`.
 
 ### Paths
 
   - The default plugins path has been changed from **share/irccd/plugins** to
     **libexec/irccd/plugins**.
 
-### Plugin configuration
+### Javascript API
 
-The following properties in `Irccd.Plugin` has been renamed:
+#### Events
 
-  - cachePath renamed to paths.cache,
-  - configPath renamed to paths.config,
-  - dataPath renamed to paths.data.
+  - The events `onChannelMode` and `onChannelNotice` have been removed, plugins
+    must use `Server.isSelf(target)` to determine a channel/private message.
 
-Note: these paths are no more automatically detected and set with the new
-      `[paths]` and `[paths.<name>]` sections.
+#### Module Server
 
-### Javascript API
+  - The methods `Server.cmode` and `Server.cnotice` have been removed, use
+    `Server.mode` and `Server.notice` instead,
+  - The method `Server.mode` requires a new argument `channel`.
 
 #### Module ElapsedTimer
 
@@ -36,3 +47,15 @@
 #### Module Directory
 
   - The property `Directory.count` has been removed.
+
+### Module Plugin
+
+The following properties in `Irccd.Plugin` has been renamed:
+
+  - **cachePath** renamed to **paths.cache**,
+  - **configPath** renamed to **paths.config**,
+  - **dataPath renamed** to **paths.data**.
+
+Note: these paths are no more automatically detected and set with the new
+      `[paths]` and `[paths.<name>]` sections.
+
--- a/doc/html/CMakeLists.txt	Wed Nov 29 09:48:40 2017 +0100
+++ b/doc/html/CMakeLists.txt	Wed Nov 29 14:44:36 2017 +0100
@@ -68,7 +68,6 @@
     ${html_SOURCE_DIR}/api/module/Irccd.Server/Irccd.Server.find.md
     ${html_SOURCE_DIR}/api/module/Irccd.Server/Irccd.Server.add.md
     ${html_SOURCE_DIR}/api/module/Irccd.Server/Irccd.Server.prototype.me.md
-    ${html_SOURCE_DIR}/api/module/Irccd.Server/Irccd.Server.prototype.cmode.md
     ${html_SOURCE_DIR}/api/module/Irccd.Server/Irccd.Server.prototype.mode.md
     ${html_SOURCE_DIR}/api/module/Irccd.Server/Irccd.Server.prototype.part.md
     ${html_SOURCE_DIR}/api/module/Irccd.Server/Irccd.Server.prototype.message.md
@@ -78,8 +77,8 @@
     ${html_SOURCE_DIR}/api/module/Irccd.Server/Irccd.Server.prototype.constructor.md
     ${html_SOURCE_DIR}/api/module/Irccd.Server/Irccd.Server.prototype.join.md
     ${html_SOURCE_DIR}/api/module/Irccd.Server/Irccd.Server.prototype.invite.md
-    ${html_SOURCE_DIR}/api/module/Irccd.Server/Irccd.Server.prototype.cnotice.md
     ${html_SOURCE_DIR}/api/module/Irccd.Server/Irccd.Server.prototype.info.md
+    ${html_SOURCE_DIR}/api/module/Irccd.Server/Irccd.Server.prototype.isSelf.md
     ${html_SOURCE_DIR}/api/module/Irccd.Server/Irccd.Server.prototype.notice.md
     ${html_SOURCE_DIR}/api/module/Irccd.Server/Irccd.Server.prototype.kick.md
     ${html_SOURCE_DIR}/api/module/Irccd.Server/Irccd.Server.prototype.toString.md
@@ -116,16 +115,13 @@
     ${html_SOURCE_DIR}/api/event/onWhois.md
     ${html_SOURCE_DIR}/api/event/onMessage.md
     ${html_SOURCE_DIR}/api/event/onPart.md
-    ${html_SOURCE_DIR}/api/event/onQueryCommand.md
     ${html_SOURCE_DIR}/api/event/onMode.md
     ${html_SOURCE_DIR}/api/event/onNotice.md
     ${html_SOURCE_DIR}/api/event/onLoad.md
     ${html_SOURCE_DIR}/api/event/onInvite.md
-    ${html_SOURCE_DIR}/api/event/onChannelNotice.md
     ${html_SOURCE_DIR}/api/event/onCommand.md
     ${html_SOURCE_DIR}/api/event/onKick.md
     ${html_SOURCE_DIR}/api/event/onReload.md
-    ${html_SOURCE_DIR}/api/event/onChannelMode.md
     ${html_SOURCE_DIR}/api/event/onTopic.md
     ${html_SOURCE_DIR}/api/event/onConnect.md
     ${html_SOURCE_DIR}/api/event/onJoin.md
@@ -133,7 +129,6 @@
     ${html_SOURCE_DIR}/api/event/onNick.md
     ${html_SOURCE_DIR}/api/event/onNames.md
     ${html_SOURCE_DIR}/api/event/onUnload.md
-    ${html_SOURCE_DIR}/api/event/onQuery.md
     ${html_SOURCE_DIR}/build/build-from-sources.md
     ${html_SOURCE_DIR}/build/build-options.md
     ${html_SOURCE_DIR}/dev/plugin-javascript-introduction.md
--- a/doc/html/api/event/onChannelMode.md	Wed Nov 29 09:48:40 2017 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,12 +0,0 @@
----
-event: onChannelMode
-js: true
-summary: "This event is triggered when someone changed the channel's mode."
-synopsis: "function onChannelMode(server, origin, channel, mode, arg)"
-arguments:
-  - "**server**: the current server,"
-  - "**origin**: the person who changed the mode,"
-  - "**channel**: the channel,"
-  - "**mode**: the new mode,"
-  - "**arg**: the mode argument, if supported."
----
--- a/doc/html/api/event/onChannelNotice.md	Wed Nov 29 09:48:40 2017 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,11 +0,0 @@
----
-event: onChannelNotice
-js: true
-summary: "This callback is called when someone sent a notice on a channel."
-synopsis: "function onChannelNotice(server, origin, channel, notice)"
-arguments:
-  - "**server**: the current server,"
-  - "**origin**: the one who sent the notice,"
-  - "**channel**: the target channel,"
-  - "**message**: the notice message."
----
--- a/doc/html/api/event/onQuery.md	Wed Nov 29 09:48:40 2017 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,10 +0,0 @@
----
-event: onQuery
-js: true
-summary: "This event is triggered when someone sent a private message to you."
-synopsis: "function onQuery(server, origin, message)"
-arguments:
-  - "**server**: the current server,"
-  - "**origin**: the person who said something,"
-  - "**message**: the message sent."
----
--- a/doc/html/api/event/onQueryCommand.md	Wed Nov 29 09:48:40 2017 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,12 +0,0 @@
----
-event: onQueryCommand
-js: true
-summary: "Execute special command in query."
-synopsis: "function onQueryCommand(server, origin, message)"
-arguments:
-  - "**server**: the current server,"
-  - "**origin**: who invoked the command,"
-  - "**message**: the real message, without the ! part."
----
-
-Synonym of [onCommand](@baseurl@api/event/onCommand.html) but for queries.
--- a/doc/html/api/module/Irccd.Server/Irccd.Server.prototype.cmode.md	Wed Nov 29 09:48:40 2017 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,9 +0,0 @@
----
-method: cmode
-js: true
-summary: "Change the mode of the specified channel."
-synopsis: "Server.prototype.cmode(channel, mode)"
-arguments:
-  - "**channel**: the channel target,"
-  - "**mode**: the mode."
----
--- a/doc/html/api/module/Irccd.Server/Irccd.Server.prototype.cnotice.md	Wed Nov 29 09:48:40 2017 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,9 +0,0 @@
----
-method: cnotice
-js: true
-summary: "Send a message notice on a channel."
-synopsis: "Server.prototype.cnotice(channel, message)"
-arguments:
-  - "**channel**: the target channel,"
-  - "**message**: the message."
----
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/html/api/module/Irccd.Server/Irccd.Server.prototype.isSelf.md	Wed Nov 29 14:44:36 2017 +0100
@@ -0,0 +1,9 @@
+---
+method: isSelf
+js: true
+summary: "Check if the nickname targets the bot."
+synopsis: "res = Server.prototype.isSelf(nickname)"
+returns: "True if nickname is same as the bot"
+arguments:
+  - "**nickname**: the nickname to check."
+---
--- a/irccd/main.cpp	Wed Nov 29 09:48:40 2017 +0100
+++ b/irccd/main.cpp	Wed Nov 29 14:44:36 2017 +0100
@@ -294,8 +294,6 @@
     instance->commands().add(std::make_unique<plugin_load_command>());
     instance->commands().add(std::make_unique<plugin_reload_command>());
     instance->commands().add(std::make_unique<plugin_unload_command>());
-    instance->commands().add(std::make_unique<server_channel_mode_command>());
-    instance->commands().add(std::make_unique<server_channel_notice_command>());
     instance->commands().add(std::make_unique<server_connect_command>());
     instance->commands().add(std::make_unique<server_disconnect_command>());
     instance->commands().add(std::make_unique<server_info_command>());
--- a/irccdctl/CMakeLists.txt	Wed Nov 29 09:48:40 2017 +0100
+++ b/irccdctl/CMakeLists.txt	Wed Nov 29 14:44:36 2017 +0100
@@ -54,10 +54,6 @@
     ${irccdctl_SOURCE_DIR}/rule_move_cli.hpp
     ${irccdctl_SOURCE_DIR}/rule_remove_cli.cpp
     ${irccdctl_SOURCE_DIR}/rule_remove_cli.hpp
-    ${irccdctl_SOURCE_DIR}/server_channel_mode_cli.cpp
-    ${irccdctl_SOURCE_DIR}/server_channel_mode_cli.hpp
-    ${irccdctl_SOURCE_DIR}/server_channel_notice_cli.cpp
-    ${irccdctl_SOURCE_DIR}/server_channel_notice_cli.hpp
     ${irccdctl_SOURCE_DIR}/server_connect_cli.cpp
     ${irccdctl_SOURCE_DIR}/server_connect_cli.hpp
     ${irccdctl_SOURCE_DIR}/server_disconnect_cli.cpp
--- a/irccdctl/main.cpp	Wed Nov 29 09:48:40 2017 +0100
+++ b/irccdctl/main.cpp	Wed Nov 29 14:44:36 2017 +0100
@@ -50,8 +50,6 @@
 #include "rule_list_cli.hpp"
 #include "rule_move_cli.hpp"
 #include "rule_remove_cli.hpp"
-#include "server_channel_mode_cli.hpp"
-#include "server_channel_notice_cli.hpp"
 #include "server_connect_cli.hpp"
 #include "server_disconnect_cli.hpp"
 #include "server_info_cli.hpp"
@@ -480,8 +478,6 @@
     add(std::make_unique<plugin_load_cli>());
     add(std::make_unique<plugin_reload_cli>());
     add(std::make_unique<plugin_unload_cli>());
-    add(std::make_unique<server_channel_mode_cli>());
-    add(std::make_unique<server_channel_notice_cli>());
     add(std::make_unique<server_connect_cli>());
     add(std::make_unique<server_disconnect_cli>());
     add(std::make_unique<server_info_cli>());
--- a/irccdctl/server_mode_cli.cpp	Wed Nov 29 09:48:40 2017 +0100
+++ b/irccdctl/server_mode_cli.cpp	Wed Nov 29 14:44:36 2017 +0100
@@ -30,12 +30,23 @@
 void server_mode_cli::exec(ctl::controller& ctl, const std::vector<std::string>& args)
 {
     if (args.size() < 2)
-        throw std::invalid_argument("server-mode requires 2 arguments");
+        throw std::invalid_argument("server-mode requires at least 3 arguments");
+
+    auto json = nlohmann::json({
+        { "command",    "server-mode"   },
+        { "server",     args[0]         },
+        { "channel",    args[1]         },
+        { "mode",       args[2]         }
+    });
 
-    request(ctl, {
-        { "server", args[0] },
-        { "mode",   args[1] }
-    });
+    if (args.size() >= 4)
+        json["limit"] = args[3];
+    if (args.size() >= 5)
+        json["user"] = args[4];
+    if (args.size() >= 6)
+        json["mask"] = args[5];
+
+    request(ctl, std::move(json));
 }
 
 } // !ctl
--- a/irccdctl/server_notice_cli.cpp	Wed Nov 29 09:48:40 2017 +0100
+++ b/irccdctl/server_notice_cli.cpp	Wed Nov 29 14:44:36 2017 +0100
@@ -33,9 +33,10 @@
         throw std::invalid_argument("server-notice requires 3 arguments");
 
     request(ctl, {
-        { "server",     args[0] },
-        { "target",     args[1] },
-        { "message",    args[2] }
+        { "command",    "server-notice" },
+        { "server",     args[0]         },
+        { "target",     args[1]         },
+        { "message",    args[2]         }
     });
 }
 
--- a/irccdctl/watch_cli.cpp	Wed Nov 29 09:48:40 2017 +0100
+++ b/irccdctl/watch_cli.cpp	Wed Nov 29 14:44:36 2017 +0100
@@ -49,24 +49,6 @@
     return "native";
 }
 
-void onChannelMode(const nlohmann::json &v)
-{
-    std::cout << "event:       onChannelMode\n";
-    std::cout << "server:      " << json_util::pretty(v, "server") << "\n";
-    std::cout << "origin:      " << json_util::pretty(v, "origin") << "\n";
-    std::cout << "mode:        " << json_util::pretty(v, "mode") << "\n";
-    std::cout << "argument:    " << json_util::pretty(v, "argument") << "\n";
-}
-
-void onChannelNotice(const nlohmann::json &v)
-{
-    std::cout << "event:       onChannelNotice\n";
-    std::cout << "server:      " << json_util::pretty(v, "server") << "\n";
-    std::cout << "origin:      " << json_util::pretty(v, "origin") << "\n";
-    std::cout << "channel:     " << json_util::pretty(v, "channel") << "\n";
-    std::cout << "message:     " << json_util::pretty(v, "message") << "\n";
-}
-
 void onConnect(const nlohmann::json &v)
 {
     std::cout << "event:       onConnect\n";
@@ -158,14 +140,6 @@
     std::cout << "reason:      " << json_util::pretty(v, "reason") << "\n";
 }
 
-void onQuery(const nlohmann::json &v)
-{
-    std::cout << "event:       onQuery\n";
-    std::cout << "server:      " << json_util::pretty(v, "server") << "\n";
-    std::cout << "origin:      " << json_util::pretty(v, "origin") << "\n";
-    std::cout << "message:     " << json_util::pretty(v, "message") << "\n";
-}
-
 void onTopic(const nlohmann::json &v)
 {
     std::cout << "event:       onTopic\n";
@@ -186,8 +160,6 @@
 }
 
 const std::unordered_map<std::string, std::function<void (const nlohmann::json&)>> events{
-    { "onChannelMode",      onChannelMode   },
-    { "onChannelNotice",    onChannelNotice },
     { "onConnect",          onConnect       },
     { "onInvite",           onInvite        },
     { "onJoin",             onJoin          },
@@ -199,7 +171,6 @@
     { "onNick",             onNick          },
     { "onNotice",           onNotice        },
     { "onPart",             onPart          },
-    { "onQuery",            onQuery         },
     { "onTopic",            onTopic         },
     { "onWhois",            onWhois         }
 };
--- a/libirccd-js/irccd/js/js_plugin.cpp	Wed Nov 29 09:48:40 2017 +0100
+++ b/libirccd-js/irccd/js/js_plugin.cpp	Wed Nov 29 14:44:36 2017 +0100
@@ -152,29 +152,6 @@
     duk_pop(context_);
 }
 
-void js_plugin::on_channel_mode(irccd& , const channel_mode_event &event)
-{
-    dukx_stack_assert sa(context_);
-
-    dukx_push(context_, std::move(event.server));
-    dukx_push(context_, event.origin);
-    dukx_push(context_, event.channel);
-    dukx_push(context_, event.mode);
-    dukx_push(context_, event.argument);
-    call("onChannelMode", 5);
-}
-
-void js_plugin::on_channel_notice(irccd& , const channel_notice_event &event)
-{
-    dukx_stack_assert sa(context_);
-
-    dukx_push(context_, std::move(event.server));
-    dukx_push(context_, event.origin);
-    dukx_push(context_, event.channel);
-    dukx_push(context_, event.message);
-    call("onChannelNotice", 4);
-}
-
 void js_plugin::on_command(irccd& , const message_event &event)
 {
     dukx_stack_assert sa(context_);
--- a/libirccd-js/irccd/js/js_plugin.hpp	Wed Nov 29 09:48:40 2017 +0100
+++ b/libirccd-js/irccd/js/js_plugin.hpp	Wed Nov 29 14:44:36 2017 +0100
@@ -146,16 +146,6 @@
     void on_connect(irccd& irccd, const connect_event& event) override;
 
     /**
-     * \copydoc Plugin::on_channel_mode
-     */
-    void on_channel_mode(irccd& irccd, const channel_mode_event& event) override;
-
-    /**
-     * \copydoc Plugin::on_channel_notice
-     */
-    void on_channel_notice(irccd& irccd, const channel_notice_event& event) override;
-
-    /**
      * \copydoc Plugin::on_invite
      */
     void on_invite(irccd& irccd, const invite_event& event) override;
--- a/libirccd-js/irccd/js/server_jsapi.cpp	Wed Nov 29 09:48:40 2017 +0100
+++ b/libirccd-js/irccd/js/server_jsapi.cpp	Wed Nov 29 14:44:36 2017 +0100
@@ -50,40 +50,6 @@
 }
 
 /*
- * Method: Server.cmode(channel, mode)
- * ------------------------------------------------------------------
- *
- * Change a channel mode.
- *
- * Arguments:
- *   - channel, the channel,
- *   - mode, the mode.
- */
-duk_ret_t cmode(duk_context* ctx)
-{
-    self(ctx)->cmode(duk_require_string(ctx, 0), duk_require_string(ctx, 1));
-
-    return 0;
-}
-
-/*
- * Method: Server.cnotice(channel, message)
- * ------------------------------------------------------------------
- *
- * Send a channel notice.
- *
- * Arguments:
- *   - channel, the channel,
- *   - message, the message.
- */
-duk_ret_t cnotice(duk_context* ctx)
-{
-    self(ctx)->cnotice(duk_require_string(ctx, 0), duk_require_string(ctx, 1));
-
-    return 0;
-}
-
-/*
  * Method: Server.info()
  * ------------------------------------------------------------------
  *
@@ -143,6 +109,15 @@
 }
 
 /*
+ * Method: Server.isSelf(nickname)
+ * ------------------------------------------------------------------
+ */
+duk_ret_t isSelf(duk_context* ctx)
+{
+    return dukx_push(ctx, self(ctx)->is_self(duk_require_string(ctx, 0)));
+}
+
+/*
  * Method: Server.join(channel, password = undefined)
  * ------------------------------------------------------------------
  *
@@ -212,7 +187,7 @@
 }
 
 /*
- * Method: Server.mode(mode)
+ * Method: Server.mode(channel, mode, limit, user, mask)
  * ------------------------------------------------------------------
  *
  * Change your mode.
@@ -222,7 +197,13 @@
  */
 duk_ret_t mode(duk_context* ctx)
 {
-    self(ctx)->mode(duk_require_string(ctx, 0));
+    self(ctx)->mode(
+        duk_require_string(ctx, 0),
+        duk_require_string(ctx, 1),
+        duk_opt_string(ctx, 2, ""),
+        duk_opt_string(ctx, 3, ""),
+        duk_opt_string(ctx, 4, "")
+    );
 
     return 0;
 }
@@ -496,10 +477,9 @@
 }
 
 const duk_function_list_entry methods[] = {
-    { "cmode",      cmode,      2           },
-    { "cnotice",    cnotice,    2           },
     { "info",       info,       0           },
     { "invite",     invite,     2           },
+    { "isSelf",     isSelf,     1           },
     { "join",       join,       DUK_VARARGS },
     { "kick",       kick,       DUK_VARARGS },
     { "me",         me,         2           },
--- a/libirccd-test/irccd/journal_server.cpp	Wed Nov 29 09:48:40 2017 +0100
+++ b/libirccd-test/irccd/journal_server.cpp	Wed Nov 29 14:44:36 2017 +0100
@@ -27,24 +27,6 @@
     });
 }
 
-void journal_server::cmode(std::string channel, std::string mode)
-{
-    cqueue_.push_back({
-        { "command",    "cmode"     },
-        { "channel",    channel     },
-        { "mode",       mode        }
-    });
-}
-
-void journal_server::cnotice(std::string channel, std::string message)
-{
-    cqueue_.push_back({
-        { "command",    "cnotice"   },
-        { "channel",    channel     },
-        { "message",    message     }
-    });
-}
-
 void journal_server::invite(std::string target, std::string channel)
 {
     cqueue_.push_back({
@@ -91,11 +73,19 @@
     });
 }
 
-void journal_server::mode(std::string mode)
+void journal_server::mode(std::string channel,
+                          std::string mode,
+                          std::string limit,
+                          std::string user,
+                          std::string mask)
 {
     cqueue_.push_back({
         { "command",    "mode"      },
-        { "mode",       mode        }
+        { "channel",    channel     },
+        { "mode",       mode        },
+        { "limit",      limit       },
+        { "user",       user        },
+        { "mask",       mask        }
     });
 }
 
--- a/libirccd-test/irccd/journal_server.hpp	Wed Nov 29 09:48:40 2017 +0100
+++ b/libirccd-test/irccd/journal_server.hpp	Wed Nov 29 14:44:36 2017 +0100
@@ -106,16 +106,6 @@
     void reconnect() noexcept override;
 
     /**
-     * \copydoc server::cmode
-     */
-    void cmode(std::string channel, std::string mode) override;
-
-    /**
-     * \copydoc server::cnotice
-     */
-    void cnotice(std::string channel, std::string message) override;
-
-    /**
      * \copydoc server::invite
      */
     void invite(std::string target, std::string channel) override;
@@ -143,7 +133,11 @@
     /**
      * \copydoc server::mode
      */
-    void mode(std::string mode) override;
+    void mode(std::string channel,
+              std::string mode,
+              std::string limit = "",
+              std::string user = "",
+              std::string mask = "") override;
 
     /**
      * \copydoc server::names
--- a/libirccd/irccd/command.cpp	Wed Nov 29 09:48:40 2017 +0100
+++ b/libirccd/irccd/command.cpp	Wed Nov 29 14:44:36 2017 +0100
@@ -23,6 +23,7 @@
 #include "plugin_service.hpp"
 #include "server_service.hpp"
 #include "transport_client.hpp"
+#include "string_util.hpp"
 #include "util.hpp"
 
 using namespace std::string_literals;
@@ -147,6 +148,21 @@
     return index->get<int>();
 }
 
+std::shared_ptr<server> get_server(irccd& daemon, const nlohmann::json& args)
+{
+    auto id = json_util::get_string(args, "server");
+
+    if (!string_util::is_identifier(id))
+        throw server_error::invalid_identifier;
+
+    auto server = daemon.servers().get(id);
+
+    if (!server)
+        throw server_error::not_found;
+
+    return server;
+}
+
 } // !namespace
 
 plugin_config_command::plugin_config_command()
@@ -233,34 +249,6 @@
     client.success("plugin-unload");
 }
 
-server_channel_mode_command::server_channel_mode_command()
-    : command("server-cmode")
-{
-}
-
-void server_channel_mode_command::exec(irccd& irccd, transport_client& client, const nlohmann::json& args)
-{
-    irccd.servers().require(json_util::require_identifier(args, "server"))->cmode(
-        json_util::require_string(args, "channel"),
-        json_util::require_string(args, "mode")
-    );
-    client.success("server-cmode");
-}
-
-server_channel_notice_command::server_channel_notice_command()
-    : command("server-cnotice")
-{
-}
-
-void server_channel_notice_command::exec(irccd& irccd, transport_client& client, const nlohmann::json& args)
-{
-    irccd.servers().require(json_util::require_string(args, "server"))->cnotice(
-        json_util::require_string(args, "channel"),
-        json_util::require_string(args, "message")
-    );
-    client.success("server-cnotice");
-}
-
 server_connect_command::server_connect_command()
     : command("server-connect")
 {
@@ -428,9 +416,19 @@
 
 void server_mode_command::exec(irccd& irccd, transport_client& client, const nlohmann::json& args)
 {
-    irccd.servers().require(json_util::require_identifier(args, "server"))->mode(
-        json_util::require_string(args, "mode")
-    );
+    auto channel = json_util::get_string(args, "channel");
+    auto mode = json_util::get_string(args, "mode");
+
+    if (channel.empty())
+        throw server_error(server_error::invalid_channel);
+    if (mode.empty())
+        throw server_error(server_error::invalid_mode);
+
+    auto limit = json_util::get_string(args, "limit");
+    auto user = json_util::get_string(args, "user");
+    auto mask = json_util::get_string(args, "mask");
+
+    get_server(irccd, args)->mode(channel, mode, limit, user, mask);
     client.success("server-mode");
 }
 
--- a/libirccd/irccd/command.hpp	Wed Nov 29 09:48:40 2017 +0100
+++ b/libirccd/irccd/command.hpp	Wed Nov 29 14:44:36 2017 +0100
@@ -209,38 +209,6 @@
 };
 
 /**
- * \brief Implementation of server-cmode transport command.
- */
-class server_channel_mode_command : public command {
-public:
-    /**
-     * Constructor.
-     */
-    server_channel_mode_command();
-
-    /**
-     * \copydoc command::exec
-     */
-    void exec(irccd& irccd, transport_client& client, const nlohmann::json& args) override;
-};
-
-/**
- * \brief Implementation of server-cnotice transport command.
- */
-class server_channel_notice_command : public command {
-public:
-    /**
-     * Constructor.
-     */
-    server_channel_notice_command();
-
-    /**
-     * \copydoc command::exec
-     */
-    void exec(irccd& irccd, transport_client& client, const nlohmann::json& args) override;
-};
-
-/**
  * \brief Implementation of server-connect transport command.
  */
 class server_connect_command : public command {
--- a/libirccd/irccd/dynlib_plugin.cpp	Wed Nov 29 09:48:40 2017 +0100
+++ b/libirccd/irccd/dynlib_plugin.cpp	Wed Nov 29 14:44:36 2017 +0100
@@ -75,16 +75,6 @@
     plugin_->on_connect(irccd, ev);
 }
 
-void dynlib_plugin::on_channel_mode(irccd& irccd, const channel_mode_event& ev)
-{
-    plugin_->on_channel_mode(irccd, ev);
-}
-
-void dynlib_plugin::on_channel_notice(irccd& irccd, const channel_notice_event& ev)
-{
-    plugin_->on_channel_notice(irccd, ev);
-}
-
 void dynlib_plugin::on_invite(irccd& irccd, const invite_event& ev)
 {
     plugin_->on_invite(irccd, ev);
--- a/libirccd/irccd/dynlib_plugin.hpp	Wed Nov 29 09:48:40 2017 +0100
+++ b/libirccd/irccd/dynlib_plugin.hpp	Wed Nov 29 14:44:36 2017 +0100
@@ -60,16 +60,6 @@
     void on_connect(irccd& irccd, const connect_event& event) override;
 
     /**
-     * \copydoc plugin::on_channel_mode
-     */
-    void on_channel_mode(irccd& irccd, const channel_mode_event& event) override;
-
-    /**
-     * \copydoc plugin::on_channel_notice
-     */
-    void on_channel_notice(irccd& irccd, const channel_notice_event& event) override;
-
-    /**
      * \copydoc plugin::on_invite
      */
     void on_invite(irccd& irccd, const invite_event& event) override;
--- a/libirccd/irccd/plugin.hpp	Wed Nov 29 09:48:40 2017 +0100
+++ b/libirccd/irccd/plugin.hpp	Wed Nov 29 14:44:36 2017 +0100
@@ -280,28 +280,6 @@
     }
 
     /**
-     * On channel mode.
-     *
-     * \param irccd the irccd instance
-     * \param event the event
-     */
-    virtual void on_channel_mode(irccd& irccd, const channel_mode_event& event)
-    {
-        util::unused(irccd, event);
-    }
-
-    /**
-     * On a channel notice.
-     *
-     * \param irccd the irccd instance
-     * \param event the event
-     */
-    virtual void on_channel_notice(irccd& irccd, const channel_notice_event& event)
-    {
-        util::unused(irccd, event);
-    }
-
-    /**
      * On invitation.
      *
      * \param irccd the irccd instance
--- a/libirccd/irccd/server.cpp	Wed Nov 29 09:48:40 2017 +0100
+++ b/libirccd/irccd/server.cpp	Wed Nov 29 14:44:36 2017 +0100
@@ -284,10 +284,15 @@
 
 void server::dispatch_mode(const irc::message& msg)
 {
-    if (is_self(msg.arg(1)))
-        on_mode({shared_from_this(), msg.prefix(), msg.arg(1)});
-    else
-        on_channel_mode({shared_from_this(), msg.prefix(), msg.arg(0), msg.arg(1), msg.arg(2)});
+    on_mode({
+        shared_from_this(),
+        msg.prefix(),
+        msg.arg(0),
+        msg.arg(1),
+        msg.arg(2),
+        msg.arg(3),
+        msg.arg(4)
+    });
 }
 
 void server::dispatch_namreply(const irc::message& msg)
@@ -324,10 +329,7 @@
 
 void server::dispatch_notice(const irc::message& msg)
 {
-    if (is_self(msg.arg(1)))
-        on_notice({shared_from_this(), msg.prefix(), msg.arg(1)});
-    else
-        on_channel_notice({shared_from_this(), msg.prefix(), msg.arg(0), msg.arg(1)});
+    on_notice({shared_from_this(), msg.prefix(), msg.arg(0), msg.arg(1)});
 }
 
 void server::dispatch_part(const irc::message& msg)
@@ -569,22 +571,6 @@
     return nickname_ == irc::user::parse(target).nick();
 }
 
-void server::cmode(std::string channel, std::string mode)
-{
-    assert(channel.c_str());
-    assert(mode.c_str());
-
-    if (!mode.empty())
-        send(string_util::sprintf("MODE %s :%s", channel, mode));
-    else
-        send(string_util::sprintf("MODE %s", channel));
-}
-
-void server::cnotice(std::string channel, std::string message)
-{
-    notice(std::move(channel), std::move(message));
-}
-
 void server::invite(std::string target, std::string channel)
 {
     assert(!target.empty());
@@ -639,14 +625,27 @@
     send(string_util::sprintf("PRIVMSG %s :%s", target, message));
 }
 
-void server::mode(std::string mode)
+void server::mode(std::string channel,
+                  std::string mode,
+                  std::string limit,
+                  std::string user,
+                  std::string mask)
 {
-    assert(mode.c_str());
+    assert(!channel.empty());
+    assert(!mode.empty());
+
+    std::ostringstream oss;
 
-    if (!mode.empty())
-        send(string_util::sprintf("MODE %s :%s", nickname_, mode));
-    else
-        send(string_util::sprintf("MODE %s", nickname_));
+    oss << "MODE " << channel << " " << mode;
+
+    if (!limit.empty())
+        oss << " " << limit;
+    if (!user.empty())
+        oss << " " << user;
+    if (!mask.empty())
+        oss << " " << mask;
+
+    send(oss.str());
 }
 
 void server::names(std::string channel)
@@ -676,12 +675,9 @@
 
 void server::send(std::string raw)
 {
+    assert(state_ == state_t::connected);
     assert(!raw.empty());
 
-    // TODO: adapt to custom exception later.
-    if (state_ != state_t::connected)
-        throw std::runtime_error("server is not connected");
-
     conn_->send(std::move(raw), [this] (auto code) {
         if (code) {
             state_ = state_t::disconnected;
@@ -721,21 +717,25 @@
             switch (static_cast<server_error::error>(e)) {
             case server_error::not_found:
                 return "server not found";
-            case server_error::error::invalid_identifier:
+            case server_error::invalid_identifier:
                 return "invalid identifier";
-            case server_error::error::not_connected:
+            case server_error::not_connected:
                 return "server is not connected";
-            case server_error::error::already_connected:
+            case server_error::already_connected:
                 return "server is already connected";
-            case server_error::error::invalid_port_number:
+            case server_error::invalid_port_number:
                 return "invalid port number specified";
-            case server_error::error::invalid_reconnect_tries_number:
+            case server_error::invalid_reconnect_tries_number:
                 return "invalid number of reconnection tries";
-            case server_error::error::invalid_reconnect_timeout_number:
+            case server_error::invalid_reconnect_timeout_number:
                 return "invalid reconnect timeout number";
-            case server_error::error::invalid_host:
+            case server_error::invalid_host:
                 return "invalid hostname";
-            case server_error::error::ssl_disabled:
+            case server_error::invalid_channel:
+                return "invalid or empty channel";
+            case server_error::invalid_mode:
+                return "invalid or empty mode";
+            case server_error::ssl_disabled:
                 return "ssl is not enabled";
             default:
                 return "no error";
--- a/libirccd/irccd/server.hpp	Wed Nov 29 09:48:40 2017 +0100
+++ b/libirccd/irccd/server.hpp	Wed Nov 29 14:44:36 2017 +0100
@@ -76,29 +76,6 @@
 };
 
 /**
- * \brief Channel event.
- */
-class channel_mode_event {
-public:
-    std::shared_ptr<class server> server;   //!< The server.
-    std::string origin;                     //!< The originator.
-    std::string channel;                    //!< The channel.
-    std::string mode;                       //!< The mode.
-    std::string argument;                   //!< The mode argument (Optional).
-};
-
-/**
- * \brief Channel notice event.
- */
-class channel_notice_event {
-public:
-    std::shared_ptr<class server> server;   //!< The server.
-    std::string origin;                     //!< The originator.
-    std::string channel;                    //!< The channel.
-    std::string message;                    //!< The notice message.
-};
-
-/**
  * \brief Connection success event.
  */
 class connect_event {
@@ -168,7 +145,11 @@
 public:
     std::shared_ptr<class server> server;   //!< The server.
     std::string origin;                     //!< The originator.
+    std::string channel;                    //!< The channel or target.
     std::string mode;                       //!< The mode.
+    std::string limit;                      //!< The optional limit.
+    std::string user;                       //!< The optional user.
+    std::string mask;                       //!< The optional ban mask.
 };
 
 /**
@@ -198,6 +179,7 @@
 public:
     std::shared_ptr<class server> server;   //!< The server.
     std::string origin;                     //!< The originator.
+    std::string channel;                    //!< The channel or target.
     std::string message;                    //!< The message.
 };
 
@@ -283,22 +265,6 @@
     };
 
     /**
-     * Signal: on_channel_mode
-     * ----------------------------------------------------------
-     *
-     * Triggered when someone changed the channel mode.
-     */
-    boost::signals2::signal<void (channel_mode_event)> on_channel_mode;
-
-    /**
-     * Signal: on_channel_notice
-     * ----------------------------------------------------------
-     *
-     * Triggered when a notice has been sent on a channel.
-     */
-    boost::signals2::signal<void (channel_notice_event)> on_channel_notice;
-
-    /**
      * Signal: on_connect
      * ----------------------------------------------------------
      *
@@ -461,8 +427,6 @@
 
     void remove_joined_channel(const std::string& channel);
 
-    void dispatch_channel_mode(const irc::message&);
-    void dispatch_channel_notice(const irc::message&);
     void dispatch_connect(const irc::message&);
     void dispatch_endofnames(const irc::message&);
     void dispatch_endofwhois(const irc::message&);
@@ -793,6 +757,14 @@
     }
 
     /**
+     * Determine if the nickname is the bot itself.
+     *
+     * \param nick the nickname to check
+     * \return true if it is the bot
+     */
+    bool is_self(const std::string& nick) const noexcept;
+
+    /**
      * Start connecting.
      */
     virtual void connect() noexcept;
@@ -808,30 +780,6 @@
     virtual void reconnect() noexcept;
 
     /**
-     * Determine if the nickname is the bot itself.
-     *
-     * \param nick the nickname to check
-     * \return true if it is the bot
-     */
-    bool is_self(const std::string& nick) const noexcept;
-
-    /**
-     * Change the channel mode.
-     *
-     * \param channel the channel
-     * \param mode the new mode
-     */
-    virtual void cmode(std::string channel, std::string mode);
-
-    /**
-     * Send a channel notice.
-     *
-     * \param channel the channel
-     * \param message message notice
-     */
-    virtual void cnotice(std::string channel, std::string message);
-
-    /**
      * Invite a user to a channel.
      *
      * \param target the target nickname
@@ -875,11 +823,19 @@
     virtual void message(std::string target, std::string message);
 
     /**
-     * Change your user mode.
+     * Change channel/user mode.
      *
+     * \param channel the channel or nickname
      * \param mode the mode
+     * \param limit the optional limit
+     * \param user the optional user
+     * \param mask the optional ban mask
      */
-    virtual void mode(std::string mode);
+    virtual void mode(std::string channel,
+                      std::string mode,
+                      std::string limit = "",
+                      std::string user = "",
+                      std::string mask = "");
 
     /**
      * Request the list of names.
@@ -911,7 +867,7 @@
      * Send a raw message to the IRC server. You don't need to add
      * message terminators.
      *
-     * \warning Use this function with care
+     * \pre state() == state_t::connected
      * \param raw the raw message (without `\r\n\r\n`)
      */
     virtual void send(std::string raw);
@@ -971,6 +927,12 @@
         //!< The specified host was invalid.
         invalid_host,
 
+        //!< The channel was empty or invalid.
+        invalid_channel,
+
+        //!< The mode given was empty.
+        invalid_mode,
+
         //!< SSL was requested but is disabled.
         ssl_disabled,
     };
--- a/libirccd/irccd/server_service.cpp	Wed Nov 29 09:48:40 2017 +0100
+++ b/libirccd/irccd/server_service.cpp	Wed Nov 29 14:44:36 2017 +0100
@@ -57,58 +57,6 @@
 
 } // !namespace
 
-void server_service::handle_channel_mode(const channel_mode_event& ev)
-{
-    log::debug() << "server " << ev.server->name() << ": event onChannelMode:\n";
-    log::debug() << "  origin: " << ev.origin << "\n";
-    log::debug() << "  channel: " << ev.channel << "\n";
-    log::debug() << "  mode: " << ev.mode << "\n";
-    log::debug() << "  argument: " << ev.argument << std::endl;
-
-    irccd_.transports().broadcast(nlohmann::json::object({
-        { "event",      "onChannelMode"     },
-        { "server",     ev.server->name()   },
-        { "origin",     ev.origin           },
-        { "channel",    ev.channel          },
-        { "mode",       ev.mode             },
-        { "argument",   ev.argument         }
-    }));
-
-    dispatch(irccd_, ev.server->name(), ev.origin, ev.channel,
-        [=] (plugin&) -> std::string {
-            return "onChannelMode";
-        },
-        [=] (plugin& plugin) {
-            plugin.on_channel_mode(irccd_, ev);
-        }
-    );
-}
-
-void server_service::handle_channel_notice(const channel_notice_event& ev)
-{
-    log::debug() << "server " << ev.server->name() << ": event onChannelNotice:\n";
-    log::debug() << "  origin: " << ev.origin << "\n";
-    log::debug() << "  channel: " << ev.channel << "\n";
-    log::debug() << "  message: " << ev.message << std::endl;
-
-    irccd_.transports().broadcast(nlohmann::json::object({
-        { "event",      "onChannelNotice"   },
-        { "server",     ev.server->name()   },
-        { "origin",     ev.origin           },
-        { "channel",    ev.channel          },
-        { "message",    ev.message          }
-    }));
-
-    dispatch(irccd_, ev.server->name(), ev.origin, ev.channel,
-        [=] (plugin&) -> std::string {
-            return "onChannelNotice";
-        },
-        [=] (plugin& plugin) {
-            plugin.on_channel_notice(irccd_, ev);
-        }
-    );
-}
-
 void server_service::handle_connect(const connect_event& ev)
 {
     log::debug() << "server " << ev.server->name() << ": event onConnect" << std::endl;
@@ -268,13 +216,21 @@
 {
     log::debug() << "server " << ev.server->name() << ": event onMode\n";
     log::debug() << "  origin: " << ev.origin << "\n";
-    log::debug() << "  mode: " << ev.mode << std::endl;
+    log::debug() << "  channel: " << ev.channel << "\n";
+    log::debug() << "  mode: " << ev.mode << "\n";
+    log::debug() << "  limit: " << ev.limit << "\n";
+    log::debug() << "  user: " << ev.user << "\n";
+    log::debug() << "  mask: " << ev.mask << std::endl;
 
     irccd_.transports().broadcast(nlohmann::json::object({
         { "event",      "onMode"            },
         { "server",     ev.server->name()   },
         { "origin",     ev.origin           },
-        { "mode",       ev.mode             }
+        { "channel",    ev.channel          },
+        { "mode",       ev.mode             },
+        { "limit",      ev.limit            },
+        { "user",       ev.user             },
+        { "mask",       ev.mask             }
     }));
 
     dispatch(irccd_, ev.server->name(), ev.origin, /* channel */ "",
@@ -342,12 +298,14 @@
 {
     log::debug() << "server " << ev.server->name() << ": event onNotice:\n";
     log::debug() << "  origin: " << ev.origin << "\n";
+    log::debug() << "  channel: " << ev.channel << "\n";
     log::debug() << "  message: " << ev.message << std::endl;
 
     irccd_.transports().broadcast(nlohmann::json::object({
         { "event",      "onNotice"          },
         { "server",     ev.server->name()   },
         { "origin",     ev.origin           },
+        { "channel",    ev.channel          },
         { "message",    ev.message          }
     }));
 
@@ -386,41 +344,6 @@
     );
 }
 
-void server_service::handle_query(const query_event& ev)
-{
-    log::debug() << "server " << ev.server->name() << ": event onQuery:\n";
-    log::debug() << "  origin: " << ev.origin << "\n";
-    log::debug() << "  message: " << ev.message << std::endl;
-
-    irccd_.transports().broadcast(nlohmann::json::object({
-        { "event",      "onQuery"           },
-        { "server",     ev.server->name()   },
-        { "origin",     ev.origin           },
-        { "message",    ev.message          }
-    }));
-
-    dispatch(irccd_, ev.server->name(), ev.origin, /* channel */ "",
-        [=] (plugin& plugin) -> std::string {
-            return string_util::parse_message(
-                ev.message,
-                ev.server->command_char(),
-                plugin.name()
-            ).type == string_util::message_pack::type::command ? "onQueryCommand" : "onQuery";
-        },
-        [=] (plugin& plugin) mutable {
-            auto copy = ev;
-            auto pack = string_util::parse_message(copy.message, copy.server->command_char(), plugin.name());
-
-            copy.message = pack.message;
-
-            if (pack.type == string_util::message_pack::type::command)
-                plugin.on_query_command(irccd_, copy);
-            else
-                plugin.on_query(irccd_, copy);
-        }
-    );
-}
-
 void server_service::handle_topic(const topic_event& ev)
 {
     log::debug() << "server " << ev.server->name() << ": event onTopic:\n";
@@ -492,8 +415,6 @@
 
     std::weak_ptr<class server> ptr(server);
 
-    server->on_channel_mode.connect(boost::bind(&server_service::handle_channel_mode, this, _1));
-    server->on_channel_notice.connect(boost::bind(&server_service::handle_channel_notice, this, _1));
     server->on_connect.connect(boost::bind(&server_service::handle_connect, this, _1));
     server->on_invite.connect(boost::bind(&server_service::handle_invite, this, _1));
     server->on_join.connect(boost::bind(&server_service::handle_join, this, _1));
@@ -505,7 +426,6 @@
     server->on_nick.connect(boost::bind(&server_service::handle_nick, this, _1));
     server->on_notice.connect(boost::bind(&server_service::handle_notice, this, _1));
     server->on_part.connect(boost::bind(&server_service::handle_part, this, _1));
-    server->on_query.connect(boost::bind(&server_service::handle_query, this, _1));
     server->on_topic.connect(boost::bind(&server_service::handle_topic, this, _1));
     server->on_whois.connect(boost::bind(&server_service::handle_whois, this, _1));
     server->on_die.connect([this, ptr] () {
--- a/libirccd/irccd/server_service.hpp	Wed Nov 29 09:48:40 2017 +0100
+++ b/libirccd/irccd/server_service.hpp	Wed Nov 29 14:44:36 2017 +0100
@@ -42,8 +42,6 @@
     irccd& irccd_;
     std::vector<std::shared_ptr<server>> servers_;
 
-    void handle_channel_mode(const channel_mode_event&);
-    void handle_channel_notice(const channel_notice_event&);
     void handle_connect(const connect_event&);
     void handle_invite(const invite_event&);
     void handle_join(const join_event&);
--- a/tests/CMakeLists.txt	Wed Nov 29 09:48:40 2017 +0100
+++ b/tests/CMakeLists.txt	Wed Nov 29 14:44:36 2017 +0100
@@ -32,8 +32,6 @@
     add_subdirectory(cmd-rule-list)
     add_subdirectory(cmd-rule-move)
     add_subdirectory(cmd-rule-remove)
-    add_subdirectory(cmd-server-cmode)
-    add_subdirectory(cmd-server-cnotice)
     add_subdirectory(cmd-server-connect)
     add_subdirectory(cmd-server-disconnect)
     add_subdirectory(cmd-server-info)
--- a/tests/cmd-rule-add/main.cpp	Wed Nov 29 09:48:40 2017 +0100
+++ b/tests/cmd-rule-add/main.cpp	Wed Nov 29 14:44:36 2017 +0100
@@ -187,7 +187,7 @@
         { "command",    "rule-add"  },
         { "action",     "unknown"   }
     });
-    ctl_->recv([&] (auto code, auto msg) {
+    ctl_->recv([&] (auto code, auto) {
         result = code;
     });
 
--- a/tests/cmd-server-cmode/CMakeLists.txt	Wed Nov 29 09:48:40 2017 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-#
-# CMakeLists.txt -- CMake build system for irccd
-#
-# Copyright (c) 2013-2017 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.
-#
-
-irccd_define_test(
-    NAME cmd-server-cmode
-    SOURCES main.cpp
-    LIBRARIES libirccd libirccdctl
-)
-
--- a/tests/cmd-server-cmode/main.cpp	Wed Nov 29 09:48:40 2017 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,67 +0,0 @@
-/*
- * main.cpp -- test server-cmode remote command
- *
- * Copyright (c) 2013-2017 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.
- */
-
-#define BOOST_TEST_MODULE "server-cmode"
-#include <boost/test/unit_test.hpp>
-
-#include <irccd/server_service.hpp>
-
-#include <journal_server.hpp>
-#include <command_test.hpp>
-
-namespace irccd {
-
-namespace {
-
-class server_cmode_test : public command_test<server_channel_mode_command> {
-protected:
-    std::shared_ptr<journal_server> server_{new journal_server(service_, "test")};
-
-    server_cmode_test()
-    {
-        daemon_->servers().add(server_);
-    }
-};
-
-} // !namespace
-
-BOOST_FIXTURE_TEST_SUITE(server_cmode_test_suite, server_cmode_test)
-
-BOOST_AUTO_TEST_CASE(basic)
-{
-    ctl_->send({
-        { "command",    "server-cmode"      },
-        { "server",     "test"              },
-        { "channel",    "#staff"            },
-        { "mode",       "+c"                }
-    });
-
-    wait_for([this] () {
-        return !server_->cqueue().empty();
-    });
-
-    auto cmd = server_->cqueue().back();
-
-    BOOST_TEST(cmd["command"].get<std::string>() == "cmode");
-    BOOST_TEST(cmd["channel"].get<std::string>() == "#staff");
-    BOOST_TEST(cmd["mode"].get<std::string>() == "+c");
-}
-
-BOOST_AUTO_TEST_SUITE_END()
-
-} // !irccd
--- a/tests/cmd-server-cnotice/CMakeLists.txt	Wed Nov 29 09:48:40 2017 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-#
-# CMakeLists.txt -- CMake build system for irccd
-#
-# Copyright (c) 2013-2017 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.
-#
-
-irccd_define_test(
-    NAME cmd-server-cnotice
-    SOURCES main.cpp
-    LIBRARIES libirccd libirccdctl
-)
-
--- a/tests/cmd-server-cnotice/main.cpp	Wed Nov 29 09:48:40 2017 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,67 +0,0 @@
-/*
- * main.cpp -- test server-cnotice remote command
- *
- * Copyright (c) 2013-2017 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.
- */
-
-#define BOOST_TEST_MODULE "server-cnotice"
-#include <boost/test/unit_test.hpp>
-
-#include <irccd/server_service.hpp>
-
-#include <journal_server.hpp>
-#include <command_test.hpp>
-
-namespace irccd {
-
-namespace {
-
-class server_cnotice_test : public command_test<server_channel_notice_command> {
-protected:
-    std::shared_ptr<journal_server> server_{new journal_server(service_, "test")};
-
-    server_cnotice_test()
-    {
-        daemon_->servers().add(server_);
-    }
-};
-
-} // !namespace
-
-BOOST_FIXTURE_TEST_SUITE(server_cnotice_test_suite, server_cnotice_test)
-
-BOOST_AUTO_TEST_CASE(basic)
-{
-    ctl_->send({
-        { "command",    "server-cnotice"    },
-        { "server",     "test"              },
-        { "channel",    "#staff"            },
-        { "message",    "silence"           }
-    });
-
-    wait_for([this] () {
-        return !server_->cqueue().empty();
-    });
-
-    auto cmd = server_->cqueue().back();
-
-    BOOST_TEST(cmd["command"].get<std::string>() == "cnotice");
-    BOOST_TEST(cmd["channel"].get<std::string>() == "#staff");
-    BOOST_TEST(cmd["message"].get<std::string>() == "silence");
-}
-
-BOOST_AUTO_TEST_SUITE_END()
-
-} // !irccd
--- a/tests/plugin-logger/main.cpp	Wed Nov 29 09:48:40 2017 +0100
+++ b/tests/plugin-logger/main.cpp	Wed Nov 29 14:44:36 2017 +0100
@@ -46,8 +46,6 @@
         remove(CMAKE_CURRENT_BINARY_DIR "/log.txt");
 
         plugin_->set_formats({
-            { "cmode", "cmode=#{server}:#{channel}:#{origin}:#{nickname}:#{mode}:#{arg}" },
-            { "cnotice", "cnotice=#{server}:#{channel}:#{origin}:#{nickname}:#{message}" },
             { "join", "join=#{server}:#{channel}:#{origin}:#{nickname}" },
             { "kick", "kick=#{server}:#{channel}:#{origin}:#{nickname}:#{target}:#{reason}" },
             { "me", "me=#{server}:#{channel}:#{origin}:#{nickname}:#{message}" },
@@ -72,24 +70,6 @@
 
 BOOST_FIXTURE_TEST_SUITE(logger_test_suite, logger_test)
 
-BOOST_AUTO_TEST_CASE(format_channel_mode)
-{
-    load();
-
-    plugin_->on_channel_mode(irccd_, {server_, "jean!jean@localhost", "#staff", "+o", "jean"});
-
-    BOOST_REQUIRE_EQUAL("cmode=test:#staff:jean!jean@localhost:jean:+o:jean\n", last());
-}
-
-BOOST_AUTO_TEST_CASE(format_channel_notice)
-{
-    load();
-
-    plugin_->on_channel_notice(irccd_, {server_, "jean!jean@localhost", "#staff", "bonjour!"});
-
-    BOOST_REQUIRE_EQUAL("cnotice=test:#staff:jean!jean@localhost:jean:bonjour!\n", last());
-}
-
 BOOST_AUTO_TEST_CASE(format_join)
 {
     load();