kike: implement a useless ADMIN command

This commit is contained in:
Přemysl Eric Janouch 2014-08-09 03:58:37 +02:00
parent 4b3af280fa
commit e9491ca85b

View File

@ -923,6 +923,7 @@ enum
IRC_ERR_NOTEXTTOSEND = 412, IRC_ERR_NOTEXTTOSEND = 412,
IRC_ERR_UNKNOWNCOMMAND = 421, IRC_ERR_UNKNOWNCOMMAND = 421,
IRC_ERR_NOMOTD = 422, IRC_ERR_NOMOTD = 422,
IRC_ERR_NOADMININFO = 423,
IRC_ERR_NONICKNAMEGIVEN = 431, IRC_ERR_NONICKNAMEGIVEN = 431,
IRC_ERR_ERRONEOUSNICKNAME = 432, IRC_ERR_ERRONEOUSNICKNAME = 432,
IRC_ERR_NICKNAMEINUSE = 433, IRC_ERR_NICKNAMEINUSE = 433,
@ -1000,6 +1001,7 @@ static const char *g_default_replies[] =
[IRC_ERR_NOTEXTTOSEND] = ":No text to send", [IRC_ERR_NOTEXTTOSEND] = ":No text to send",
[IRC_ERR_UNKNOWNCOMMAND] = "%s: Unknown command", [IRC_ERR_UNKNOWNCOMMAND] = "%s: Unknown command",
[IRC_ERR_NOMOTD] = ":MOTD File is missing", [IRC_ERR_NOMOTD] = ":MOTD File is missing",
[IRC_ERR_NOADMININFO] = "%s :No administrative info available",
[IRC_ERR_NONICKNAMEGIVEN] = ":No nickname given", [IRC_ERR_NONICKNAMEGIVEN] = ":No nickname given",
[IRC_ERR_ERRONEOUSNICKNAME] = "%s :Erroneous nickname", [IRC_ERR_ERRONEOUSNICKNAME] = "%s :Erroneous nickname",
[IRC_ERR_NICKNAMEINUSE] = "%s :Nickname is already in use", [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); 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 static void
irc_handle_kill (const struct irc_message *msg, struct client *c) 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 }, { "USERS", true, irc_handle_users },
{ "SUMMON", true, irc_handle_summon }, { "SUMMON", true, irc_handle_summon },
{ "AWAY", true, irc_handle_away }, { "AWAY", true, irc_handle_away },
{ "ADMIN", true, irc_handle_admin },
{ "MODE", true, irc_handle_mode }, { "MODE", true, irc_handle_mode },
{ "PRIVMSG", true, irc_handle_privmsg }, { "PRIVMSG", true, irc_handle_privmsg },