aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2015-04-20 23:03:52 +0200
committerPřemysl Janouch <p.janouch@gmail.com>2015-04-20 23:03:52 +0200
commit5ad6581c5720710d3dc16092d9bee2ca2c3473b0 (patch)
treea5bfd7ddc90435018f1cf100aaa98fcc42610e16
parent590fc6cf26f585841f89052e9c9ad6fb0702ba9c (diff)
downloadxK-5ad6581c5720710d3dc16092d9bee2ca2c3473b0.tar.gz
xK-5ad6581c5720710d3dc16092d9bee2ca2c3473b0.tar.xz
xK-5ad6581c5720710d3dc16092d9bee2ca2c3473b0.zip
degesch: halfplement PART handling
Tired. This thing is enormous.
-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
}