From f9aa3a9344bc8de0bd05c8f7d2450c7e18a94f1d Mon Sep 17 00:00:00 2001 From: JustAnotherArchivist Date: Mon, 19 Oct 2020 02:49:22 +0000 Subject: [PATCH] Separate message author into own column --- irclog.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/irclog.py b/irclog.py index c6320b4..c5d0efe 100644 --- a/irclog.py +++ b/irclog.py @@ -934,7 +934,17 @@ class WebServer: d = datetime.datetime.utcfromtimestamp(ts).replace(tzinfo = datetime.timezone.utc) date = f'{d:%Y-%m-%d }' if withDate else '' lineId = hashlib.md5(f'{ts} {command} {content}'.encode('utf-8')).hexdigest()[:8] - ret.append(f'{date}{d:%H:%M:%S}{html.escape(content)}') + if command in ('NOTICE', 'PRIVMSG'): + author, content = content.split(' ', 1) + else: + author = '' + ret.append(''.join([ + f'', + f'{date}{d:%H:%M:%S}', + f'{html.escape(author)}', + f'{html.escape(content)}', + '' + ])) return '\n' + '\n'.join(ret) + '\n
' if ret else '' async def get_log(self, request):