]> jfr.im git - solanum.git/blobdiff - ircd/supported.c
Merge pull request #341 from ophion-project/upstream/modularize-regonlymsg
[solanum.git] / ircd / supported.c
index c28ed9d03ba5bfa6e93d68a4c1275c7b0a215c17..09de6ce094e074a6c0ea9351d0a5ed11b6be71f3 100644 (file)
@@ -80,6 +80,7 @@
 #include "chmode.h"
 #include "send.h"
 
+static char allowed_chantypes[BUFSIZE];
 rb_dlink_list isupportlist;
 
 struct isupportitem
@@ -235,7 +236,7 @@ isupport_umode(const void *ptr)
 static const char *
 isupport_chanmodes(const void *ptr)
 {
-       static char result[80];
+       static char result[300];
 
        snprintf(result, sizeof result, "%s%sbq,k,%slj,%s",
                        ConfigChannel.use_except ? "e" : "",
@@ -245,19 +246,12 @@ isupport_chanmodes(const void *ptr)
        return result;
 }
 
-static const char *
-isupport_chantypes(const void *ptr)
-{
-       return ConfigChannel.disable_local_channels ? "#" : "&#";
-}
-
 static const char *
 isupport_chanlimit(const void *ptr)
 {
-       static char result[30];
+       static char result[BUFSIZE + 30];
 
-       snprintf(result, sizeof result, "%s:%i",
-               ConfigChannel.disable_local_channels ? "#" : "&#", ConfigChannel.max_chans_per_user);
+       snprintf(result, sizeof result, "%s:%i", allowed_chantypes, ConfigChannel.max_chans_per_user);
        return result;
 }
 
@@ -314,7 +308,7 @@ init_isupport(void)
        static int topiclen = TOPICLEN;
        static int maxnicklen = NICKLEN - 1;
 
-       add_isupport("CHANTYPES", isupport_chantypes, NULL);
+       add_isupport("CHANTYPES", isupport_string, allowed_chantypes);
        add_isupport("EXCEPTS", isupport_boolean, &ConfigChannel.use_except);
        add_isupport("INVEX", isupport_boolean, &ConfigChannel.use_invex);
        add_isupport("CHANMODES", isupport_chanmodes, NULL);
@@ -335,3 +329,18 @@ init_isupport(void)
        add_isupport("EXTBAN", isupport_extban, NULL);
        add_isupport("CLIENTVER", isupport_string, "3.0");
 }
+
+void
+chantypes_update(void)
+{
+       unsigned char *p;
+       memset(allowed_chantypes, '\0', sizeof allowed_chantypes);
+
+       p = (unsigned char *) allowed_chantypes;
+
+       for (unsigned int i = 0; i < 256; i++)
+       {
+               if (IsChanPrefix(i))
+                       *p++ = (unsigned char) i;
+       }
+}