forked from karx/dircord
Strip IRC control characters
This commit is contained in:
parent
b52451ee9c
commit
9b87536c09
|
@ -281,6 +281,7 @@ async fn irc_loop(
|
|||
lazy_static! {
|
||||
static ref PING_NICK_1: Regex = Regex::new(r"^[\w+]+(:|,)").unwrap();
|
||||
static ref PING_RE_2: Regex = Regex::new(r"@[^0-9\s]+").unwrap();
|
||||
static ref CONTROL_CHAR_RE: Regex = Regex::new(r"\\x1f|\\x02|\\x12|\\x0f|\\x16|\\x03(?:\d{1,2}(?:,\d{1,2})?)?").unwrap();
|
||||
}
|
||||
|
||||
client.identify()?;
|
||||
|
@ -392,6 +393,8 @@ async fn irc_loop(
|
|||
.to_string();
|
||||
}
|
||||
|
||||
computed = CONTROL_CHAR_RE.replace_all(&computed, "").to_string();
|
||||
|
||||
w.username(nickname);
|
||||
w.content(computed);
|
||||
w
|
||||
|
|
Loading…
Reference in a new issue