]> jfr.im git - irc/rqf/shadowircd.git/blobdiff - src/s_conf.c
Generate the "Temporary K-line %d min" part from aconf->hold - aconf->created.
[irc/rqf/shadowircd.git] / src / s_conf.c
index 92deef5acf317f56425f122f8c7c11edc5167122..c3df6fd04d06b982d2acec9a8666cbc305fa97ea 100644 (file)
@@ -30,6 +30,7 @@
 #include "s_newconf.h"
 #include "newconf.h"
 #include "s_serv.h"
+#include "s_user.h"
 #include "s_stats.h"
 #include "channel.h"
 #include "class.h"
@@ -374,11 +375,10 @@ verify_access(struct Client *client_p, const char *username)
        else if(aconf->status & CONF_KILL)
        {
                if(ConfigFileEntry.kline_with_reason)
-               {
                        sendto_one(client_p,
                                        form_str(ERR_YOUREBANNEDCREEP),
-                                       me.name, client_p->name, aconf->passwd);
-               }
+                                       me.name, client_p->name,
+                                       get_user_ban_reason(aconf));
                add_reject(client_p, aconf->user, aconf->host);
                return (BANNED_CLIENT);
        }
@@ -680,6 +680,8 @@ set_default_conf(void)
 
        ConfigFileEntry.default_operstring = rb_strdup("is an IRC operator");
        ConfigFileEntry.default_adminstring = rb_strdup("is a Server Administrator");
+       ConfigFileEntry.default_operhost = rb_strdup("");
+       ConfigFileEntry.static_quit = rb_strdup("");
        ConfigFileEntry.servicestring = rb_strdup("is a Network Service");
 
        ConfigFileEntry.default_umodes = UMODE_INVISIBLE;       
@@ -693,6 +695,7 @@ set_default_conf(void)
        ConfigFileEntry.nick_delay = 900;       /* 15 minutes */
        ConfigFileEntry.target_change = YES;
        ConfigFileEntry.anti_spam_exit_message_time = 0;
+       ConfigFileEntry.use_part_messages = YES;
        ConfigFileEntry.ts_warn_delta = TS_WARN_DELTA_DEFAULT;
        ConfigFileEntry.ts_max_delta = TS_MAX_DELTA_DEFAULT;
        ConfigFileEntry.client_exit = YES;
@@ -716,6 +719,7 @@ set_default_conf(void)
        ConfigFileEntry.pace_wait_simple = 1;
        ConfigFileEntry.short_motd = NO;
        ConfigFileEntry.no_oper_flood = NO;
+       ConfigFileEntry.true_no_oper_flood = NO;
        ConfigFileEntry.fname_userlog = NULL;
        ConfigFileEntry.fname_fuserlog = NULL;
        ConfigFileEntry.fname_operlog = NULL;
@@ -747,10 +751,14 @@ set_default_conf(void)
        ConfigFileEntry.oper_snomask = SNO_GENERAL;
 
        ConfigChannel.autochanmodes = rb_strdup("nt");
+       ConfigChannel.exemptchanops = rb_strdup("");
+       ConfigChannel.use_halfop = YES;
+       ConfigChannel.use_admin = YES;
        ConfigChannel.use_except = YES;
        ConfigChannel.use_invex = YES;
        ConfigChannel.use_knock = YES;
        ConfigChannel.use_forward = YES;
+       ConfigChannel.use_local_channels = YES;
        ConfigChannel.knock_delay = 300;
        ConfigChannel.knock_delay_channel = 60;
        ConfigChannel.max_chans_per_user = 15;
@@ -769,6 +777,14 @@ set_default_conf(void)
        ConfigChannel.resv_forcepart = YES;
        ConfigChannel.kick_no_rejoin_time = 30;
 
+       ConfigChannel.exempt_cmode_c = NO;
+       ConfigChannel.exempt_cmode_C = NO;
+       ConfigChannel.exempt_cmode_D = NO;
+       ConfigChannel.exempt_cmode_T = NO;
+       ConfigChannel.exempt_cmode_N = NO;
+       ConfigChannel.exempt_cmode_G = NO;
+       ConfigChannel.exempt_cmode_K = NO;
+
        ConfigServerHide.flatten_links = 0;
        ConfigServerHide.links_delay = 300;
        ConfigServerHide.hidden = 0;
