summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMadhur Garg <madhurgarg96@gmail.com>2019-08-21 15:50:02 +0530
committerMadhur Garg <madhurgarg96@gmail.com>2019-08-22 00:54:25 +0530
commitaae00af2811e5d1229de1727717745e0dc242eab (patch)
treef4851ad4d4b102302acd9f826d42f92d030d80c9
parent47dc7f0095cc1442c4002e9dab0d85da89aa3c02 (diff)
downloadpoezio-aae00af2811e5d1229de1727717745e0dc242eab.tar.gz
poezio-aae00af2811e5d1229de1727717745e0dc242eab.tar.bz2
poezio-aae00af2811e5d1229de1727717745e0dc242eab.tar.xz
poezio-aae00af2811e5d1229de1727717745e0dc242eab.zip
Changed query_id from int to boolean type.
-rw-r--r--poezio/mam.py8
-rw-r--r--poezio/tabs/basetabs.py8
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)