Skip to content

Commit

Permalink
irc-proto: Misc refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
simnalamburt committed Jun 3, 2023
1 parent b0c5f1f commit 467efb9
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions irc-proto/src/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -290,19 +290,20 @@ fn unescape_tag_value(value: &str) -> String {
let mut unescaped = String::with_capacity(value.len());
let mut iter = value.chars();
while let Some(c) = iter.next() {
if c == '\\' {
let r = if c == '\\' {
match iter.next() {
Some(':') => unescaped.push(';'),
Some('s') => unescaped.push(' '),
Some('\\') => unescaped.push('\\'),
Some('r') => unescaped.push('\r'),
Some('n') => unescaped.push('\n'),
Some(c) => unescaped.push(c),
Some(':') => ';',
Some('s') => ' ',
Some('\\') => '\\',
Some('r') => '\r',
Some('n') => '\n',
Some(c) => c,
None => break,
}
} else {
unescaped.push(c);
}
c
};
unescaped.push(r);
}
unescaped
}
Expand Down

0 comments on commit 467efb9

Please sign in to comment.