aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--degesch.c22
1 files changed, 22 insertions, 0 deletions
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
}