aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVG <vg@devys.org>2016-05-11 14:42:09 +0200
committerVG <vg@devys.org>2016-05-11 14:42:09 +0200
commit7266da779de14349a2edb0a60594115006f8fee9 (patch)
tree981efe968139a5465ea9df467d266b364b74bb0b
parent759b5713837e3a0e3d911de32e724cd610abea64 (diff)
downloadcliml-7266da779de14349a2edb0a60594115006f8fee9.tar.gz
climl-7266da779de14349a2edb0a60594115006f8fee9.tar.bz2
climl-7266da779de14349a2edb0a60594115006f8fee9.zip
get unseen mails at start
-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: