summaryrefslogtreecommitdiff
path: root/modules/m_kline.c
diff options
context:
space:
mode:
Diffstat (limited to 'modules/m_kline.c')
-rw-r--r--modules/m_kline.c33
1 files changed, 26 insertions, 7 deletions
diff --git a/modules/m_kline.c b/modules/m_kline.c
index 9b4392f..10b23c0 100644
--- a/modules/m_kline.c
+++ b/modules/m_kline.c
@@ -236,7 +236,7 @@ mo_kline(struct Client *client_p, struct Client *source_p,
time_t tkline_time = 0;
time_t cur_time;
- if (!HasOFlag(source_p, OPER_FLAG_K))
+ if (!HasOFlag(source_p, OPER_FLAG_K | OPER_FLAG_TKLINE))
{
sendto_one(source_p, form_str(ERR_NOPRIVS), me.name,
source_p->name, "kline");
@@ -247,6 +247,23 @@ mo_kline(struct Client *client_p, struct Client *source_p,
&tkline_time, &target_server, &reason) < 0)
return 0;
+ if (!HasOFlag(source_p, OPER_FLAG_K))
+ {
+ if (tkline_time == 0 || tkline_time > ConfigFileEntry.tkline_max)
+ {
+ sendto_one(source_p, ":%s NOTICE %s :Refused to set kline - must be temporary < %u min",
+ me.name, source_p->name, ConfigFileEntry.tkline_max / 60);
+ return 0;
+ }
+
+ if (user[0] == '*')
+ {
+ sendto_one(source_p, ":%s NOTICE %s :Refused to set kline - must give ~ or ^ user prefix",
+ me.name, source_p->name);
+ return 0;
+ }
+ }
+
if (target_server != NULL)
{
sendto_match_servs(source_p, target_server, CAP_KLN, "KLINE %s %lu %s %s :%s",
@@ -272,10 +289,11 @@ mo_kline(struct Client *client_p, struct Client *source_p,
conf->user = xstrdup(user);
if (tkline_time != 0)
- snprintf(buffer, sizeof(buffer), "Temporary K-line %d min. - %s (%s)",
- (int)(tkline_time/60), reason, current_date);
+ snprintf(buffer, sizeof(buffer), "Temporary K-line %d min by %s - %s (%s)",
+ (int)(tkline_time/60), source_p->name, reason, current_date);
else
- snprintf(buffer, sizeof(buffer), "%s (%s)", reason, current_date);
+ snprintf(buffer, sizeof(buffer), "K-line by %s - %s (%s)",
+ source_p->name, reason, current_date);
conf->reason = xstrdup(buffer);
m_kline_add_kline(source_p, conf, tkline_time);
@@ -322,10 +340,11 @@ me_kline(struct Client *client_p, struct Client *source_p,
conf->user = xstrdup(kuser);
if (tkline_time != 0)
- snprintf(buffer, sizeof(buffer), "Temporary K-line %d min. - %s (%s)",
- (int)(tkline_time/60), kreason, current_date);
+ snprintf(buffer, sizeof(buffer), "Temporary K-line %d min by %s - %s (%s)",
+ (int)(tkline_time/60), source_p->name, kreason, current_date);
else
- snprintf(buffer, sizeof(buffer), "%s (%s)", kreason, current_date);
+ snprintf(buffer, sizeof(buffer), "K-line by %s - %s (%s)",
+ source_p->name, kreason, current_date);
conf->reason = xstrdup(buffer);
m_kline_add_kline(source_p, conf, tkline_time);