xline: accept the durationless KLINE/GLINE form (mask :reason) instead of eating the reason
This commit is contained in:
parent
5046083608
commit
dadbff91d8
1 changed files with 12 additions and 5 deletions
|
|
@ -679,11 +679,18 @@ fn do_xline(s: &mut Server, uid: Uid, params: &[String], kind: XKind) -> CmdResu
|
||||||
);
|
);
|
||||||
return CmdResult::Ok;
|
return CmdResult::Ok;
|
||||||
}
|
}
|
||||||
let dur = parse_duration(¶ms[1]).unwrap_or(0);
|
// <mask> <duration> :<reason>; tolerate the durationless form by taking an
|
||||||
let reason = params
|
// unparseable second token as the reason (permanent ban).
|
||||||
|
let (dur, reason) = match parse_duration(¶ms[1]) {
|
||||||
|
Some(d) => (
|
||||||
|
d,
|
||||||
|
params
|
||||||
.get(2)
|
.get(2)
|
||||||
.cloned()
|
.cloned()
|
||||||
.unwrap_or_else(|| "No reason given".to_string());
|
.unwrap_or_else(|| "No reason given".to_string()),
|
||||||
|
),
|
||||||
|
None => (0, params[1].clone()),
|
||||||
|
};
|
||||||
s.add_xline(kind, &mask, dur, &nick, &reason);
|
s.add_xline(kind, &mask, dur, &nick, &reason);
|
||||||
s.propagate_addline(kind.tag(), &mask, &nick, dur, &reason);
|
s.propagate_addline(kind.tag(), &mask, &nick, dur, &reason);
|
||||||
CmdResult::Ok
|
CmdResult::Ok
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue