aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2014-08-09 03:58:37 +0200
committerPřemysl Janouch <p.janouch@gmail.com>2014-08-09 03:58:37 +0200
commite9491ca85b314925cee6dcc3733b010e61e95e9a (patch)
tree59f8254e8dd1fd919dcf29fe1fd0a585fd45ba50
parent4b3af280fa8b09415fd148a959e328662e276890 (diff)
downloadxK-e9491ca85b314925cee6dcc3733b010e61e95e9a.tar.gz
xK-e9491ca85b314925cee6dcc3733b010e61e95e9a.tar.xz
xK-e9491ca85b314925cee6dcc3733b010e61e95e9a.zip
kike: implement a useless ADMIN command
-rw-r--r--src/kike.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/kike.c b/src/kike.c
index 2b429d3..c191e02 100644
--- a/src/kike.c
+++ b/src/kike.c
@@ -923,6 +923,7 @@ enum
IRC_ERR_NOTEXTTOSEND = 412,
IRC_ERR_UNKNOWNCOMMAND = 421,
IRC_ERR_NOMOTD = 422,
+ IRC_ERR_NOADMININFO = 423,
IRC_ERR_NONICKNAMEGIVEN = 431,
IRC_ERR_ERRONEOUSNICKNAME = 432,
IRC_ERR_NICKNAMEINUSE = 433,
@@ -1000,6 +1001,7 @@ static const char *g_default_replies[] =
[IRC_ERR_NOTEXTTOSEND] = ":No text to send",
[IRC_ERR_UNKNOWNCOMMAND] = "%s: Unknown command",
[IRC_ERR_NOMOTD] = ":MOTD File is missing",
+ [IRC_ERR_NOADMININFO] = "%s :No administrative info available",
[IRC_ERR_NONICKNAMEGIVEN] = ":No nickname given",
[IRC_ERR_ERRONEOUSNICKNAME] = "%s :Erroneous nickname",
[IRC_ERR_NICKNAMEINUSE] = "%s :Nickname is already in use",
@@ -2129,6 +2131,14 @@ irc_handle_ison (const struct irc_message *msg, struct client *c)
}
static void
+irc_handle_admin (const struct irc_message *msg, struct client *c)
+{
+ if (msg->params.len > 0 && !irc_is_this_me (c->ctx, msg->params.vector[0]))
+ RETURN_WITH_REPLY (c, IRC_ERR_NOSUCHSERVER, msg->params.vector[0]);
+ irc_send_reply (c, IRC_ERR_NOADMININFO, c->ctx->server_name);
+}
+
+static void
irc_handle_kill (const struct irc_message *msg, struct client *c)
{
if (msg->params.len < 2)
@@ -2188,6 +2198,7 @@ irc_register_handlers (struct server_context *ctx)
{ "USERS", true, irc_handle_users },
{ "SUMMON", true, irc_handle_summon },
{ "AWAY", true, irc_handle_away },
+ { "ADMIN", true, irc_handle_admin },
{ "MODE", true, irc_handle_mode },
{ "PRIVMSG", true, irc_handle_privmsg },