fix(tvldb): unbreak quote grabbing
Change-Id: Ib03561bbcc154aeee50a592332a2763ff784bb1d Reviewed-on: https://cl.tvl.fyi/c/depot/+/1165 Tested-by: BuildkiteCI Reviewed-by: eta <eta@theta.eu.org> Reviewed-by: glittershark <grfn@gws.fyi>
This commit is contained in:
parent
209f8ef79f
commit
d3ad338726
1 changed files with 4 additions and 3 deletions
|
@ -141,20 +141,21 @@ impl App {
|
||||||
qlast: Captures,
|
qlast: Captures,
|
||||||
) -> Result<(), Error> {
|
) -> Result<(), Error> {
|
||||||
let db = self.pg.get()?;
|
let db = self.pg.get()?;
|
||||||
|
let nick_to_grab = &qlast["subj"].to_ascii_lowercase();
|
||||||
let mut kwd = self.keyword_from_captures(&qlast, nick, chan)?;
|
let mut kwd = self.keyword_from_captures(&qlast, nick, chan)?;
|
||||||
let chan_lastmsgs = self
|
let chan_lastmsgs = self
|
||||||
.last_msgs
|
.last_msgs
|
||||||
.entry(chan.to_string())
|
.entry(chan.to_string())
|
||||||
.or_insert(HashMap::new());
|
.or_insert(HashMap::new());
|
||||||
// Use `nick` here, so things like "grfn: see glittershark" work.
|
// Use `nick` here, so things like "grfn: see glittershark" work.
|
||||||
let val = if let Some(last) = chan_lastmsgs.get(&nick.to_ascii_lowercase()) {
|
let val = if let Some(last) = chan_lastmsgs.get(nick_to_grab) {
|
||||||
if last.starts_with("\x01ACTION ") {
|
if last.starts_with("\x01ACTION ") {
|
||||||
// Yes, this is inefficient, but it's better than writing some hacky CTCP parsing code
|
// Yes, this is inefficient, but it's better than writing some hacky CTCP parsing code
|
||||||
// I guess (also, characters are hard, so just blindly slicing seems like a bad idea)
|
// I guess (also, characters are hard, so just blindly slicing seems like a bad idea)
|
||||||
format!("* {} {}", nick, last.replace("\x01ACTION ", "").replace("\x01", ""))
|
format!("* {} {}", nick_to_grab, last.replace("\x01ACTION ", "").replace("\x01", ""))
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
format!("<{}> {}", nick, last)
|
format!("<{}> {}", nick_to_grab, last)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Err(format_err!("I dunno what {} said...", kwd.keyword.name))?
|
Err(format_err!("I dunno what {} said...", kwd.keyword.name))?
|
||||||
|
|
Loading…
Reference in a new issue