From 8e07c6d60e785fe15023800a942a0132a551b37a Mon Sep 17 00:00:00 2001 From: Madhur Garg Date: Tue, 9 Jul 2019 13:23:48 +0530 Subject: Added messages when the query is starting and ending. --- poezio/mam.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/poezio/mam.py b/poezio/mam.py index 981c20e9..a63b7b5f 100644 --- a/poezio/mam.py +++ b/poezio/mam.py @@ -16,8 +16,11 @@ def add_line(text_buffer: TextBuffer, text: str, str_time: str, nick: str, top: time = datetime.strftime(str_time, '%Y-%m-%d %H:%M:%S') time = datetime.strptime(time, '%Y-%m-%d %H:%M:%S') - nick = nick.split('/')[1] - color = get_theme().COLOR_OWN_NICK + if '/' in nick: + nick = nick.split('/')[1] + color = get_theme().COLOR_OWN_NICK + else: + color = get_theme().COLOR_ME_MESSAGE top = top text_buffer.add_message( text, @@ -42,6 +45,8 @@ async def query(self, remote_jid, start, end, top): iterator=True, reverse=top, start=self.start_date, end=self.end_date) msg_count = 0 msgs = [] + timestamp = datetime.now() + add_line(text_buffer, 'Start of MAM query: ', timestamp, 'MAM', top) async for rsm in results: if top: for msg in rsm['mam']['results']: @@ -64,6 +69,8 @@ async def query(self, remote_jid, start, end, top): message = forwarded['stanza'] add_line(text_buffer, message['body'], timestamp, str(message['from']), top) self.core.refresh_window() + timestamp = datetime.now() + add_line(text_buffer, 'End of MAM query: ', timestamp, 'MAM', top) def mam_scroll(self): -- cgit v1.2.3