X-Git-Url: https://jfr.im/git/irc/rqf/shadowircd.git/blobdiff_plain/d8a4c5f618cf92a06cc0b4a6d70bfd0df67633ac..157c1f04bd3b04cbdcef5efb3cb280d0e10f1e7f:/modules/m_kline.c diff --git a/modules/m_kline.c b/modules/m_kline.c index f0ed4a3..18dbdca 100644 --- a/modules/m_kline.c +++ b/modules/m_kline.c @@ -75,9 +75,9 @@ static int valid_wild_card(struct Client *source_p, const char *user, const char static void handle_remote_kline(struct Client *source_p, int tkline_time, const char *user, const char *host, const char *reason); static void apply_kline(struct Client *source_p, struct ConfItem *aconf, - const char *reason, const char *oper_reason, const char *current_date); + const char *reason, const char *oper_reason); static void apply_tkline(struct Client *source_p, struct ConfItem *aconf, - const char *, const char *, const char *, int); + const char *, const char *, int); static int already_placed_kline(struct Client *, const char *, const char *, int); static void handle_remote_unkline(struct Client *source_p, const char *user, const char *host); @@ -98,10 +98,8 @@ mo_kline(struct Client *client_p, struct Client *source_p, int parc, const char char def[] = "No Reason"; char user[USERLEN + 2]; char host[HOSTLEN + 2]; - char buffer[IRCD_BUFSIZE]; char *reason = def; char *oper_reason; - const char *current_date; const char *target_server = NULL; struct ConfItem *aconf; int tkline_time = 0; @@ -169,12 +167,13 @@ mo_kline(struct Client *client_p, struct Client *source_p, int parc, const char return 0; rb_set_time(); - current_date = smalldate(); aconf = make_conf(); aconf->status = CONF_KILL; + aconf->created = rb_current_time(); aconf->host = rb_strdup(host); aconf->user = rb_strdup(user); aconf->port = 0; + aconf->passwd = rb_strdup(reason); /* Look for an oper reason */ if((oper_reason = strchr(reason, '|')) != NULL) @@ -187,19 +186,9 @@ mo_kline(struct Client *client_p, struct Client *source_p, int parc, const char } if(tkline_time > 0) - { - rb_snprintf(buffer, sizeof(buffer), - "Temporary K-line %d min. - %s (%s)", - (int) (tkline_time / 60), reason, current_date); - aconf->passwd = rb_strdup(buffer); - apply_tkline(source_p, aconf, reason, oper_reason, current_date, tkline_time); - } + apply_tkline(source_p, aconf, reason, oper_reason, tkline_time); else - { - rb_snprintf(buffer, sizeof(buffer), "%s (%s)", reason, current_date); - aconf->passwd = rb_strdup(buffer); - apply_kline(source_p, aconf, reason, oper_reason, current_date); - } + apply_kline(source_p, aconf, reason, oper_reason); if(ConfigFileEntry.kline_delay) { @@ -264,8 +253,6 @@ static void handle_remote_kline(struct Client *source_p, int tkline_time, const char *user, const char *host, const char *kreason) { - char buffer[BUFSIZE]; - const char *current_date; char *reason = LOCAL_COPY(kreason); struct ConfItem *aconf = NULL; char *oper_reason; @@ -285,8 +272,10 @@ handle_remote_kline(struct Client *source_p, int tkline_time, aconf = make_conf(); aconf->status = CONF_KILL; + aconf->created = rb_current_time(); aconf->user = rb_strdup(user); aconf->host = rb_strdup(host); + aconf->passwd = rb_strdup(reason); /* Look for an oper reason */ if((oper_reason = strchr(reason, '|')) != NULL) @@ -298,22 +287,10 @@ handle_remote_kline(struct Client *source_p, int tkline_time, aconf->spasswd = rb_strdup(oper_reason); } - current_date = smalldate(); - if(tkline_time > 0) - { - rb_snprintf(buffer, sizeof(buffer), - "Temporary K-line %d min. - %s (%s)", - (int) (tkline_time / 60), reason, current_date); - aconf->passwd = rb_strdup(buffer); - apply_tkline(source_p, aconf, reason, oper_reason, current_date, tkline_time); - } + apply_tkline(source_p, aconf, reason, oper_reason, tkline_time); else - { - rb_snprintf(buffer, sizeof(buffer), "%s (%s)", reason, current_date); - aconf->passwd = rb_strdup(buffer); - apply_kline(source_p, aconf, reason, oper_reason, current_date); - } + apply_kline(source_p, aconf, reason, oper_reason); if(ConfigFileEntry.kline_delay) { @@ -480,11 +457,33 @@ handle_remote_unkline(struct Client *source_p, const char *user, const char *hos */ static void apply_kline(struct Client *source_p, struct ConfItem *aconf, - const char *reason, const char *oper_reason, const char *current_date) + const char *reason, const char *oper_reason) { add_conf_by_address(aconf->host, CONF_KILL, aconf->user, NULL, aconf); bandb_add(BANDB_KLINE, source_p, aconf->user, aconf->host, reason, EmptyString(oper_reason) ? NULL : oper_reason, 0); + + /* no oper reason.. */ + if(EmptyString(oper_reason)) + { + sendto_realops_snomask(SNO_GENERAL, L_ALL, + "%s added K-Line for [%s@%s] [%s]", + get_oper_name(source_p), aconf->user, aconf->host, reason); + ilog(L_KLINE, "K %s 0 %s %s %s", + get_oper_name(source_p), aconf->user, aconf->host, reason); + } + else + { + sendto_realops_snomask(SNO_GENERAL, L_ALL, + "%s added K-Line for [%s@%s] [%s|%s]", + get_oper_name(source_p), aconf->user, aconf->host, + reason, oper_reason); + ilog(L_KLINE, "K %s 0 %s %s %s|%s", + get_oper_name(source_p), aconf->user, aconf->host, reason, oper_reason); + } + + sendto_one_notice(source_p, ":Added K-Line [%s@%s]", + aconf->user, aconf->host); } /* apply_tkline() @@ -495,7 +494,7 @@ apply_kline(struct Client *source_p, struct ConfItem *aconf, */ static void apply_tkline(struct Client *source_p, struct ConfItem *aconf, - const char *reason, const char *oper_reason, const char *current_date, int tkline_time) + const char *reason, const char *oper_reason, int tkline_time) { aconf->hold = rb_current_time() + tkline_time; add_temp_kline(aconf);