summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--degesch.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/degesch.c b/degesch.c
index 88ba593..16aa500 100644
--- a/degesch.c
+++ b/degesch.c
@@ -4041,6 +4041,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)
{
if (!msg->prefix || msg->params.len < 1)
@@ -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 },