diff options
author | root <madhurgarg96@gmail.com> | 2019-09-13 03:52:13 +0530 |
---|---|---|
committer | root <madhurgarg96@gmail.com> | 2019-09-13 04:24:26 +0530 |
commit | a399e59e463b3876f157caeb78f750c6fcd08947 (patch) | |
tree | 3f8ca309575b313b7b6d35863b8ae043de9951a3 | |
parent | 31751bcb6198ecc3a2bfc3d21a35be67581d6bac (diff) | |
download | poezio-a399e59e463b3876f157caeb78f750c6fcd08947.tar.gz poezio-a399e59e463b3876f157caeb78f750c6fcd08947.tar.bz2 poezio-a399e59e463b3876f157caeb78f750c6fcd08947.tar.xz poezio-a399e59e463b3876f157caeb78f750c6fcd08947.zip |
Corrected the functionality of query_status
-rw-r--r-- | poezio/mam.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/poezio/mam.py b/poezio/mam.py index c42e7a18..ad1c07e2 100644 --- a/poezio/mam.py +++ b/poezio/mam.py @@ -191,6 +191,7 @@ async def fetch_history(tab, end: Optional[datetime] = None, amount: Optional[in async def on_tab_open(tab) -> None: amount = 2 * tab.text_win.height end = datetime.now() + tab.query_status = True for message in tab._text_buffer.messages: time = message.time if time < end: @@ -199,6 +200,7 @@ async def on_tab_open(tab) -> None: try: await fetch_history(tab, end=end, amount=amount) except (NoMAMSupportException, MAMQueryException, DiscoInfoException): + tab.query_status = False return None @@ -210,6 +212,10 @@ async def on_scroll_up(tab) -> None: # join if not already available. total, pos, height = len(tw.built_lines), tw.pos, tw.height rest = (total - pos) // height + # Not resetting the state of query_status here, it is changed only after the + # query is complete (in fetch_history) + # This is done to stop message repetition, eg: if the user presses PageUp continuously. + tab.query_status = True if rest > 1: return None |