]> jfr.im git - irc/rqf/shadowircd.git/blobdiff - src/s_conf.c
Store the creation time of klines and dlines as a time_t instead of as text.
[irc/rqf/shadowircd.git] / src / s_conf.c
index 42635284a3d8f14f0c4d0eca7e6a1359a2e5a795..ae83d7aa8c7df7f869292d60e990d03df7b8f009 100644 (file)
@@ -306,6 +306,8 @@ verify_access(struct Client *client_p, const char *username)
 {
        struct ConfItem *aconf;
        char non_ident[USERLEN + 1];
+       char reasonbuf[BUFSIZE];
+       char *reason;
 
        if(IsGotId(client_p))
        {
@@ -376,9 +378,18 @@ verify_access(struct Client *client_p, const char *username)
        {
                if(ConfigFileEntry.kline_with_reason)
                {
+                       if(aconf->created)
+                       {
+                               snprintf(reasonbuf, sizeof reasonbuf, "%s (%s)",
+                                               aconf->passwd,
+                                               smalldate(aconf->created));
+                               reason = reasonbuf;
+                       }
+                       else
+                               reason = aconf->passwd;
                        sendto_one(client_p,
                                        form_str(ERR_YOUREBANNEDCREEP),
-                                       me.name, client_p->name, aconf->passwd);
+                                       me.name, client_p->name, reason);
                }
                add_reject(client_p, aconf->user, aconf->host);
                return (BANNED_CLIENT);
@@ -1130,11 +1141,19 @@ get_printable_kline(struct Client *source_p, struct ConfItem *aconf,
                    char **user, char **oper_reason)
 {
        static char null[] = "<NULL>";
+       static char reasonbuf[BUFSIZE];
 
        *host = EmptyString(aconf->host) ? null : aconf->host;
-       *reason = EmptyString(aconf->passwd) ? null : aconf->passwd;
        *user = EmptyString(aconf->user) ? null : aconf->user;
 
+       *reason = EmptyString(aconf->passwd) ? null : aconf->passwd;
+       if(aconf->created)
+       {
+               rb_snprintf(reasonbuf, sizeof reasonbuf, "%s (%s)",
+                               *reason, smalldate(aconf->created));
+               *reason = reasonbuf;
+       }
+
        if(EmptyString(aconf->spasswd) || !IsOper(source_p))
                *oper_reason = NULL;
        else