All patches and comments are welcome. Please squash your changes to logical
commits before using git-format-patch and git-send-email to
patches@git.madduck.net.
If you'd read over the Git project's submission guidelines and adhered to them,
I'd be especially grateful.
2 # -*- coding: utf-8 -*-
4 # process-tickler – process message in tickler maildir
6 # Copyright © martin f. krafft <madduck@debian.org>
7 # Released under the terms of the Artistic Licence 2.0
15 HOME = os.getenv('HOME')
16 MAILDIR = os.path.join(HOME, '.maildir')
17 TICKLER_DIR = os.path.join(MAILDIR, '.tickler')
20 tmd = mailbox.Maildir(TICKLER_DIR)
21 imd = mailbox.Maildir(INBOX_DIR)
24 def move_to_inbox(key):
25 msg = tmd.get_message(key)
26 print >>sys.stdout, 'I: move message %s to inbox' % key
27 msg.add_header('X-Tickle-Delivered', time.strftime('%c'))
31 for key, msg in tmd.iteritems():
32 msgid = msg.get('Message-Id')
34 print >>sys.stderr, 'W: message without ID: ' + key
37 tickle = msg.get('X-Tickle')
39 print >>sys.stderr, 'W: message without tickle information: ' + key
42 if msgids.get(msgid, None) is None:
43 msgids[msgid] = list()
44 msgids[msgid].append((int(tickle.split(' ', 1)[0]), key, msg))
46 for msgid, msgs in msgids.iteritems():
49 for tickle, key, msg in msgs:
50 if tickle == prev_tickle:
51 print >>sys.stderr, 'I: discarding duplicate %s of message %s' % (key, msgid)
60 print >>sys.stdout, 'I: message %s still has %d seconds' % (key,