summaryrefslogtreecommitdiff
path: root/kike.c
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2015-06-13 21:52:12 +0200
committerPřemysl Janouch <p.janouch@gmail.com>2015-06-13 22:28:38 +0200
commitabc0e4f821568e135623d035312d7a92f5f507cc (patch)
tree8d0b4d9846500cf72cd174c300ddef1b7609233a /kike.c
parentff10e1b652c1cf1eed68dc40b5ca33dcfe16e762 (diff)
downloadxK-abc0e4f821568e135623d035312d7a92f5f507cc.tar.gz
xK-abc0e4f821568e135623d035312d7a92f5f507cc.tar.xz
xK-abc0e4f821568e135623d035312d7a92f5f507cc.zip
kike: implement LINKS
Diffstat (limited to 'kike.c')
-rw-r--r--kike.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/kike.c b/kike.c
index 08b015b..602f654 100644
--- a/kike.c
+++ b/kike.c
@@ -2918,6 +2918,23 @@ irc_handle_stats (const struct irc_message *msg, struct client *c)
}
static void
+irc_handle_links (const struct irc_message *msg, struct client *c)
+{
+ if (msg->params.len > 1 && !irc_is_this_me (c->ctx, msg->params.vector[0]))
+ RETURN_WITH_REPLY (c, IRC_ERR_NOSUCHSERVER, msg->params.vector[0]);
+
+ const char *mask = "*";
+ if (msg->params.len > 0)
+ mask = msg->params.vector[msg->params.len > 1];
+
+ if (!irc_fnmatch (mask, c->ctx->server_name))
+ irc_send_reply (c, IRC_RPL_LINKS, mask,
+ c->ctx->server_name, 0 /* hop count */,
+ str_map_find (&c->ctx->config, "server_info"));
+ irc_send_reply (c, IRC_RPL_ENDOFLINKS, mask);
+}
+
+static void
irc_handle_kill (const struct irc_message *msg, struct client *c)
{
if (msg->params.len < 2)
@@ -2973,6 +2990,7 @@ irc_register_handlers (struct server_context *ctx)
{ "AWAY", true, irc_handle_away, 0, 0 },
{ "ADMIN", true, irc_handle_admin, 0, 0 },
{ "STATS", true, irc_handle_stats, 0, 0 },
+ { "LINKS", true, irc_handle_links, 0, 0 },
{ "MODE", true, irc_handle_mode, 0, 0 },
{ "PRIVMSG", true, irc_handle_privmsg, 0, 0 },