@@ -785,6 +801,7 @@ set_default_conf(void)
        ConfigFileEntry.reject_duration = 120;
        ConfigFileEntry.throttle_count = 4;
        ConfigFileEntry.throttle_duration = 60;
+       ConfigFileEntry.expire_override_time = 300;
 
        ServerInfo.default_max_clients = MAXCONNECTIONS;
 
@@ -863,6 +880,52 @@ validate_conf(void)
                splitmode = 0;
                splitchecking = 0;
        }
+
+       if(!valid_hostname(ConfigFileEntry.default_operhost))
+       {
+               conf_report_error("Warning -- invalid default_operhost specified, ignoring.");
+               ConfigFileEntry.default_operhost = rb_strdup("");
+       }
+
+       /* Parse the exemptchanops option and set the internal variables
+        * that we will use. */
+       char * ech;
+
+       for(ech = ConfigChannel.exemptchanops; *ech; ech++)
+       {
+               if(*ech == 'c')
+               {
+                       ConfigChannel.exempt_cmode_c = 1;
+                       continue;
+               }
+               if(*ech == 'C')
+               {
+                       ConfigChannel.exempt_cmode_C = 1;
+                       continue;
+               }
+               if(*ech == 'D')
+               {
+                       ConfigChannel.exempt_cmode_D = 1;
+                       continue;
+               }
+               if(*ech == 'T')
+               {
+                       ConfigChannel.exempt_cmode_T = 1;
+                       continue;
+               }
+               if(*ech == 'N')
+               {
+                       ConfigChannel.exempt_cmode_N = 1;
+                       continue;
+               }
+               if(*ech == 'G')
+               {
+                       ConfigChannel.exempt_cmode_G = 1;
+                       continue;
+               }
+               if(*ech == 'K')
+                       ConfigChannel.exempt_cmode_K = 1;
+       }
 }
 
 /* add_temp_kline()
@@ -1060,6 +1123,33 @@ get_printable_conf(struct ConfItem *aconf, char **name, char **host,
        *port = (int) aconf->port;
 }
 
+char *
+get_user_ban_reason(struct ConfItem *aconf)
+{
+       static char reasonbuf[BUFSIZE];
+
+       if (aconf->flags & CONF_FLAGS_TEMPORARY &&
+                       (aconf->status == CONF_KILL || aconf->status == CONF_DLINE))
+               rb_snprintf(reasonbuf, sizeof reasonbuf,
+                               "Temporary %c-line %d min. - ",
+                               aconf->status == CONF_DLINE ? 'D' : 'K',
+                               (aconf->hold - aconf->created) / 60);
+       else
+               reasonbuf[0] = '\0';
+       if (aconf->passwd)
+               rb_strlcat(reasonbuf, aconf->passwd, sizeof reasonbuf);
+       else
+               rb_strlcat(reasonbuf, "No Reason", sizeof reasonbuf);
+       if (aconf->created)
+       {
+               rb_strlcat(reasonbuf, " (", sizeof reasonbuf);
+               rb_strlcat(reasonbuf, smalldate(aconf->created),
+                               sizeof reasonbuf);
+               rb_strlcat(reasonbuf, ")", sizeof reasonbuf);
+       }
+       return reasonbuf;
+}
+
 void
 get_printable_kline(struct Client *source_p, struct ConfItem *aconf, 
                    char **host, char **reason,
@@ -1068,8 +1158,8 @@ get_printable_kline(struct Client *source_p, struct ConfItem *aconf,
        static char null[] = "<NULL>";
 
        *host = EmptyString(aconf->host) ? null : aconf->host;
-       *reason = EmptyString(aconf->passwd) ? null : aconf->passwd;
        *user = EmptyString(aconf->user) ? null : aconf->user;
+       *reason = get_user_ban_reason(aconf);
 
        if(EmptyString(aconf->spasswd) || !IsOper(source_p))
                *oper_reason = NULL;