degesch: halfplement PART handling
Tired. This thing is enormous.
This commit is contained in:
parent
590fc6cf26
commit
5ad6581c57
22
degesch.c
22
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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user