aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--climl/imap.py4
1 files changed, 3 insertions, 1 deletions
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: