aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--climl/imap.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/climl/imap.py b/climl/imap.py
index 19354d3..3785427 100644
--- a/climl/imap.py
+++ b/climl/imap.py
@@ -124,12 +124,17 @@ def main(callback=None):
connection.select_folder(conf.get('imap.mailbox'))
# at start, select all mails
idlist = connection.search(['SEEN'])
+ for oneid in idlist:
+ print('new mail:', oneid)
+ print('calling callback...')
+ callback('mail: ' + str(oneid))
while True:
events = imap_waiter(connection)
if events:
print('events:', events)
- print('calling callback...')
- callback('mail')
+ for oneid, _ in events:
+ print('calling callback...')
+ callback('mail: ' + str(oneid))
except (socket.error, socket.timeout):
pass
except KeyboardInterrupt: