summaryrefslogtreecommitdiff
path: root/poezio/mam.py
diff options
context:
space:
mode:
authorMadhur Garg <madhurgarg96@gmail.com>2019-07-09 13:23:48 +0530
committerMadhur Garg <madhurgarg96@gmail.com>2019-08-22 00:54:25 +0530
commit8e07c6d60e785fe15023800a942a0132a551b37a (patch)
tree2e441e3a4b435e57b08a7ce0e43597eb6918c20b /poezio/mam.py
parent3e491589a8f9bcbb877235b34e9401c3bdcfdde7 (diff)
downloadpoezio-8e07c6d60e785fe15023800a942a0132a551b37a.tar.gz
poezio-8e07c6d60e785fe15023800a942a0132a551b37a.tar.bz2
poezio-8e07c6d60e785fe15023800a942a0132a551b37a.tar.xz
poezio-8e07c6d60e785fe15023800a942a0132a551b37a.zip
Added messages when the query is starting and ending.
Diffstat (limited to 'poezio/mam.py')
-rw-r--r--poezio/mam.py11
1 files 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):