X-Git-Url: https://jfr.im/git/irc/rqf/shadowircd.git/blobdiff_plain/d8a4c5f618cf92a06cc0b4a6d70bfd0df67633ac..8a889b0a5ffbac79bea29658c7c0f4a89f9b7be8:/modules/m_dline.c diff --git a/modules/m_dline.c b/modules/m_dline.c index 0ad8ce8..bb928ac 100644 --- a/modules/m_dline.c +++ b/modules/m_dline.c @@ -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 **); @@ -213,8 +214,6 @@ apply_dline(struct Client *source_p, const char *dlhost, int tdline_time, char * { struct ConfItem *aconf; char *oper_reason; - char dlbuffer[IRCD_BUFSIZE]; - const char *current_date; struct rb_sockaddr_storage daddr; int t = AF_INET, ty, b; const char *creason; @@ -285,11 +284,13 @@ apply_dline(struct Client *source_p, const char *dlhost, int tdline_time, char * } rb_set_time(); - current_date = smalldate(); aconf = make_conf(); 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) @@ -303,10 +304,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 (%s)", - (int) (tdline_time / 60), reason, current_date); - aconf->passwd = rb_strdup(dlbuffer); aconf->hold = rb_current_time() + tdline_time; add_temp_dline(aconf); @@ -335,12 +332,28 @@ apply_dline(struct Client *source_p, const char *dlhost, int tdline_time, char * } else { - rb_snprintf(dlbuffer, sizeof(dlbuffer), "%s (%s)", reason, current_date); - aconf->passwd = rb_strdup(dlbuffer); add_conf_by_address(aconf->host, CONF_DLINE, NULL, NULL, aconf); bandb_add(BANDB_DLINE, source_p, aconf->host, NULL, reason, EmptyString(aconf->spasswd) ? NULL : aconf->spasswd, 0); + + if(EmptyString(oper_reason)) + { + sendto_realops_snomask(SNO_GENERAL, L_ALL, + "%s added D-Line for [%s] [%s]", + get_oper_name(source_p), aconf->host, reason); + ilog(L_KLINE, "D %s 0 %s %s", + get_oper_name(source_p), aconf->host, reason); + } + else + { + sendto_realops_snomask(SNO_GENERAL, L_ALL, + "%s added D-Line for [%s] [%s|%s]", + get_oper_name(source_p), aconf->host, reason, oper_reason); + ilog(L_KLINE, "D %s 0 %s %s|%s", + get_oper_name(source_p), + aconf->host, reason, oper_reason); + } } return 0;