]> git.madduck.net Git - etc/mailfilter.git/blobdiff - bin/process-tickler

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

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.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

separate delivery
[etc/mailfilter.git] / bin / process-tickler
index d7af9b6cd040a04eaf897e4051bec3180cc56cd1..28b6c5ea92eef84e2c9a5c8c172390be969ecbc2 100755 (executable)
@@ -15,32 +15,32 @@ import time
 HOME = os.getenv('HOME')
 MAILDIR = os.path.join(HOME, '.maildir')
 TICKLER_DIR = os.path.join(MAILDIR, '.tickler')
-INBOX_DIR = MAILDIR
+DEST_DIR = os.path.join(MAILDIR, '.resubmit')
 
 tmd = mailbox.Maildir(TICKLER_DIR)
-imd = mailbox.Maildir(INBOX_DIR)
+dmd = mailbox.Maildir(DEST_DIR)
 msgids = dict()
 
-def move_to_inbox(key):
+def resubmit(key):
     msg = tmd.get_message(key)
-    print >>sys.stdout, 'I: move message %s to inbox' % key
+    print >>sys.stdout, 'I: resubmit message %s' % key
     if msg.has_key('X-Tickle-Delivered'):
         msg.replace_header('X-Tickle-Delivered', time.strftime('%c'))
     else:
         msg.add_header('X-Tickle-Delivered', time.strftime('%c'))
-    imd.add(msg)
+    dmd.add(msg)
     tmd.discard(key)
 
 for key, msg in tmd.iteritems():
     msgid = msg.get('Message-Id')
     if msgid is None:
         print >>sys.stderr, 'W: message without ID: ' + key
-        move_to_inbox(key)
+        resubmit(key)
 
     tickle = msg.get('X-Tickle')
     if tickle is None:
-        print >>sys.stderr, 'W: message without tickle information: ' + key
-        move_to_inbox(key)
+        print >>sys.stderr, 'W: message without tickle information: ' + msgid
+        resubmit(key)
 
     if msgids.get(msgid, None) is None:
         msgids[msgid] = list()
@@ -58,7 +58,7 @@ for msgid, msgs in msgids.iteritems():
 
         t = time.time()
         if t >= tickle:
-            move_to_inbox(key)
+            resubmit(key)
         else:
             print >>sys.stdout, 'I: message %s still has %d seconds' % (key,
                     int(tickle - t))