]> jfr.im git - irc/rqf/shadowircd.git/blobdiff - src/chmode.c
Check off one TODO item.
[irc/rqf/shadowircd.git] / src / chmode.c
index e8494cd25c584f4eb491883a888ce0407c590e82..792016a3fdc4fd3cf952b93c6fb6e72abaa249b8 100644 (file)
@@ -42,7 +42,7 @@
 #include "s_newconf.h"
 #include "logger.h"
 #include "chmode.h"
-#include "irc_dictionary.h";
+#include "irc_dictionary.h"
 
 /* bitmasks for error returns, so we send once per call */
 #define SM_ERR_NOTS             0x00000001     /* No TS on channel */
@@ -543,15 +543,17 @@ chm_simple(struct Client *source_p, struct Channel *chptr,
        }
        else if((dir == MODE_DEL) && (chptr->mode.mode & mode_type))
        {
-               /* cleanup KICKNOREJOIN metadata on -J */
+               /* cleanup metadata when the related mode is removed */
                if(c == 'J')
                {
                        DICTIONARY_FOREACH(md, &iter, chptr->metadata)
                        {
-                               if(!strcmp(md->name, "KICKNOREJOIN"))  
+                               if(!strcmp(md->value, "KICKNOREJOIN"))  
                                        channel_metadata_delete(chptr, md->name, 0);
                        }
                }
+               if(c == 'K')
+                       channel_metadata_delete(chptr, "NOREPEAT", 0);
 
                chptr->mode.mode &= ~mode_type;
 
@@ -2108,6 +2110,7 @@ set_channel_mode(struct Client *client_p, struct Client *source_p,
                        for(i = 0; i < mode_count; i++)
                        {
                                if(mode_changes[i].letter == 0 || mode_changes[i].mems != flags)
+                                       continue;
 
                                if(mode_changes[i].override != override)
                                        continue;
@@ -2126,15 +2129,15 @@ set_channel_mode(struct Client *client_p, struct Client *source_p,
                                 * bufsize (4 == +/-,modechar,two spaces) send now.
                                 */
                                if(mode_changes[i].arg != NULL &&
-                                               ((paracount == MAXMODEPARAMSSERV) ||
-                                                ((cur_len + paralen + arglen + 4) > (BUFSIZE - 3))))
+                                  ((paracount == MAXMODEPARAMSSERV) ||
+                                   ((cur_len + paralen + arglen + 4) > (BUFSIZE - 3))))
                                {
                                        *mbuf = '\0';
 
                                        if(cur_len > mlen)
                                        {
                                                sendto_channel_local(flags, chptr, "%s%s %s",
-                                                               cmdbuf, modebuf, parabuf);
+                                                                    cmdbuf, modebuf, parabuf);
                                                if(override)
                                                        sendto_realops_snomask(SNO_GENERAL, L_NETWIDE,
                                                                        "%s is overriding modes on %s: %s %s",
@@ -2193,6 +2196,7 @@ set_channel_mode(struct Client *client_p, struct Client *source_p,
                                msptr->flags &= ~CHFL_CHANOP;
                }
        }
+
        /* only propagate modes originating locally, or if we're hubbing */
        if(MyClient(source_p) || rb_dlink_list_length(&serv_list) > 1)
                send_cap_mode_changes(client_p, source_p, chptr, mode_changes, mode_count);