From e9491ca85b314925cee6dcc3733b010e61e95e9a Mon Sep 17 00:00:00 2001
From: Přemysl Janouch
Date: Sat, 9 Aug 2014 03:58:37 +0200
Subject: kike: implement a useless ADMIN command
---
src/kike.c | 11 +++++++++++
1 file changed, 11 insertions(+)
(limited to 'src')
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",
@@ -2128,6 +2130,14 @@ irc_handle_ison (const struct irc_message *msg, struct client *c)
str_free (&result);
}
+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)
{
@@ -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 },
--
cgit v1.2.3-70-g09d2