diff options
author | roger <roger@elvex.org.ar> | 2013-02-09 12:31:13 -0300 |
---|---|---|
committer | roger <roger@elvex.org.ar> | 2013-02-09 12:31:13 -0300 |
commit | 43132dab8525299bc9277a46a21f16ddb0ad3793 (patch) | |
tree | d93eafed1aac539288eaf07921d01aa6826e0f02 /sleekxmpp/plugins/gmail | |
parent | badd327360a0c33b5229edb733e38441e74774e8 (diff) | |
download | slixmpp-43132dab8525299bc9277a46a21f16ddb0ad3793.tar.gz slixmpp-43132dab8525299bc9277a46a21f16ddb0ad3793.tar.bz2 slixmpp-43132dab8525299bc9277a46a21f16ddb0ad3793.tar.xz slixmpp-43132dab8525299bc9277a46a21f16ddb0ad3793.zip |
fix not blocking gmail notification check
Diffstat (limited to 'sleekxmpp/plugins/gmail')
-rw-r--r-- | sleekxmpp/plugins/gmail/notifications.py | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/sleekxmpp/plugins/gmail/notifications.py b/sleekxmpp/plugins/gmail/notifications.py index 53ad2f3f..9cc67f04 100644 --- a/sleekxmpp/plugins/gmail/notifications.py +++ b/sleekxmpp/plugins/gmail/notifications.py @@ -59,16 +59,20 @@ class Gmail(BasePlugin): def check(self, block=True, timeout=None, callback=None): last_time = self._last_result_time last_tid = self._last_result_tid - data = self.search(newer_time=last_time, + + def check_callback(data): + self._last_result_time = data["gmail_messages"]["result_time"] + if data["gmail_messages"]["threads"]: + self._last_result_tid = \ + data["gmail_messages"]["threads"][0]["tid"] + if callback: + callback(data) + + return self.search(newer_time=last_time, newer_tid=last_tid, block=block, timeout=timeout, - callback=callback) - - self._last_result_time = data["gmail_messages"]["result_time"] - if data["gmail_messages"]["threads"]: - self._last_result_tid = data["gmail_messages"]["threads"][0]["tid"] - return data + callback=check_callback) def search(self, query=None, newer_time=None, newer_tid=None, block=True, timeout=None, callback=None): |