From 6aacf3a4abf6c104f32e6a1dcaf3d3c67cc3aace Mon Sep 17 00:00:00 2001 From: VG Date: Mon, 9 May 2016 17:54:27 +0200 Subject: Auto-commit on 6d1dbe8495b5fafbc5f50d80268d0ca5b7b097be --- climl/imap.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/climl/imap.py b/climl/imap.py index 783b228..c097a15 100644 --- a/climl/imap.py +++ b/climl/imap.py @@ -103,7 +103,7 @@ def imap_waiter(connection): raise print('quitting idle mode...') connection.idle_done() - return [i for i in events if str(bytes(i[0]), encoding='ascii') != 'OK'] + return [i for i in events if i[1] == b'RECENT'), encoding='ascii') != 'OK'] def main(callback=None): @@ -122,6 +122,8 @@ def main(callback=None): with connect_to_imap(conf, password) as connection: print('selecting folder', conf.get('imap.mailbox')) connection.select_folder(conf.get('imap.mailbox')) + # at start, select all mails + idlist = connection.search(['SEEN']) while True: events = imap_waiter(connection) if events: -- cgit v1.2.3