Skip to content

Commit

Permalink
Fix chanmode +f issue where unsetting parts were not effective.
Browse files Browse the repository at this point in the history
For example: '+f [5j#i1,5m#m1,3n]:3' and then '+f [5j#i1,5m]:3'
In that case the '3n' was not removed and still effective, as
could be seen by a '/MODE #chan'. Reported by The_Myth (#4883).
  • Loading branch information
syzop committed Mar 6, 2017
1 parent 9252ce3 commit cb59538
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/modules/chanmodes/floodprot.c
Expand Up @@ -396,6 +396,14 @@ void *cmodef_put_param(void *fld_in, char *param)
fld = MyMallocEx(sizeof(ChanFloodProt));
}

/* always reset settings (l, a, r) */
for (v=0; v < NUMFLD; v++)
{
fld->l[v] = 0;
fld->a[v] = 0;
fld->r[v] = 0;
}

/* '['<number><1 letter>[optional: '#'+1 letter],[next..]']'':'<number> */

p2 = strchr(xbuf+1, ']');
Expand Down Expand Up @@ -518,6 +526,15 @@ void *cmodef_put_param(void *fld_in, char *param)
MyFree(fld);
return NULL;
}
/* if new 'per xxx seconds' is smaller than current 'per' then reset timers/counters (t, c) */
if (v < fld->per)
{
for (v=0; v < NUMFLD; v++)
{
fld->t[v] = 0;
fld->c[v] = 0;
}
}
fld->per = v;

/* Is anything turned on? (to stop things like '+f []:15' */
Expand Down

0 comments on commit cb59538

Please sign in to comment.