fixed MODE_NOFLOOD unset (really remove it from the memory)
authorpk910 <philipp@zoelle1.de>
Sun, 17 Jul 2011 23:24:50 +0000 (01:24 +0200)
committerpk910 <philipp@zoelle1.de>
Sun, 17 Jul 2011 23:24:50 +0000 (01:24 +0200)
ircd/channel.c

index 9de97d3755d5f65c516c8e6bfc2eeab9e2a74d64..8c6e38e8694bae4ca8f284cc347b9dee7fd0d7ba 100644 (file)
@@ -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) {
     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';
       *state->chptr->mode.altchan = '\0';
-    else
+      state->chptr->mode.mode &= ~flag_p[0];
+    } else {
       ircd_strncpy(state->chptr->mode.altchan, t_str, CHANNELLEN);
       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) {
     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';
       *state->chptr->mode.noflood = '\0';
-    else
+      state->chptr->mode.mode &= ~flag_p[0];
+    } else {
       ircd_strncpy(state->chptr->mode.noflood, t_str, CHANNELLEN);
       ircd_strncpy(state->chptr->mode.noflood, t_str, CHANNELLEN);
+      state->chptr->mode.mode |= flag_p[0];
+    }
   }
   
   if (state->dir == MODE_ADD) {
   }
   
   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 = 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;
     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) {
  * --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
   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