]> jfr.im git - solanum.git/blobdiff - modules/m_dline.c
Implement chanroles, as discussed with nenolod.
[solanum.git] / modules / m_dline.c
index 64e5f34516214084e26ab229115f7778f95cd06b..f3a40cea3e6935a8a0eacb5ad2719c53bf936912 100644 (file)
@@ -43,6 +43,7 @@
 #include "parse.h"
 #include "modules.h"
 #include "bandbi.h"
+#include "operhash.h"
 
 static int mo_dline(struct Client *, struct Client *, int, const char **);
 static int me_dline(struct Client *, struct Client *, int, const char **);
@@ -95,9 +96,15 @@ mo_dline(struct Client *client_p, struct Client *source_p, int parc, const char
 
        dlhost = parv[loc];
        rb_strlcpy(cidr_form_host, dlhost, sizeof(cidr_form_host));
-
        loc++;
 
+       /* would break the protocol */
+       if (*dlhost == ':')
+       {
+               sendto_one_notice(source_p, ":Invalid D-Line");
+               return 0;
+       }
+
        if(parc >= loc + 2 && !irccmp(parv[loc], "ON"))
        {
                if(!IsOperRemoteBan(source_p))
@@ -213,7 +220,6 @@ apply_dline(struct Client *source_p, const char *dlhost, int tdline_time, char *
 {
        struct ConfItem *aconf;
        char *oper_reason;
-       char dlbuffer[IRCD_BUFSIZE];
        struct rb_sockaddr_storage daddr;
        int t = AF_INET, ty, b;
        const char *creason;
@@ -289,6 +295,8 @@ apply_dline(struct Client *source_p, const char *dlhost, int tdline_time, char *
        aconf->status = CONF_DLINE;
        aconf->created = rb_current_time();
        aconf->host = rb_strdup(dlhost);
+       aconf->passwd = rb_strdup(reason);
+       aconf->info.oper = operhash_add(get_oper_name(source_p));
 
        /* Look for an oper reason */
        if((oper_reason = strchr(reason, '|')) != NULL)
@@ -302,10 +310,6 @@ apply_dline(struct Client *source_p, const char *dlhost, int tdline_time, char *
 
        if(tdline_time > 0)
        {
-               rb_snprintf(dlbuffer, sizeof(dlbuffer),
-                           "Temporary D-line %d min. - %s",
-                           (int) (tdline_time / 60), reason);
-               aconf->passwd = rb_strdup(dlbuffer);
                aconf->hold = rb_current_time() + tdline_time;
                add_temp_dline(aconf);
 
@@ -334,7 +338,6 @@ apply_dline(struct Client *source_p, const char *dlhost, int tdline_time, char *
        }
        else
        {
-               aconf->passwd = rb_strdup(reason);
                add_conf_by_address(aconf->host, CONF_DLINE, NULL, NULL, aconf);
 
                bandb_add(BANDB_DLINE, source_p, aconf->host, NULL,