From ee1f4174fdc3465238b3e6618c015ceb8cc1e230 Mon Sep 17 00:00:00 2001
From: Přemysl Janouch
Date: Wed, 10 Jun 2015 22:37:29 +0200
Subject: degesch: process INVITE
---
degesch.c | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/degesch.c b/degesch.c
index 88ba593..16aa500 100644
--- a/degesch.c
+++ b/degesch.c
@@ -4040,6 +4040,35 @@ irc_handle_mode_user (struct server *s, char **params)
// --- Input handling ----------------------------------------------------------
+static void
+irc_handle_invite (struct server *s, const struct irc_message *msg)
+{
+ if (!msg->prefix || msg->params.len < 2)
+ return;
+
+ const char *target = msg->params.vector[0];
+ const char *channel_name = msg->params.vector[1];
+
+ struct buffer *buffer;
+ if (!(buffer = str_map_find (&s->irc_buffer_map, channel_name)))
+ buffer = s->buffer;
+
+ // FIXME: logging
+ char *who = irc_cut_nickname (msg->prefix);
+ char *who_utf8 = irc_to_utf8 (s->ctx, who);
+ free (who);
+
+ // IRCv3.2 invite-notify extension allows the target to be someone else
+ if (irc_is_this_us (s, target))
+ buffer_send_status (s->ctx, buffer,
+ "%s has invited you to %s", who_utf8, channel_name);
+ else
+ buffer_send_status (s->ctx, buffer,
+ "%s has invited %s to %s", who_utf8, target, channel_name);
+
+ free (who_utf8);
+}
+
static void
irc_handle_join (struct server *s, const struct irc_message *msg)
{
@@ -4601,6 +4630,7 @@ static struct irc_handler
g_irc_handlers[] =
{
// This list needs to stay sorted
+ { "INVITE", irc_handle_invite },
{ "JOIN", irc_handle_join },
{ "KICK", irc_handle_kick },
{ "MODE", irc_handle_mode },
--
cgit v1.2.3-70-g09d2