degesch: process INVITE

This commit is contained in:
Přemysl Eric Janouch 2015-06-10 22:37:29 +02:00
parent c673882670
commit ee1f4174fd
1 changed files with 30 additions and 0 deletions

View File

@ -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 },