]> jfr.im git - irc/rqf/shadowircd.git/commitdiff
Fix VERSION and RPL_MYINFO to only show modes that are enabled. Also fix up some...
authorB.Greenham <redacted>
Mon, 11 Oct 2010 20:35:18 +0000 (16:35 -0400)
committerB.Greenham <redacted>
Mon, 11 Oct 2010 20:35:18 +0000 (16:35 -0400)
doc/reference.conf
include/chmode.h
src/chmode.c
src/messages.tab
src/s_conf.c
src/s_user.c
src/supported.c

index 6b175031eedfec2a8bd174abc0277d7252c67d13..8a0826643cc61b0a88cfa8021072584b7b492ebc 100755 (executable)
@@ -747,6 +747,7 @@ channel {
         * remote servers/users (ex: services) from setting them. Make sure 
         * your services and remote servers are properly configured when 
         * using this option!
+        * Valid parameters are: CLPFQITDENGJKMrczgqefj
         */
        #disabledmodes = "ME";
 
index 82d8ecd5d4069196a791f1b4bf7aef36b056536a..a4fc8f374cb0e8deb18e9a875dea0b514124b9a2 100644 (file)
@@ -87,5 +87,6 @@ extern void cflag_orphan(char c);
 extern void construct_cflags_strings(void);
 extern char cflagsbuf[256];
 extern char cflagsmyinfo[256];
+extern char cflagsparaminfo[256];
 
 #endif
index a1353693019a3e5718633daf99a309292f9721b2..4c86b3da4ba13eb55998582576aedf22f417099f 100644 (file)
@@ -43,6 +43,7 @@
 #include "chmode.h"
 #include "irc_dictionary.h"
 
+
 /* bitmasks for error returns, so we send once per call */
 #define SM_ERR_NOTS             0x00000001     /* No TS on channel */
 #define SM_ERR_NOOPS            0x00000002     /* No chan ops */
@@ -69,6 +70,7 @@ static int no_override_deop;
 
 char cflagsbuf[256];
 char cflagsmyinfo[256];
+char cflagsparaminfo[256];
 
 int chmode_flags[256];
 
@@ -120,14 +122,17 @@ construct_cflags_strings(void)
 
                        break;
                    default:
-                       if(chmode_flags[i] != 0)
+                       if(chmode_flags[i] != 0 && !(chmode_table[i].set_func == chm_orphaned))
                        {
                            *ptr++ = (char) i;
                        }
                }
                
                /* Should we leave orphaned check here? -- dwr */
-               if(!(chmode_table[i].set_func == chm_nosuch) && !(chmode_table[i].set_func == chm_orphaned))
+               if( !(chmode_table[i].set_func == chm_nosuch) && 
+                       !(chmode_table[i].set_func == chm_orphaned) && 
+                       !(chmode_table[i].set_func == chm_admin && !ConfigChannel.use_admin) && 
+                       !(chmode_table[i].set_func == chm_halfop && !ConfigChannel.use_halfop))
                {
                    *ptr2++ = (char) i;
                }
@@ -137,6 +142,21 @@ construct_cflags_strings(void)
        *ptr2++ = '\0';
 }
 
+void
+construct_cflag_param_string(void)
+{
+
+       *cflagsparaminfo = '\0';
+       rb_snprintf(cflagsparaminfo, sizeof cflagsparaminfo, "%sb%s%s%s%sklov%s%s",
+                       ConfigChannel.use_admin ? "a" : "",
+                       ConfigChannel.use_except ? "e" : "",
+                       ConfigChannel.use_forward ? "f" : "",
+                       ConfigChannel.use_halfop ? "h" : "",
+                       strcasecmp(ConfigChannel.disabledmodes, "j") ? "" : "j",
+                       strcasecmp(ConfigChannel.disabledmodes, "q") ? "" : "q",
+                       ConfigChannel.use_invex ? "I" : "");
+}
+
 /*
  * find_umode_slot
  *
index d2af21943e8b186d24e597815b10c8734d629dc5..b23ffa8dab64720b171e9b4be28d95c5f7754bc6 100644 (file)
@@ -24,7 +24,7 @@ static  const char *  replies[] = {
 /* 001  RPL_WELCOME, */ ":Welcome to the %s Internet Relay Chat Network %s",
 /* 002  RPL_YOURHOST,*/ ":Your host is %s, running version %s",
 /* 003  RPL_CREATED, */ ":This server was created %s",
-/* 004  RPL_MYINFO, */ "%s %s %s %s bkloveqjfI",
+/* 004  RPL_MYINFO, */ "%s %s %s %s %s",
 /* 005  RPL_ISUPPORT, */ "%s :are supported by this server",
 /* 006 */       NULL,
 /* 007 */       NULL,
index 1f3e742e01bca1d9222eff93d5ea1a4e81405002..e09b41fd475fe46fe6f08ddebe7bfdda4a0cf302 100644 (file)
@@ -1005,19 +1005,19 @@ validate_conf(void)
                        if(*dm == 'I')
                        {
                                cflag_orphan('I');
-                               ConfigChannel.use_invex = "NO";
+                               ConfigChannel.use_invex = 0;
                                continue;
                        }
                        if(*dm == 'e')
                        {
                                cflag_orphan('e');
-                               ConfigChannel.use_except = "NO";
+                               ConfigChannel.use_except = 0;
                                continue;
                        }
                        if(*dm == 'f')
                        {
                                cflag_orphan('f');
-                               ConfigChannel.use_forward = "NO";
+                               ConfigChannel.use_forward = 0;
                                continue;
                        }
                        if(*dm == 'j')
@@ -1067,6 +1067,7 @@ validate_conf(void)
                        }
                }
        }
+       construct_cflag_param_string();
        startup = 0;
 }
 
index aa8b17e5629c39df7e3449d7b71f62857d059622..b81fe83c65241f5b300e7dce68371c9b38b43e66 100644 (file)
@@ -1293,7 +1293,7 @@ user_welcome(struct Client *source_p)
        sendto_one_numeric(source_p, RPL_YOURHOST, form_str(RPL_YOURHOST),
                   get_listener_name(source_p->localClient->listener), ircd_version);
        sendto_one_numeric(source_p, RPL_CREATED, form_str(RPL_CREATED), creation);
-       sendto_one_numeric(source_p, RPL_MYINFO, form_str(RPL_MYINFO), me.name, ircd_version, umodebuf, cflagsmyinfo);
+       sendto_one_numeric(source_p, RPL_MYINFO, form_str(RPL_MYINFO), me.name, ircd_version, umodebuf, cflagsmyinfo, cflagsparaminfo);
 
        show_isupport(source_p);
 
index 49f0da414bfbdc2ad8362e6dd14accc03c39a612..417d4abf631064f59a0a99c449b5a97cba4e4b3c 100644 (file)
@@ -235,10 +235,12 @@ isupport_chanmodes(const void *ptr)
 {
        static char result[80];
 
-       rb_snprintf(result, sizeof result, "%s%sbq,k,%slj,%s",
+       rb_snprintf(result, sizeof result, "%s%sb%s,k,%sl%s,%s",
                        ConfigChannel.use_except ? "e" : "",
                        ConfigChannel.use_invex ? "I" : "",
+                       strcasecmp(ConfigChannel.disabledmodes, "q") ? "" : "q",
                        ConfigChannel.use_forward ? "f" : "",
+                       strcasecmp(ConfigChannel.disabledmodes, "j") ? "" : "j",
                        cflagsbuf);
        return result;
 }