From 2829d593fbe44195d896424bc1a40dc64cf524f0 Mon Sep 17 00:00:00 2001 From: VG Date: Thu, 12 May 2016 17:48:18 +0200 Subject: Fix mail id by search after idle --- climl/imap.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/climl/imap.py b/climl/imap.py index 4616e01..14ecf2f 100644 --- a/climl/imap.py +++ b/climl/imap.py @@ -140,12 +140,11 @@ def main(callback=None): print('calling callback...') callback('mail: ' + str(oneid)) while True: - events = imap_waiter(connection) - if events: - print('events:', events) - for oneid, _ in events: - print('calling callback...') - callback('mail: ' + str(oneid)) + imap_waiter(connection) + idlist = connection.search(['UNSEEN']) + for oneid in idlist: + print('calling callback...') + callback('mail: ' + str(oneid)) except (socket.error, socket.timeout): pass except KeyboardInterrupt: -- cgit v1.2.3