From 5ad6581c5720710d3dc16092d9bee2ca2c3473b0 Mon Sep 17 00:00:00 2001 From: Přemysl Janouch Date: Mon, 20 Apr 2015 23:03:52 +0200 Subject: degesch: halfplement PART handling Tired. This thing is enormous. --- degesch.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/degesch.c b/degesch.c index 329ab5d..b65e213 100644 --- a/degesch.c +++ b/degesch.c @@ -1961,6 +1961,28 @@ irc_handle_notice (struct app_context *ctx, const struct irc_message *msg) static void irc_handle_part (struct app_context *ctx, const struct irc_message *msg) { + if (!msg->prefix || msg->params.len < 1) + return; + + char *nickname = irc_cut_nickname (msg->prefix); + struct user *user = str_map_find (&ctx->irc_users, nickname); + free (nickname); + if (!user) + return; + + const char *target = msg->params.vector[0]; + if (!irc_is_channel (ctx, target)) + return; + + const char *message = NULL; + if (msg->params.len > 1) + message = msg->params.vector[1]; + + struct channel *channel = str_map_find (&ctx->irc_channels, target); + struct buffer *buffer = str_map_find (&ctx->irc_buffer_map, target); + hard_assert ((channel && buffer) || + (channel && !buffer) || (!channel && !buffer)); + // TODO: remove user from the channel // TODO: log a message } -- cgit v1.2.3-70-g09d2