From aae00af2811e5d1229de1727717745e0dc242eab Mon Sep 17 00:00:00 2001 From: Madhur Garg Date: Wed, 21 Aug 2019 15:50:02 +0530 Subject: Changed query_id from int to boolean type. --- poezio/mam.py | 8 ++++---- poezio/tabs/basetabs.py | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/poezio/mam.py b/poezio/mam.py index 1a6743a7..c352ac7f 100644 --- a/poezio/mam.py +++ b/poezio/mam.py @@ -67,7 +67,7 @@ async def query(tab, remote_jid, top, start=None, end=None, before=None): try: iq = await tab.core.xmpp.plugin['xep_0030'].get_info(jid=remote_jid) except (IqError, IqTimeout): - return tab.information('Failed to retrieve messages', 'Error') + return tab.core.information('Failed to retrieve messages', 'Error') if 'urn:xmpp:mam:2' not in iq['disco_info'].get_features(): return tab.core.information("%s doesn't support MAM." % remote_jid, "Info") if top: @@ -113,7 +113,7 @@ async def query(tab, remote_jid, top, start=None, end=None, before=None): '{%s}%s' % ('jabber:client', 'body')) is not None: msgs.append(msg) if msg_count == 10: - tab.query_id = 0 + tab.query_status = False tab.core.refresh_window() return msg_count += 1 @@ -136,7 +136,7 @@ async def query(tab, remote_jid, top, start=None, end=None, before=None): tab.core.refresh_window() if len(msgs) == 0: return tab.core.information('No more messages left to retrieve', 'Info') - tab.query_id = 0 + tab.query_status = False def mam_scroll(tab): remote_jid = tab.jid @@ -160,7 +160,7 @@ def mam_scroll(tab): asyncio.ensure_future(query(tab, remote_jid, top=True, end=end)) else: asyncio.ensure_future(query(tab, remote_jid, top=True, before=before)) - tab.query_id = 1 + tab.query_status = True tab.text_win.pos = len(tab.text_win.built_lines) - tab.text_win.height if tab.text_win.pos < 0: tab.text_win.pos = 0 diff --git a/poezio/tabs/basetabs.py b/poezio/tabs/basetabs.py index 24fff75e..f7812060 100644 --- a/poezio/tabs/basetabs.py +++ b/poezio/tabs/basetabs.py @@ -474,7 +474,7 @@ class ChatTab(Tab): jid = JID(jid) assert jid.domain self._jid = jid - self.query_id = 0 + self.query_status = False self.last_stanza_id = None self._name = jid.full # type: Optional[str] @@ -928,10 +928,10 @@ class ChatTab(Tab): return self.text_win.scroll_down(1) def on_scroll_up(self): - if self.query_id == 0: - return mam.mam_scroll(tab=self) - else: + if self.query_status: return self.text_win.scroll_up(self.text_win.height - 1) + else: + return mam.mam_scroll(tab=self) def on_scroll_down(self): return self.text_win.scroll_down(self.text_win.height - 1) -- cgit v1.2.3