aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--climl/imap.py11
1 files 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: