At Wed, 04 Sep 2013 17:11:11 +0200,
Paul J Stevens <[email protected]> wrote:
> 
> On 09/04/2013 03:13 PM, Sergej Pupykin wrote:
> > 
> > Hi,
> > 
> > currently mailbox2dbmail runs sieve script for each imported
> > message. I think it is not what user expects. This patch adds
> > -s|--sieve switch. (off by default)
> 
> Very nice, but please, please, please: use 'git am'

Do you mean 'git format-patch'?



>From 5ed44784b023b0b49b02ff74990cf0564b52ebf0 Mon Sep 17 00:00:00 2001
From: Sergej Pupykin <[email protected]>
Date: Wed, 4 Sep 2013 19:25:15 +0400
Subject: [PATCH] add --sieve switch for mbox import

---
 contrib/mailbox2dbmail/mailbox2dbmail | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/contrib/mailbox2dbmail/mailbox2dbmail 
b/contrib/mailbox2dbmail/mailbox2dbmail
index ea2f686..6babffd 100755
--- a/contrib/mailbox2dbmail/mailbox2dbmail
+++ b/contrib/mailbox2dbmail/mailbox2dbmail
@@ -35,10 +35,11 @@ def main():
         box = "Inbox"
         path = "/usr/sbin/dbmail-deliver"
         dryrun = False
+        sieve = False
         opts, args = getopt.getopt(
             sys.argv[1:],
-            "u:m:b:t:p:f:dhv",
-            ["user=", "mail=", "box=", "path=", "type=", "help", "version"])
+            "u:m:b:t:p:f:dhvs",
+            ["user=", "mail=", "box=", "path=", "type=", "help", "version", 
"dryrun", "sieve"])
         for o, a in opts:
             if o in ("-v", "--version"):
                 print version
@@ -48,6 +49,8 @@ def main():
                 sys.exit()
             elif o in ("-d", "--dryrun"):
                 dryrun = True
+            elif o in ("-s", "--sieve"):
+                sieve = True
             elif o in ("-u", "--user"):
                 user = a
             elif o in ("-m", "--mail"):
@@ -85,7 +88,7 @@ def main():
         elif not type:
             print "No mailbox type specified"
             sys.exit(1)
-        convert(user, mbox, box, path, conf, dryrun)
+        convert(user, mbox, box, path, conf, dryrun, sieve)
     except getopt.GetoptError:
         usage()
         print "Error Parsing Options"
@@ -96,6 +99,7 @@ def usage():
     print version
     print """%s
     -d|--dryrun
+    -s|--sieve
     -u|--user <user>
     -t|--type <mbox, maildir, and mhdir>
     -m|--mail <location of mailbox>
@@ -105,11 +109,12 @@ def usage():
     """ % (sys.argv[0], )
 
 
-def convert(user, mbox, box, path, conf, dryrun):
+def convert(user, mbox, box, path, conf, dryrun, sieve):
     if conf:
         conf = """-f %s""" % conf
-    command = """%s %s -m "%s" -u "%s" """ % (
-        path, conf, box, user)
+    command = """%s %s %s "%s" -u "%s" """ % (
+        path, conf, "-m" if sieve else "-M", box, user)
+    print command
     msgnumber = 1
     try:
         while 1:
-- 
1.8.4

_______________________________________________
Dbmail-dev mailing list
[email protected]
http://mailman.fastxs.nl/cgi-bin/mailman/listinfo/dbmail-dev

Reply via email to