From e206a0b77bbd1e943bc7ce3f759e78c15565fcbd Mon Sep 17 00:00:00 2001 From: JustAnotherArchivist Date: Mon, 19 Oct 2020 02:49:37 +0000 Subject: [PATCH] Handle CTCP ACTION (aka /me) To convert log files written with the previous version: `sed -i.bak 's, PRIVMSG <\([^>]\+\)> \x01ACTION \(.*\)\x01$, ACTION \1 \2,' FILES` --- irclog.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/irclog.py b/irclog.py index c5d0efe..619a581 100644 --- a/irclog.py +++ b/irclog.py @@ -565,6 +565,10 @@ class IRCClientProtocol(asyncio.Protocol): channel = line.params[0] if channel not in self.server.channels: return + if line.command == 'PRIVMSG' and line.params[1].startswith('\x01ACTION ') and line.params[1].endswith('\x01'): + # CTCP ACTION (aka /me) + yield 'ACTION', channel, f'{get_mode_nick(channel)} {line.params[1][8:-1]}' + return yield line.command, channel, f'<{get_mode_nick(channel)}> {line.params[1]}' elif line.command == 'PART': channels = [line.params[0]] if ',' not in line.params[0] else line.params[0].split(',')