X-Git-Url: https://jfr.im/git/irc/rqf/shadowircd.git/blobdiff_plain/6b3b07a84e0547297114f7726836ed15bbf03717..6d3e983251db74a580b84724fdfefc35e286faad:/src/chmode.c diff --git a/src/chmode.c b/src/chmode.c index 4f557ee..7095ade 100644 --- a/src/chmode.c +++ b/src/chmode.c @@ -65,15 +65,40 @@ static int mode_limit; static int mode_limit_simple; static int mask_pos; +char cflagsbuf[256]; +char cflagsmyinfo[256]; + int chmode_flags[256]; + +/* OPTIMIZE ME! -- dwr */ void -find_orphaned_cflags(void) +construct_noparam_modes(void) { int i; - static int prev_chmode_flags[256]; + char *ptr = cflagsbuf; + char *ptr2 = cflagsmyinfo; + static int prev_chmode_flags[256]; + + *ptr = '\0'; + *ptr2 = '\0'; - for (i = 0; i < 256; i++) + for(i = 0; i < 256; i++) { + if( !(chmode_table[i].set_func == chm_ban) && + !(chmode_table[i].set_func == chm_forward) && + !(chmode_table[i].set_func == chm_throttle) && + !(chmode_table[i].set_func == chm_key) && + !(chmode_table[i].set_func == chm_limit) && + !(chmode_table[i].set_func == chm_op) && + !(chmode_table[i].set_func == chm_voice)) + { + chmode_flags[i] = chmode_table[i].mode_type; + } + else + { + chmode_flags[i] = 0; + } + if (prev_chmode_flags[i] != 0 && prev_chmode_flags[i] != chmode_flags[i]) { if (chmode_flags[i] == 0) @@ -89,33 +114,40 @@ find_orphaned_cflags(void) } else prev_chmode_flags[i] = chmode_flags[i]; - } -} - -void -construct_noparam_modes(void) -{ - int i; - - for(i = 0; i < 256; i++) - { - if( !(chmode_table[i].set_func == chm_ban) && - !(chmode_table[i].set_func == chm_forward) && - !(chmode_table[i].set_func == chm_throttle) && - !(chmode_table[i].set_func == chm_key) && - !(chmode_table[i].set_func == chm_limit) && - !(chmode_table[i].set_func == chm_op) && - !(chmode_table[i].set_func == chm_voice)) + + switch (chmode_flags[i]) { - chmode_flags[i] = chmode_table[i].mode_type; + case MODE_EXLIMIT: + case MODE_DISFORWARD: + if(ConfigChannel.use_forward) + { + *ptr++ = (char) i; + } + + break; + case MODE_REGONLY: + if(rb_dlink_list_length(&service_list)) + { + *ptr++ = (char) i; + } + + break; + default: + if(chmode_flags[i] != 0) + { + *ptr++ = (char) i; + } } - else + + /* Should we leave orphaned check here? -- dwr */ + if(!(chmode_table[i].set_func == chm_nosuch) && !(chmode_table[i].set_func == chm_orphaned)) { - chmode_flags[i] = 0; + *ptr2++ = (char) i; } } - find_orphaned_cflags(); + *ptr++ = '\0'; + *ptr2++ = '\0'; } /* @@ -349,7 +381,7 @@ pretty_mask(const char *idmask) if(*t != '\0') user = t; } - else if(strchr(mask, '.') != NULL || strchr(mask, ':') != NULL) + else if(strchr(mask, '.') != NULL || strchr(mask, ':') != NULL || strchr(mask, '/') != NULL) { if(*mask != '\0') host = mask; @@ -469,7 +501,6 @@ chm_simple(struct Client *source_p, struct Channel *chptr, return; } - /* flags (possibly upto 32) + 4 with param */ if(MyClient(source_p) && (++mode_limit_simple > MAXMODES_SIMPLE)) return; @@ -1368,8 +1399,8 @@ struct ChannelMode chmode_table[256] = {chm_nosuch, 0 }, /* @ */ {chm_nosuch, 0 }, /* A */ {chm_nosuch, 0 }, /* B */ - {chm_nosuch, 0 }, /* C */ - {chm_nosuch, 0 }, /* D */ + {chm_simple, MODE_NOCTCP }, /* C */ + {chm_simple, MODE_NOACTION }, /* D */ {chm_nosuch, 0 }, /* E */ {chm_simple, MODE_FREETARGET }, /* F */ {chm_nosuch, 0 }, /* G */ @@ -1385,7 +1416,7 @@ struct ChannelMode chmode_table[256] = {chm_simple, MODE_DISFORWARD }, /* Q */ {chm_nosuch, 0 }, /* R */ {chm_nosuch, 0 }, /* S */ - {chm_nosuch, 0 }, /* T */ + {chm_simple, MODE_NONOTICE }, /* T */ {chm_nosuch, 0 }, /* U */ {chm_nosuch, 0 }, /* V */ {chm_nosuch, 0 }, /* W */