From: Michael Poole Date: Tue, 9 Mar 2010 02:52:46 +0000 (-0500) Subject: Remove empty +z channels when the +z is removed. X-Git-Url: http://git.pk910.de/?p=srvx.git;a=commitdiff_plain;h=9d88567cc1d3ab44e0eeba3f34eb63001ecb059d Remove empty +z channels when the +z is removed. src/proto-p10.c (dead_channels): New variable. (parse_line): Release any dead channels after each command. (mod_chanmode_parse): Queue -z'ed channels to be released. --- diff --git a/src/proto-p10.c b/src/proto-p10.c index e17442d..638913a 100644 --- a/src/proto-p10.c +++ b/src/proto-p10.c @@ -291,6 +291,7 @@ static unsigned int num_notice_funcs; static struct dict *unbursted_channels; static const char *his_servername; static const char *his_servercomment; +static struct channelList dead_channels; /* These correspond to 1 << X: 012345678901234567 */ const char irc_user_mode_chars[] = "o iw dkgn I"; @@ -1832,6 +1833,7 @@ init_parse(void) memset(notice_funcs, 0, sizeof(privmsg_func_t)*num_notice_funcs); userList_init(&dead_users); + channelList_init(&dead_channels); reg_del_channel_func(remove_unbursted_channel); reg_exit_func(parse_cleanup); } @@ -1868,6 +1870,9 @@ parse_line(char *line, int recursive) for (i=0; imodes_set &= ~(MODE_SECRET); change->modes_clear |= MODE_SECRET; } + if (change->modes_clear & MODE_REGISTERED) { + /* Horribly cheat by using the lock/unlock semantics. */ + LockChannel(channel); + channelList_append(&dead_channels, channel); + } return change; error: mod_chanmode_free(change);