]> jfr.im git - solanum.git/blobdiff - modules/m_info.c
reference.conf: add drain_reason
[solanum.git] / modules / m_info.c
index 951fda13faa3a8b3567e7a3ff9a8f6c4acf078e3..d1b286f68612ac03631ffdc5ed29155dabdef162 100644 (file)
@@ -74,6 +74,7 @@ enum info_output_type {
        OUTPUT_INTBOOL,    /* BOOLEAN encoded as an int */
        OUTPUT_INTBOOL_YN, /* BOOLEAN_YN encoded as an int */
        OUTPUT_YESNOMASK,  /* Output option as "YES/NO/MASKED" */
+       OUTPUT_STATSL,     /* Output as "YES/NO/SELF" */
 };
 
 #define INFO_STRING(ptr)      OUTPUT_STRING,     .option.string_p = (ptr)
@@ -84,6 +85,7 @@ enum info_output_type {
 #define INFO_INTBOOL_YN(ptr)  OUTPUT_INTBOOL_YN, .option.int_ = (ptr)
 #define INFO_YESNOMASK(ptr)   OUTPUT_YESNOMASK,  .option.int_ = (ptr)
 #define INFO_DECIMAL(ptr)     OUTPUT_DECIMAL,    .option.int_ = (ptr)
+#define INFO_STATSL(ptr)      OUTPUT_STATSL,     .option.statsl = (ptr)
 
 struct InfoStruct
 {
@@ -94,8 +96,9 @@ struct InfoStruct
        {
                const int *int_;
                const bool *bool_;
-               char **string_p;
-               char *string;
+               char *const *string_p;
+               const char *string;
+               const enum stats_l_oper_only *statsl;
        } option;
 };
 
@@ -192,6 +195,11 @@ static struct InfoStruct info_table[] = {
                "String shown in whois for opered services.",
                INFO_STRING(&ConfigFileEntry.servicestring),
        },
+       {
+               "drain_reason",
+               "Message to quit users with if this server is draining.",
+               INFO_STRING(&ConfigFileEntry.drain_reason),
+       },
        {
                "disable_auth",
                "Controls whether auth checking is disabled or not",
@@ -288,6 +296,11 @@ static struct InfoStruct info_table[] = {
                "Display K-line reason to client on disconnect",
                INFO_INTBOOL_YN(&ConfigFileEntry.kline_with_reason),
        },
+       {
+               "hide_tkdline_duration",
+               "Hide \"Temporary K-line 123 min.\" from user K/D-lline reasons",
+               INFO_INTBOOL_YN(&ConfigFileEntry.hide_tkdline_duration),
+       },
        {
                "max_accept",
                "Maximum nicknames on accept list",
@@ -393,11 +406,6 @@ static struct InfoStruct info_table[] = {
                "STATS C output is only shown to operators",
                INFO_INTBOOL_YN(&ConfigFileEntry.stats_c_oper_only),
        },
-       {
-               "stats_h_oper_only",
-               "STATS H output is only shown to operators",
-               INFO_INTBOOL_YN(&ConfigFileEntry.stats_h_oper_only),
-       },
        {
                "stats_i_oper_only",
                "STATS I output is only shown to operators",
@@ -408,6 +416,11 @@ static struct InfoStruct info_table[] = {
                "STATS K output is only shown to operators",
                INFO_YESNOMASK(&ConfigFileEntry.stats_k_oper_only),
        },
+       {
+               "stats_l_oper_only",
+               "STATS l/L output is only shown to operators",
+               INFO_STATSL(&ConfigFileEntry.stats_l_oper_only),
+       },
        {
                "stats_o_oper_only",
                "STATS O output is only shown to operators",
@@ -568,6 +581,21 @@ static struct InfoStruct info_table[] = {
                "Send messages to @#channel if affected by +z",
                INFO_INTBOOL_YN(&ConfigChannel.opmod_send_statusmsg),
        },
+       {
+               "ip_bans_through_vhost",
+               "Channel IP bans see through dynamic spoofs",
+               INFO_INTBOOL_YN(&ConfigChannel.ip_bans_through_vhost),
+       },
+       {
+               "hide_opers",
+               "Hide all opers from unprivileged users",
+               INFO_INTBOOL_YN(&ConfigFileEntry.hide_opers),
+       },
+       {
+               "hide_opers_in_whois",
+               "Don't send RPL_WHOISOPERATOR to non-opers",
+               INFO_INTBOOL_YN(&ConfigFileEntry.hide_opers_in_whois),
+       },
        {
                "disable_hidden",
                "Prevent servers from hiding themselves from a flattened /links",
@@ -588,6 +616,11 @@ static struct InfoStruct info_table[] = {
                "Links rehash delay",
                INFO_DECIMAL(&ConfigServerHide.links_delay),
        },
+       {
+               "oper_secure_only",
+               "Require TLS to become an oper",
+               INFO_INTBOOL_YN(&ConfigFileEntry.oper_secure_only),
+       },
 
        { NULL, NULL, 0, { NULL } },
 };
@@ -731,110 +764,78 @@ send_conf_options(struct Client *source_p)
         */
        for (i = 0; info_table[i].name; i++)
        {
+               static char opt_buf[BUFSIZE];
+               const char *opt_value = opt_buf;
+
+
                switch (info_table[i].output_type)
                {
                case OUTPUT_STRING:
                {
-                       char *option = *info_table[i].option.string_p;
-
-                       sendto_one(source_p, ":%s %d %s :%-30s %-16s [%s]",
-                                       get_id(&me, source_p), RPL_INFO,
-                                       get_id(source_p, source_p),
-                                       info_table[i].name,
-                                       option ? option : "NONE",
-                                       info_table[i].desc ? info_table[i].desc : "<none>");
-
+                       const char *option = *info_table[i].option.string_p;
+                       opt_value = option != NULL ? option : "NONE";
                        break;
                }
                case OUTPUT_STRING_PTR:
                {
-                       char *option = info_table[i].option.string;
-
-                       sendto_one(source_p, ":%s %d %s :%-30s %-16s [%s]",
-                                       get_id(&me, source_p), RPL_INFO,
-                                       get_id(source_p, source_p),
-                                       info_table[i].name,
-                                       EmptyString(option) ? "NONE" : option,
-                                       info_table[i].desc ? info_table[i].desc : "<none>");
-
+                       const char *option = info_table[i].option.string;
+                       opt_value = option != NULL ? option : "NONE";
                        break;
                }
                case OUTPUT_DECIMAL:
                {
                        int option = *info_table[i].option.int_;
-
-                       sendto_one(source_p, ":%s %d %s :%-30s %-16d [%s]",
-                                       get_id(&me, source_p), RPL_INFO,
-                                       get_id(source_p, source_p),
-                                       info_table[i].name,
-                                       option,
-                                       info_table[i].desc ? info_table[i].desc : "<none>");
-
+                       snprintf(opt_buf, sizeof opt_buf, "%d", option);
                        break;
                }
                case OUTPUT_BOOLEAN:
                {
                        bool option = *info_table[i].option.bool_;
-
-                       sendto_one(source_p, ":%s %d %s :%-30s %-16s [%s]",
-                                       get_id(&me, source_p), RPL_INFO,
-                                       get_id(source_p, source_p),
-                                       info_table[i].name,
-                                       option ? "ON" : "OFF",
-                                       info_table[i].desc ? info_table[i].desc : "<none>");
-
+                       opt_value = option ? "ON" : "OFF";
                        break;
                }
                case OUTPUT_BOOLEAN_YN:
                {
                        bool option = *info_table[i].option.bool_;
-
-                       sendto_one(source_p, ":%s %d %s :%-30s %-16s [%s]",
-                                       get_id(&me, source_p), RPL_INFO,
-                                       get_id(source_p, source_p),
-                                       info_table[i].name,
-                                       option ? "YES" : "NO",
-                                       info_table[i].desc ? info_table[i].desc : "<none>");
-
+                       opt_value = option ? "YES" : "NO";
                        break;
                }
                case OUTPUT_YESNOMASK:
                {
                        int option = *info_table[i].option.int_;
-
-                       sendto_one(source_p, ":%s %d %s :%-30s %-16s [%s]",
-                                       me.name, RPL_INFO, source_p->name,
-                                       info_table[i].name,
-                                       option ? ((option == 1) ? "MASK" : "YES") : "NO",
-                                       info_table[i].desc ? info_table[i].desc : "<none>");
+                       opt_value = option == 0 ? "NO" :
+                                   option == 1 ? "MASK" :
+                                   "YES";
+                       break;
                }
                case OUTPUT_INTBOOL:
                {
                        bool option = *info_table[i].option.int_;
-
-                       sendto_one(source_p, ":%s %d %s :%-30s %-16s [%s]",
-                                       get_id(&me, source_p), RPL_INFO,
-                                       get_id(source_p, source_p),
-                                       info_table[i].name,
-                                       option ? "ON" : "OFF",
-                                       info_table[i].desc ? info_table[i].desc : "<none>");
-
+                       opt_value = option ? "ON" : "OFF";
                        break;
                }
                case OUTPUT_INTBOOL_YN:
                {
                        bool option = *info_table[i].option.int_;
-
-                       sendto_one(source_p, ":%s %d %s :%-30s %-16s [%s]",
-                                       get_id(&me, source_p), RPL_INFO,
-                                       get_id(source_p, source_p),
-                                       info_table[i].name,
-                                       option ? "YES" : "NO",
-                                       info_table[i].desc ? info_table[i].desc : "<none>");
-
+                       opt_value = option ? "YES" : "NO";
+                       break;
+               }
+               case OUTPUT_STATSL:
+               {
+                       enum stats_l_oper_only option = *info_table[i].option.statsl;
+                       opt_value = option == STATS_L_OPER_ONLY_NO ? "NO" :
+                                   option == STATS_L_OPER_ONLY_SELF ? "SELF" :
+                                   "YES";
                        break;
                }
                }
+
+               sendto_one(source_p, ":%s %d %s :%-30s %-16s [%s]",
+                               get_id(&me, source_p), RPL_INFO,
+                               get_id(source_p, source_p),
+                               info_table[i].name,
+                               opt_value,
+                               info_table[i].desc ? info_table[i].desc : "<none>");
        }