]> jfr.im git - solanum.git/blobdiff - src/chmode.c
Force nicklen (all flavours) to be at least 9.
[solanum.git] / src / chmode.c
index 38ff8d883629c1a8636ebddc3a0286a3174ba97d..7dd8c14afa61a1b8269ed0c800bba26e0f98aa14 100644 (file)
@@ -104,12 +104,10 @@ construct_cflags_strings(void)
                 
                switch (chmode_flags[i])
                {
-                   case MODE_REGONLY:
-                       if(rb_dlink_list_length(&service_list))
-                       {
-                           *ptr++ = (char) i;
-                       }
-
+                   case MODE_FREETARGET:
+                   case MODE_DISFORWARD:
+                       if(ConfigChannel.use_forward)
+                               *ptr++ = (char) i;
                        break;
                    default:
                        if(chmode_flags[i] != 0)
@@ -286,7 +284,6 @@ del_id(struct Channel *chptr, const char *banid, rb_dlink_list * list, long mode
                if(irccmp(banid, banptr->banstr) == 0)
                {
                        rb_dlinkDelete(&banptr->node, list);
-                       free_ban(banptr);
 
                        /* invalidate the can_send() cache */
                        if(mode_type == CHFL_BAN || mode_type == CHFL_QUIET || mode_type == CHFL_EXCEPTION)
@@ -549,6 +546,11 @@ chm_simple(struct Client *source_p, struct Channel *chptr,
        /* setting + */
        if((dir == MODE_ADD) && !(chptr->mode.mode & mode_type))
        {
+               /* if +f is disabled, ignore an attempt to set +QF locally */
+               if(!ConfigChannel.use_forward && MyClient(source_p) &&
+                               (c == 'Q' || c == 'F'))
+                       return;
+
                chptr->mode.mode |= mode_type;
 
                mode_changes[mode_count].letter = c;
@@ -798,6 +800,13 @@ chm_ban(struct Client *source_p, struct Channel *chptr,
        else
                mask = pretty_mask(raw_mask);
 
+       /* we'd have problems parsing this, hyb6 does it too
+        * also make sure it will always fit on a line with channel
+        * name etc.
+        */
+       if(strlen(mask) > IRCD_MIN(BANLEN, MODEBUFLEN - 5))
+               return;
+
        /* Look for a $ after the first character.
         * As the first character, it marks an extban; afterwards
         * it delimits a forward channel.
@@ -809,13 +818,6 @@ chm_ban(struct Client *source_p, struct Channel *chptr,
                        forward = NULL;
        }
 
-       /* we'd have problems parsing this, hyb6 does it too
-        * also make sure it will always fit on a line with channel
-        * name etc.
-        */
-       if(strlen(mask) > IRCD_MIN(BANLEN, MODEBUFLEN - 5))
-               return;
-
        /* if we're adding a NEW id */
        if(dir == MODE_ADD)
        {
@@ -826,6 +828,10 @@ chm_ban(struct Client *source_p, struct Channel *chptr,
                                return;
                }
 
+               if(forward != NULL && !ConfigChannel.use_forward &&
+                               MyClient(source_p))
+                       forward = NULL;
+
                /* dont allow local clients to overflow the banlist, dont
                 * let remote servers set duplicate bans
                 */
@@ -1173,6 +1179,11 @@ chm_forward(struct Client *source_p, struct Channel *chptr,
        struct membership *msptr;
        const char *forward;
 
+       /* if +f is disabled, ignore local attempts to set it */
+       if(!ConfigChannel.use_forward && MyClient(source_p) &&
+          (dir == MODE_ADD) && (parc > *parn))
+               return;
+
        if(dir == MODE_QUERY || (dir == MODE_ADD && parc <= *parn))
        {
                if (!(*errors & SM_ERR_RPL_F))
@@ -1251,7 +1262,8 @@ chm_forward(struct Client *source_p, struct Channel *chptr,
                mode_changes[mode_count].dir = MODE_ADD;
                mode_changes[mode_count].caps = 0;
                mode_changes[mode_count].nocaps = 0;
-               mode_changes[mode_count].mems = ALL_MEMBERS;
+               mode_changes[mode_count].mems =
+                       ConfigChannel.use_forward ? ALL_MEMBERS : ONLY_SERVERS;
                mode_changes[mode_count].id = NULL;
                mode_changes[mode_count++].arg = forward;
        }