]> jfr.im git - solanum.git/blobdiff - modules/m_info.c
ircd: implement EXTENDCHANS, based on ircd-seven (with some improvements from chatircd)
[solanum.git] / modules / m_info.c
index e97fabed8c5b1d523e0edcc41d99d15e26bcd7da..202716a658ef9afc0353d8a0d1cb3143ea3399f6 100644 (file)
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
  *  USA
  *
- *  $Id: m_info.c 3131 2007-01-21 15:36:31Z jilles $
+ *  $Id: m_info.c 3396 2007-04-05 00:38:52Z jilles $
  */
 
 #include "stdinc.h"
-#include "tools.h"
 #include "m_info.h"
 #include "channel.h"
 #include "client.h"
 #include "common.h"
-#include "irc_string.h"
+#include "match.h"
 #include "ircd.h"
 #include "hook.h"
 #include "numeric.h"
@@ -63,7 +62,7 @@ mapi_hlist_av1 info_hlist[] = {
        { NULL, NULL }
 };
 
-DECLARE_MODULE_AV1(info, NULL, NULL, info_clist, info_hlist, NULL, "$Revision: 3131 $");
+DECLARE_MODULE_AV1(info, NULL, NULL, info_clist, info_hlist, NULL, "$Revision: 3396 $");
 
 /*
  * jdc -- Structure for our configuration value table
@@ -92,6 +91,12 @@ static struct InfoStruct info_table[] = {
                &opers_see_all_users,
                "Farconnect notices available or operspy accountability limited"
        },
+       {
+               "max_connections",
+               OUTPUT_DECIMAL,
+               &maxconnections,
+               "Max number connections"
+       },
        {
                "anti_nick_flood",
                OUTPUT_BOOLEAN,
@@ -114,20 +119,50 @@ static struct InfoStruct info_table[] = {
                "client_exit",
                OUTPUT_BOOLEAN,
                &ConfigFileEntry.client_exit,
-               "Prepend 'Client Exit:' to user QUIT messages"
+               "Prepend 'Quit:' to user QUIT messages"
        },
        {
-               "client_flood",
+               "client_flood_max_lines",
                OUTPUT_DECIMAL,
-               &ConfigFileEntry.client_flood,
+               &ConfigFileEntry.client_flood_max_lines,
                "Number of lines before a client Excess Flood's",
        },
+       {
+               "client_flood_burst_rate",
+               OUTPUT_DECIMAL,
+               &ConfigFileEntry.client_flood_burst_rate,
+               "Maximum lines per second during flood grace period",
+       },
+       {
+               "client_flood_burst_max",
+               OUTPUT_DECIMAL,
+               &ConfigFileEntry.client_flood_burst_max,
+               "Number of lines to process at once before delaying",
+       },
+       {
+               "client_flood_message_num",
+               OUTPUT_DECIMAL,
+               &ConfigFileEntry.client_flood_message_num,
+               "Number of messages to allow per client_flood_message_time outside of burst",
+       },
+       {
+               "client_flood_message_time",
+               OUTPUT_DECIMAL,
+               &ConfigFileEntry.client_flood_message_time,
+               "Time to allow per client_flood_message_num outside of burst",
+       },
        {
                "connect_timeout",
                OUTPUT_DECIMAL,
                &ConfigFileEntry.connect_timeout,
                "Connect timeout for connections to servers"
        },
+       {
+               "default_ident_timeout",
+               OUTPUT_DECIMAL,
+               &ConfigFileEntry.default_ident_timeout,
+               "Amount of time the server waits for ident responses from clients",
+       },
        {
                "default_floodcount",
                OUTPUT_DECIMAL,
@@ -164,12 +199,6 @@ static struct InfoStruct info_table[] = {
                &ConfigFileEntry.disable_fake_channels,
                "Controls whether bold etc are disabled for JOIN"
        },
-       {
-               "dot_in_ip6_addr",
-               OUTPUT_BOOLEAN,
-               &ConfigFileEntry.dot_in_ip6_addr,
-               "Suffix a . to ip6 addresses",
-       },
        {
                "dots_in_ident",
                OUTPUT_DECIMAL,
@@ -214,16 +243,16 @@ static struct InfoStruct info_table[] = {
                "Server connect/disconnect log file"
        },
        {
-               "fname_klinelog",
+               "fname_killlog",
                OUTPUT_STRING,
-               &ConfigFileEntry.fname_klinelog,
-               "KLINE etc log file"
+               &ConfigFileEntry.fname_killlog,
+               "KILL log file"
        },
        {
-               "fname_glinelog",
+               "fname_klinelog",
                OUTPUT_STRING,
-               &ConfigFileEntry.fname_glinelog,
-               "GLINE log file"
+               &ConfigFileEntry.fname_klinelog,
+               "KLINE etc log file"
        },
        {
                "fname_operspylog",
@@ -237,30 +266,6 @@ static struct InfoStruct info_table[] = {
                &ConfigFileEntry.fname_ioerrorlog,
                "IO error log file"
        },
-       {
-               "glines",
-               OUTPUT_BOOLEAN,
-               &ConfigFileEntry.glines,
-               "G-line (network-wide K-line) support"
-       },
-       {
-               "gline_time",
-               OUTPUT_DECIMAL,
-               &ConfigFileEntry.gline_time,
-               "Expiry time for G-lines"
-       },
-       {
-               "gline_min_cidr",
-               OUTPUT_DECIMAL,
-               &ConfigFileEntry.gline_min_cidr,
-               "Minimum CIDR bitlen for ipv4 glines"
-       },
-       {
-               "gline_min_cidr6",
-               OUTPUT_DECIMAL,
-               &ConfigFileEntry.gline_min_cidr6,
-               "Minimum CIDR bitlen for ipv6 glines"
-       },
        {
                "global_snotices",
                OUTPUT_BOOLEAN_YN,
@@ -285,12 +290,6 @@ static struct InfoStruct info_table[] = {
                &ServerInfo.hub,
                "Server is a hub"
        },
-       {
-               "idletime",
-               OUTPUT_DECIMAL,
-               &ConfigFileEntry.idletime,
-               "Number of minutes before a client is considered idle"
-       },
        {
                "kline_delay",
                OUTPUT_DECIMAL,
@@ -343,7 +342,7 @@ static struct InfoStruct info_table[] = {
                "min_nonwildcard",
                OUTPUT_DECIMAL,
                &ConfigFileEntry.min_nonwildcard,
-               "Minimum non-wildcard chars in K/G lines",
+               "Minimum non-wildcard chars in K lines",
        },
        {
                "min_nonwildcard_simple",
@@ -357,12 +356,6 @@ static struct InfoStruct info_table[] = {
                &ServerInfo.network_name,
                "Network name"
        },
-       {
-               "network_desc",
-               OUTPUT_STRING,
-               &ServerInfo.network_desc,
-               "Network description"
-       },
        {
                "nick_delay",
                OUTPUT_DECIMAL,
@@ -414,7 +407,7 @@ static struct InfoStruct info_table[] = {
        {
                "reject_after_count",
                OUTPUT_DECIMAL,
-               &ConfigFileEntry.reject_after_count,   
+               &ConfigFileEntry.reject_after_count,
                "Client rejection threshold setting",
        },
        {
@@ -483,6 +476,18 @@ static struct InfoStruct info_table[] = {
                &ConfigFileEntry.stats_y_oper_only,
                "STATS Y is only shown to operators",
        },
+       {
+               "throttle_count",
+               OUTPUT_DECIMAL,
+               &ConfigFileEntry.throttle_count,
+               "Connection throttle threshold",
+       },
+       {
+               "throttle_duration",
+               OUTPUT_DECIMAL,
+               &ConfigFileEntry.throttle_duration,
+               "Connection throttle duration",
+       },
        {
                "tkline_expire_notices",
                OUTPUT_BOOLEAN,
@@ -505,7 +510,25 @@ static struct InfoStruct info_table[] = {
                "warn_no_nline",
                OUTPUT_BOOLEAN,
                &ConfigFileEntry.warn_no_nline,
-               "Display warning if connecting server lacks N-line"
+               "Display warning if connecting server lacks connect block"
+       },
+       {
+               "use_propagated_bans",
+               OUTPUT_BOOLEAN,
+               &ConfigFileEntry.use_propagated_bans,
+               "KLINE sets fully propagated bans"
+       },
+       {
+               "max_ratelimit_tokens",
+               OUTPUT_DECIMAL,
+               &ConfigFileEntry.max_ratelimit_tokens,
+               "The maximum number of tokens that can be accumulated for executing rate-limited commands",
+       },
+       {
+               "away_interval",
+               OUTPUT_DECIMAL,
+               &ConfigFileEntry.away_interval,
+               "The minimum time between aways",
        },
        {
                "default_split_server_count",
@@ -531,18 +554,18 @@ static struct InfoStruct info_table[] = {
                &ConfigChannel.knock_delay_channel,
                "Delay between KNOCK attempts to a channel",
        },
-       {
-               "invite_ops_only",
-               OUTPUT_BOOLEAN_YN,
-               &ConfigChannel.invite_ops_only,
-               "INVITE is restricted to channelops only"
-       },
        {
                "kick_on_split_riding",
                OUTPUT_BOOLEAN_YN,
                &ConfigChannel.kick_on_split_riding,
                "Kick users riding splits to join +i or +k channels"
        },
+       {
+               "disable_local_channels",
+               OUTPUT_BOOLEAN_YN,
+               &ConfigChannel.disable_local_channels,
+               "Disable local channels (&channels)"
+       },
        {
                "max_bans",
                OUTPUT_DECIMAL,
@@ -561,6 +584,12 @@ static struct InfoStruct info_table[] = {
                &ConfigChannel.max_chans_per_user,
                "Maximum number of channels a user can join",
        },
+       {
+               "max_chans_per_user_large",
+               OUTPUT_DECIMAL,
+               &ConfigChannel.max_chans_per_user_large,
+               "Maximum extended number of channels a user can join",
+       },
        {
                "no_create_on_split",
                OUTPUT_BOOLEAN_YN,
@@ -573,6 +602,12 @@ static struct InfoStruct info_table[] = {
                &ConfigChannel.no_join_on_split,
                "Disallow joining channels when split",
        },
+       {
+               "only_ascii_channels",
+               OUTPUT_BOOLEAN_YN,
+               &ConfigChannel.only_ascii_channels,
+               "Controls whether non-ASCII is disabled for JOIN"
+       },
        {
                "use_except",
                OUTPUT_BOOLEAN_YN,
@@ -597,6 +632,12 @@ static struct InfoStruct info_table[] = {
                &ConfigChannel.use_knock,
                "Enable /KNOCK",
        },
+       {
+               "resv_forcepart",
+               OUTPUT_BOOLEAN_YN,
+               &ConfigChannel.resv_forcepart,
+               "Force-part local users on channel RESV"
+       },
        {
                "disable_hidden",
                OUTPUT_BOOLEAN_YN,
@@ -627,25 +668,24 @@ static struct InfoStruct info_table[] = {
 /* *INDENT-ON* */
 
 /*
-** m_info
-**  parv[0] = sender prefix
-**  parv[1] = servername
-*/
+ ** m_info
+ **  parv[1] = servername
+ */
 static int
 m_info(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
 {
        static time_t last_used = 0L;
 
-       if((last_used + ConfigFileEntry.pace_wait) > CurrentTime)
+       if((last_used + ConfigFileEntry.pace_wait) > rb_current_time())
        {
                /* safe enough to give this on a local connect only */
                sendto_one(source_p, form_str(RPL_LOAD2HI),
-                          me.name, source_p->name, "INFO");
+                               me.name, source_p->name, "INFO");
                sendto_one_numeric(source_p, RPL_ENDOFINFO, form_str(RPL_ENDOFINFO));
                return 0;
        }
        else
-               last_used = CurrentTime;
+               last_used = rb_current_time();
 
        if(hunt_server(client_p, source_p, ":%s INFO :%s", 1, parc, parv) != HUNTED_ISME)
                return 0;
@@ -660,21 +700,23 @@ m_info(struct Client *client_p, struct Client *source_p, int parc, const char *p
 }
 
 /*
-** mo_info
-**  parv[0] = sender prefix
-**  parv[1] = servername
-*/
+ ** mo_info
+ **  parv[1] = servername
+ */
 static int
 mo_info(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
 {
        if(hunt_server(client_p, source_p, ":%s INFO :%s", 1, parc, parv) == HUNTED_ISME)
        {
                info_spy(source_p);
-
                send_info_text(source_p);
 
                if(IsOper(source_p))
+               {
                        send_conf_options(source_p);
+                       sendto_one_numeric(source_p, RPL_INFO, ":%s",
+                                       rb_lib_version());
+               }
 
                send_birthdate_online_time(source_p);
 
@@ -714,13 +756,14 @@ send_info_text(struct Client *source_p)
 static void
 send_birthdate_online_time(struct Client *source_p)
 {
+       char tbuf[26]; /* this needs to be 26 - see ctime_r manpage */
        sendto_one(source_p, ":%s %d %s :Birth Date: %s, compile # %s",
-                  get_id(&me, source_p), RPL_INFO, 
-                  get_id(source_p, source_p), creation, generation);
+                       get_id(&me, source_p), RPL_INFO,
+                       get_id(source_p, source_p), creation, generation);
 
        sendto_one(source_p, ":%s %d %s :On-line since %s",
-                  get_id(&me, source_p), RPL_INFO, 
-                  get_id(source_p, source_p), myctime(startup_time));
+                       get_id(&me, source_p), RPL_INFO,
+                       get_id(source_p, source_p), rb_ctime(startup_time, tbuf, sizeof(tbuf)));
 }
 
 /*
@@ -744,19 +787,19 @@ send_conf_options(struct Client *source_p)
        {
                if(infoptr->intvalue)
                {
-                       sendto_one(source_p, ":%s %d %s :%-30s %-5d [%-30s]",
-                                  get_id(&me, source_p), RPL_INFO,
-                                  get_id(source_p, source_p),
-                                  infoptr->name, infoptr->intvalue, 
-                                  infoptr->desc);
+                       sendto_one(source_p, ":%s %d %s :%-30s %-16d [%s]",
+                                       get_id(&me, source_p), RPL_INFO,
+                                       get_id(source_p, source_p),
+                                       infoptr->name, infoptr->intvalue,
+                                       infoptr->desc);
                }
                else
                {
-                       sendto_one(source_p, ":%s %d %s :%-30s %-5s [%-30s]",
-                                  get_id(&me, source_p), RPL_INFO,
-                                  get_id(source_p, source_p),
-                                  infoptr->name, infoptr->strvalue, 
-                                  infoptr->desc);
+                       sendto_one(source_p, ":%s %d %s :%-30s %-16s [%s]",
+                                       get_id(&me, source_p), RPL_INFO,
+                                       get_id(source_p, source_p),
+                                       infoptr->name, infoptr->strvalue,
+                                       infoptr->desc);
                }
        }
 
@@ -767,98 +810,98 @@ send_conf_options(struct Client *source_p)
        {
                switch (info_table[i].output_type)
                {
-                       /*
-                        * For "char *" references
-                        */
-               case OUTPUT_STRING:
-                       {
-                               char *option = *((char **) info_table[i].option);
-
-                               sendto_one(source_p, ":%s %d %s :%-30s %-5s [%-30s]",
-                                          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>");
-
-                               break;
-                       }
-                       /*
-                        * For "char foo[]" references
-                        */
-               case OUTPUT_STRING_PTR:
-                       {
-                               char *option = (char *) info_table[i].option;
-
-                               sendto_one(source_p, ":%s %d %s :%-30s %-5s [%-30s]",
-                                          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>");
-
-                               break;
-                       }
-                       /*
-                        * Output info_table[i].option as a decimal value.
-                        */
-               case OUTPUT_DECIMAL:
-                       {
-                               int option = *((int *) info_table[i].option);
-
-                               sendto_one(source_p, ":%s %d %s :%-30s %-5d [%-30s]",
-                                          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>");
-
-                               break;
-                       }
-
-                       /*
-                        * Output info_table[i].option as "ON" or "OFF"
-                        */
-               case OUTPUT_BOOLEAN:
-                       {
-                               int option = *((int *) info_table[i].option);
-
-                               sendto_one(source_p, ":%s %d %s :%-30s %-5s [%-30s]",
-                                          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>");
-
-                               break;
-                       }
-                       /*
-                        * Output info_table[i].option as "YES" or "NO"
-                        */
-               case OUTPUT_BOOLEAN_YN:
-                       {
-                               int option = *((int *) info_table[i].option);
-
-                               sendto_one(source_p, ":%s %d %s :%-30s %-5s [%-30s]",
-                                          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>");
-
-                               break;
-                       }
-
-               case OUTPUT_BOOLEAN2:
-               {
-                       int option = *((int *) info_table[i].option);
-
-                       sendto_one(source_p, ":%s %d %s :%-30s %-5s [%-30s]",
-                                  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>");
-               }               /* switch (info_table[i].output_type) */
+                               /*
+                                * For "char *" references
+                                */
+                       case OUTPUT_STRING:
+                               {
+                                       char *option = *((char **) info_table[i].option);
+
+                                       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>");
+
+                                       break;
+                               }
+                               /*
+                                * For "char foo[]" references
+                                */
+                       case OUTPUT_STRING_PTR:
+                               {
+                                       char *option = (char *) info_table[i].option;
+
+                                       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>");
+
+                                       break;
+                               }
+                               /*
+                                * Output info_table[i].option as a decimal value.
+                                */
+                       case OUTPUT_DECIMAL:
+                               {
+                                       int option = *((int *) info_table[i].option);
+
+                                       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>");
+
+                                       break;
+                               }
+
+                               /*
+                                * Output info_table[i].option as "ON" or "OFF"
+                                */
+                       case OUTPUT_BOOLEAN:
+                               {
+                                       int option = *((int *) info_table[i].option);
+
+                                       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>");
+
+                                       break;
+                               }
+                               /*
+                                * Output info_table[i].option as "YES" or "NO"
+                                */
+                       case OUTPUT_BOOLEAN_YN:
+                               {
+                                       int option = *((int *) info_table[i].option);
+
+                                       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>");
+
+                                       break;
+                               }
+
+                       case OUTPUT_BOOLEAN2:
+                               {
+                                       int option = *((int *) info_table[i].option);
+
+                                       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>");
+                               }               /* switch (info_table[i].output_type) */
                }
        }                       /* forloop */
 
@@ -871,7 +914,7 @@ send_conf_options(struct Client *source_p)
 }
 
 /* info_spy()
- * 
+ *
  * input        - pointer to client
  * output       - none
  * side effects - hook doing_info is called