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')
18 DEST_DIR = os.path.join(MAILDIR, '.resubmit')
20 tmd = mailbox.Maildir(TICKLER_DIR)
21 dmd = mailbox.Maildir(DEST_DIR)
25 msg = tmd.get_message(key)
26 print >>sys.stdout, 'I: resubmit message %s' % key
27 if msg.has_key('X-Tickle-Delivered'):
28 msg.replace_header('X-Tickle-Delivered', time.strftime('%c'))
30 msg.add_header('X-Tickle-Delivered', time.strftime('%c'))
34 for key, msg in tmd.iteritems():
35 msgid = msg.get('Message-Id')
37 print >>sys.stderr, 'W: message without ID: ' + key
40 tickle = msg.get('X-Tickle')
42 print >>sys.stderr, 'W: message without tickle information: ' + msgid
45 if msgids.get(msgid, None) is None:
46 msgids[msgid] = list()
47 msgids[msgid].append((int(tickle.split(' ', 1)[0]), key, msg))
49 for msgid, msgs in msgids.iteritems():
52 for tickle, key, msg in msgs:
53 if tickle == prev_tickle:
54 print >>sys.stderr, 'I: discarding duplicate %s of message %s' % (key, msgid)
63 print >>sys.stdout, 'I: message %s still has %d seconds' % (key,