]> jfr.im git - irc/rqf/shadowircd.git/commitdiff
Generating cflags bufs dynamically: one for RPL_MYINFO and one for
authorValery V Yatsko <redacted>
Wed, 25 Jun 2008 03:51:32 +0000 (07:51 +0400)
committerValery V Yatsko <redacted>
Wed, 25 Jun 2008 03:51:32 +0000 (07:51 +0400)
supported.c

include/chmode.h
src/chmode.c
src/messages.tab
src/s_user.c
src/supported.c

index 5a4625045be0f52932b72d8d6687559328d94b5e..94f7ea7f3f6d0e5b1e2f65709a0fec4d067d9e1e 100644 (file)
@@ -68,5 +68,7 @@ extern void chm_voice(struct Client *source_p, struct Channel *chptr,
 extern void construct_noparam_modes(void);
 extern void find_orphaned_cflags(void);
 extern unsigned int find_cflag_slot(void);
+extern char cflagsbuf[256];
+extern char cflagsmyinfo[256];
 
 #endif
index b6ece72cb0f66b9918c83cc743db65da942496a2..60fc901988c19775e5b883f851f66f947852381d 100644 (file)
@@ -65,13 +65,21 @@ 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
 construct_noparam_modes(void)
 {
        int i;
+        char *ptr = cflagsbuf;
+       char *ptr2 = cflagsmyinfo;
         static int prev_chmode_flags[256];
+        
+        *ptr = '\0';
+       *ptr2 = '\0';
 
        for(i = 0; i < 256; i++)
        {
@@ -105,7 +113,40 @@ construct_noparam_modes(void)
                }
                else
                        prev_chmode_flags[i] = chmode_flags[i];
+                
+               switch (chmode_flags[i])
+               {
+                   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;
+                       }
+               }
+               
+               /* Should we leave orphaned check here? -- dwr */
+               if(!(chmode_table[i].set_func == chm_nosuch) && !(chmode_table[i].set_func == chm_orphaned))
+               {
+                   *ptr2++ = (char) i;
+               }
        }
+        
+        *ptr++ = '\0';
+       *ptr2++ = '\0';
 }
 
 /*
index 7f89373822491882f6bffa24d3a962cdb273e9ff..99947739581368a4e752c3fcda2fa6eea9bf0aa6 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 biklmnopstveqrcgzjfILPQF bkloveqjfI",
+/* 004  RPL_MYINFO, */ "%s %s %s %s bkloveqjfI",
 /* 005  RPL_ISUPPORT, */ "%s :are supported by this server",
 /* 006 */       NULL,
 /* 007 */       NULL,
index 63d88dc6b212112ca4fea92c2f45cfefce492f06..e4caebe1c08b793ff1b8fa244dbb14f15a8fa344 100644 (file)
@@ -53,6 +53,7 @@
 #include "snomask.h"
 #include "blacklist.h"
 #include "substitution.h"
+#include "chmode.h"
 
 static void report_and_set_user_flags(struct Client *, struct ConfItem *);
 void user_welcome(struct Client *source_p);
@@ -1187,7 +1188,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);
+       sendto_one_numeric(source_p, RPL_MYINFO, form_str(RPL_MYINFO), me.name, ircd_version, umodebuf, cflagsmyinfo);
 
        show_isupport(source_p);
 
index b062d55d2c4076922c68dd424243271ad74c40f3..e0f617e496ceb1a0dff71e8b0c71156a13d86741 100644 (file)
@@ -87,6 +87,7 @@
 #include "ircd.h"
 #include "s_conf.h"
 #include "supported.h"
+#include "chmode.h"
 
 rb_dlink_list isupportlist;
 
@@ -209,12 +210,11 @@ isupport_chanmodes(const void *ptr)
 {
        static char result[80];
 
-       rb_snprintf(result, sizeof result, "%s%sbq,k,%slj,imnpst%scgzLP%s",
+       rb_snprintf(result, sizeof result, "%s%sbq,k,%slj,%s",
                        ConfigChannel.use_except ? "e" : "",
                        ConfigChannel.use_invex ? "I" : "",
                        ConfigChannel.use_forward ? "f" : "",
-                       rb_dlink_list_length(&service_list) ? "r" : "",
-                       ConfigChannel.use_forward ? "QF" : "");
+                       cflagsbuf);
        return result;
 }