From 19214d33e4bc4ff5361aae9abe552dc418e7d3c9 Mon Sep 17 00:00:00 2001 From: pk910 Date: Mon, 18 Jul 2011 01:24:50 +0200 Subject: [PATCH] fixed MODE_NOFLOOD unset (really remove it from the memory) --- ircd/channel.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/ircd/channel.c b/ircd/channel.c index 9de97d3..8c6e38e 100644 --- a/ircd/channel.c +++ b/ircd/channel.c @@ -2589,10 +2589,13 @@ mode_parse_altchan(struct ParseState *state, ulong64 *flag_p) modebuf_mode_string(state->mbuf, state->dir | flag_p[0], t_str, 0); if (state->flags & MODE_PARSE_SET) { - if (state->dir == MODE_DEL) /* remove the old altchan */ + if (state->dir == MODE_DEL) { /* remove the old altchan */ *state->chptr->mode.altchan = '\0'; - else + state->chptr->mode.mode &= ~flag_p[0]; + } else { ircd_strncpy(state->chptr->mode.altchan, t_str, CHANNELLEN); + state->chptr->mode.mode |= flag_p[0]; + } } } @@ -2684,10 +2687,13 @@ mode_parse_noflood(struct ParseState *state, ulong64 *flag_p) modebuf_mode_string(state->mbuf, state->dir | flag_p[0], t_str, 0); if (state->flags & MODE_PARSE_SET) { - if (state->dir == MODE_DEL) /* remove the old noflood */ + if (state->dir == MODE_DEL) { /* remove the old noflood */ *state->chptr->mode.noflood = '\0'; - else + state->chptr->mode.mode &= ~flag_p[0]; + } else { ircd_strncpy(state->chptr->mode.noflood, t_str, CHANNELLEN); + state->chptr->mode.mode |= flag_p[0]; + } } if (state->dir == MODE_ADD) { @@ -2699,6 +2705,7 @@ mode_parse_noflood(struct ParseState *state, ulong64 *flag_p) state->chptr->mode.noflood_value = noflood_value; } else { //removed the mode so free all flood objects + state->chptr->mode.noflood_value = 0; struct Membership *member; for(member = state->chptr->members; member; member = member->next_member) { struct MemberFlood *floodnode; @@ -4364,7 +4371,7 @@ int ext_amsg_block(struct Client *cptr, struct Channel *chptr, const char *msg) * --pk910 2011/7/1 */ int ext_noflood_block(struct Client *cptr, struct Channel *chptr) { - if(chptr->mode.noflood == NULL || !chptr->mode.noflood) return 0; + if(!*chptr->mode.noflood) return 0; struct Membership *member = find_member_link(chptr, cptr); if(!member) return 0; //TODO: we've no check for -n channels implemented, yet //check if this user is really affected by +f -- 2.20.1