diff options
author | Madhur Garg <madhurgarg96@gmail.com> | 2019-08-21 02:55:21 +0530 |
---|---|---|
committer | Madhur Garg <madhurgarg96@gmail.com> | 2019-08-22 00:54:25 +0530 |
commit | e3c1ac4033b3f9f2888e494aa6ab459a2e4c52c2 (patch) | |
tree | 72fd10f9c0eb62c80c0641bd1324ed3357a5fde5 | |
parent | 7e4735b0ad3a2cc34f69ff4215565721de6e20cd (diff) | |
download | poezio-e3c1ac4033b3f9f2888e494aa6ab459a2e4c52c2.tar.gz poezio-e3c1ac4033b3f9f2888e494aa6ab459a2e4c52c2.tar.bz2 poezio-e3c1ac4033b3f9f2888e494aa6ab459a2e4c52c2.tar.xz poezio-e3c1ac4033b3f9f2888e494aa6ab459a2e4c52c2.zip |
Initialized stanza_id in the basetabs.
-rw-r--r-- | poezio/mam.py | 25 | ||||
-rw-r--r-- | poezio/tabs/basetabs.py | 1 |
2 files changed, 12 insertions, 14 deletions
diff --git a/poezio/mam.py b/poezio/mam.py index bcb31024..4c8f3309 100644 --- a/poezio/mam.py +++ b/poezio/mam.py @@ -141,21 +141,18 @@ async def query(tab, remote_jid, top, start=None, end=None, before=None): def mam_scroll(tab): remote_jid = tab.jid text_buffer = tab._text_buffer - try: - before = tab.stanza_id - except: - before = None - end = datetime.now() - if isinstance(tab, tabs.MucTab) is False: - for message in text_buffer.messages: - time = message.time - if time < end: - end = time + before = tab.stanza_id + end = datetime.now() + if isinstance(tab, tabs.MucTab) is False: + for message in text_buffer.messages: + time = message.time + if time < end: + end = time end = end + timedelta(seconds=-1) - tzone = datetime.now().astimezone().tzinfo - end = end.replace(tzinfo=tzone).astimezone(tz=timezone.utc) - end = end.replace(tzinfo=None) - end = datetime.strftime(end, '%Y-%m-%dT%H:%M:%SZ') + tzone = datetime.now().astimezone().tzinfo + end = end.replace(tzinfo=tzone).astimezone(tz=timezone.utc) + end = end.replace(tzinfo=None) + end = datetime.strftime(end, '%Y-%m-%dT%H:%M:%SZ') top = True pos = tab.text_win.pos tab.text_win.pos += tab.text_win.height - 1 diff --git a/poezio/tabs/basetabs.py b/poezio/tabs/basetabs.py index 12fcd170..f61c3f76 100644 --- a/poezio/tabs/basetabs.py +++ b/poezio/tabs/basetabs.py @@ -475,6 +475,7 @@ class ChatTab(Tab): assert jid.domain self._jid = jid self.query_id = 0 + self.stanza_id = None self._name = jid.full # type: Optional[str] self.text_win = None |