diff options
author | Přemysl Janouch <p.janouch@gmail.com> | 2015-04-20 23:03:52 +0200 |
---|---|---|
committer | Přemysl Janouch <p.janouch@gmail.com> | 2015-04-20 23:03:52 +0200 |
commit | 5ad6581c5720710d3dc16092d9bee2ca2c3473b0 (patch) | |
tree | a5bfd7ddc90435018f1cf100aaa98fcc42610e16 | |
parent | 590fc6cf26f585841f89052e9c9ad6fb0702ba9c (diff) | |
download | xK-5ad6581c5720710d3dc16092d9bee2ca2c3473b0.tar.gz xK-5ad6581c5720710d3dc16092d9bee2ca2c3473b0.tar.xz xK-5ad6581c5720710d3dc16092d9bee2ca2c3473b0.zip |
degesch: halfplement PART handling
Tired. This thing is enormous.
-rw-r--r-- | degesch.c | 22 |
1 files changed, 22 insertions, 0 deletions
@@ -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 } |