Skip to content

Commit

Permalink
Merge pull request CloudBotIRC#98 from linuxdaemon/gonzobot+correctio…
Browse files Browse the repository at this point in the history
…n-fix

Fix unescaping of charcaters in corrected messages
  • Loading branch information
edwardslabs authored Nov 29, 2017
2 parents 2d1c0ae + 94f7d78 commit 9455941
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions plugins/correction.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,15 @@ def correction(match, conn, nick, chan, message):
mod_msg = msg
fmt = "<{}> {}"

mod_msg = ireplace(mod_msg, find_esc, "\x02" + replace_esc + "\x02")
mod_msg = ireplace(re.escape(mod_msg), find_esc, "\x02" + replace_esc + "\x02")

mod_msg = unescape_re.sub(r"\1", mod_msg)

message("Correction, {}".format(fmt.format(name, mod_msg)))

msg = ireplace(msg, find_esc, replace_esc)
if nick.lower() == name.lower():
msg = ireplace(re.escape(msg), find_esc, replace_esc)
msg = unescape_re.sub(r"\1", msg)
conn.history[chan].append((name, timestamp, msg))

break

0 comments on commit 9455941

Please sign in to comment.