From 318958d6fefd6d4e854fe7d6a4562041ce04d007 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Thu, 29 Dec 2016 18:20:56 -0500 Subject: [PATCH] mail: add dovecot filtering --- .config/mail/.gitignore | 1 + .config/mail/dovecot-lda.conf | 16 + .config/mail/dovecot-namespaces.conf | 109 +++++ .config/mail/filters.siv | 676 +++++++++++++++++++++++++++ .config/mail/filters.test | 31 ++ .config/mail/setup-symlinks | 70 +++ .gitignore | 1 - 7 files changed, 903 insertions(+), 1 deletion(-) create mode 100644 .config/mail/.gitignore create mode 100644 .config/mail/dovecot-lda.conf create mode 100644 .config/mail/dovecot-namespaces.conf create mode 100644 .config/mail/filters.siv create mode 100755 .config/mail/filters.test create mode 100755 .config/mail/setup-symlinks diff --git a/.config/mail/.gitignore b/.config/mail/.gitignore new file mode 100644 index 0000000..c1060fe --- /dev/null +++ b/.config/mail/.gitignore @@ -0,0 +1 @@ +/*.svbin diff --git a/.config/mail/dovecot-lda.conf b/.config/mail/dovecot-lda.conf new file mode 100644 index 0000000..3774a62 --- /dev/null +++ b/.config/mail/dovecot-lda.conf @@ -0,0 +1,16 @@ +postmaster_address = vapier@localhost + +mail_location = maildir:~/.mail:LAYOUT=fs + +protocol lda { + mail_plugins = sieve +} + +plugin { + # http://wiki2.dovecot.org/Pigeonhole/Sieve + # http://wiki2.dovecot.org/Pigeonhole/Sieve/Configuration + sieve = ~/.config/mail/filters.siv +# sieve_extensions = vnd.dovecot.debug +} + +!include dovecot-namespaces.conf diff --git a/.config/mail/dovecot-namespaces.conf b/.config/mail/dovecot-namespaces.conf new file mode 100644 index 0000000..3d90010 --- /dev/null +++ b/.config/mail/dovecot-namespaces.conf @@ -0,0 +1,109 @@ +namespace "misc projects" { + separator = / + prefix = "misc projects/" + location = "maildir:~/.mail/misc projects" +} + +namespace "misc projects/busybox" { + separator = / + prefix = "misc projects/busybox/" + location = "maildir:~/.mail/.misc projects.directory/busybox" +} + +namespace "misc projects/toolchain" { + separator = / + prefix = "misc projects/toolchain/" + location = "maildir:~/.mail/.misc projects.directory/toolchain" +} + +namespace "misc projects/u-boot" { + separator = / + prefix = "misc projects/u-boot/" + location = "maildir:~/.mail/.misc projects.directory/u-boot" +} + +namespace "misc projects/uclibc" { + separator = / + prefix = "misc projects/uclibc/" + location = "maildir:~/.mail/.misc projects.directory/uclibc" +} + +namespace "misc projects/linux" { + separator = / + prefix = "misc projects/linux/" + location = "maildir:~/.mail/.misc projects.directory/linux" +} + +namespace "inbox" { + inbox = yes + separator = / + prefix = "inbox/" + location = "maildir:~/.mail/inbox" +} + +namespace "inbox/WPI" { + separator = / + prefix = "inbox/WPI/" + location = "maildir:~/.mail/.inbox.directory/WPI" +} + +namespace "inbox/WPI/classes" { + separator = / + prefix = "inbox/WPI/classes/" + location = "maildir:~/.mail/.inbox.directory/.WPI.directory/classes" +} + +namespace "gentoo.org" { + separator = / + prefix = "gentoo.org/" + location = "maildir:~/.mail/gentoo.org" +} + +namespace "gentoo.org/0 TODO" { + separator = / + prefix = "gentoo.org/0 TODO/" + location = "maildir:~/.mail/.gentoo.org.directory/0 TODO" +} + +namespace "gentoo.org/bugs" { + separator = / + prefix = "gentoo.org/bugs/" + location = "maildir:~/.mail/.gentoo.org.directory/bugs" +} + +namespace "gentoo.org/bugs/arches" { + separator = / + prefix = "gentoo.org/bugs/arches/" + location = "maildir:~/.mail/.gentoo.org.directory/.bugs.directory/arches" +} + +namespace "gentoo.org/bugs/toolchain" { + separator = / + prefix = "gentoo.org/bugs/toolchain/" + location = "maildir:~/.mail/.gentoo.org.directory/.bugs.directory/toolchain" +} + +namespace "gentoo.org/bugs/base-system" { + separator = / + prefix = "gentoo.org/bugs/base-system/" + location = "maildir:~/.mail/.gentoo.org.directory/.bugs.directory/base-system" +} + +namespace "gentoo.org/dev" { + separator = / + prefix = "gentoo.org/dev/" + location = "maildir:~/.mail/.gentoo.org.directory/dev" +} + +namespace "trash" { + separator = / + prefix = "trash/" + location = "maildir:~/.mail/trash" +} + +namespace "sent-mail" { + separator = / + prefix = "sent-mail/" + location = "maildir:~/.mail/sent-mail" +} + diff --git a/.config/mail/filters.siv b/.config/mail/filters.siv new file mode 100644 index 0000000..6791fee --- /dev/null +++ b/.config/mail/filters.siv @@ -0,0 +1,676 @@ +# http://thsmi.github.com/sieve-reference/en/ + +require "fileinto"; +require "imap4flags"; +require "body"; +require "regex"; +# require "vnd.dovecot.debug"; + + +# To: Me +if anyof (header :contains "CC" "vapier@gentoo.org") +{ + setflag "G"; +} + + +# +# Spam +# +if anyof ( + header :regex "Subject" "(Buy OEM|0EM) Software", + header :is "Subject" "cheap oem soft shipping //orldwide", + header :is "Subject" "Corel Draw", + header :regex "Subject" "Last chance (for lower rates|to supercharge)" +) +{ + fileinto "trash"; + stop; +} +if anyof ( + header :contains "Content-Type" "text/html;", + body :raw :contains ["", ""] +) +{ + fileinto "trash/spam"; + stop; +} +#if anyof (body :raw :regex ["filename=.*\.exe", "filename=.*\.pif", "filename=.*\.scr", "filename=.*\.zip"]) +#{ +# fileinto "trash/spam"; +# stop; +#} + + +# SFC +if anyof ( + header :contains "List-Id" "", + header :contains "To" "busybox-compliance@sfconservancy.org", + header :contains "List-Id" "" +) +{ + fileinto "misc projects/sfc"; + stop; +} + + +# From: @chromium.org +#if anyof (header :contains "From" "@chromium.org") +#{ +# setflag "G"; +#} + + +# Linux +if anyof ( + header :contains "List-Id" "", + header :contains "List-id" "" +) +{ + fileinto "misc projects/linux"; + stop; +} + + +# Linux: device-tree +if anyof ( + header :contains "List-Id" "", + header :contains "List-Id" "" +) +{ + fileinto "misc projects/linux/embedded"; + stop; +} + + +# +# Misc projects +# +if anyof ( + # acl + header :contains "List-Id" "", + header :contains "To" "acl-devel@nongnu.org", + header :contains "Cc" "acl-devel@nongnu.org", + # alsa + header :contains "List-Id" "", + # apcupsd + header :contains "List-Id" "", + # autotools + header :contains "List-Id" "", + header :contains "List-Id" "", + header :contains "List-Id" "", + header :contains "List-Id" "", + header :contains "List-Id" "", + header :contains "List-Id" "", + # bash + header :contains "List-Id" "", + # bitpim + header :contains "List-Id" "", + # chrome + header :contains "List-Id" "", + # cldr + header :contains "List-Id" "", + # coLinux + header :contains "List-Id" "", + # coreutils + header :contains "List-Id" "", + header :contains "List-Id" "", + header :contains "List-Id" "", + # cpio + header :contains "List-Id" "", + # cracklib + header :contains "List-Id" "", + # dietlibc + header :contains "To" "dietlibc@fefe.de", + header :contains "Cc" "dietlibc@fefe.de", + # DirectFB + header :contains "List-Id" "", + header :contains "List-Id" "", + # dokuwiki + header :contains "List-Id" "", + # dropbear + header :contains "List-Id" "", + # dxr2 + header :contains "Subject" "[Dxr2-devel]", + # ed + header :contains "List-Id" "", + # file + header :contains "List-Id" "", + # fontforge/fontconfig + header :contains "List-Id" "", + header :contains "List-Id" "", + # gd + header :contains "List-Post" "", + header :contains "To" "security@libgd.org", + header :contains "Cc" "security@libgd.org", + # genext2fs + header :contains "List-Id" "", + # gnulib + header :contains "List-Id" "", + # gpm + header :contains "List-Id" "", + # gpsd + header :contains "List-Id" "", + # grep + header :contains "List-Id" "", + # gzip + header :contains "List-Id" "", + # hal + header :contains "List-Id" "", + # insight + header :contains "List-Id" "", + # gmp + header :contains "List-Id" "", + header :contains "List-Id" "", + header :contains "List-Id" "", + # k3b + header :contains "List-Id" "", + # kbd + header :contains "List-Id" "", + # libquicktime + header :contains "List-Id" "", + # libtirpc + header :contains "List-Id" "", + # Linux API + header :contains "List-Id" "", + # linux-man + header :contains "List-Id" "", + # lirc + header :contains "List-Id" "", + # LTP + header :contains "List-Id" "", + header :contains "List-Id" "", + # m3 + header :contains "To" "wagner@pint.elegosoft.com", + header :contains "Cc" "wagner@pint.elegosoft.com", + header :contains "To" "m3devel@elegosoft.com", + header :contains "Cc" "m3devel@elegosoft.com", + header :contains "To" "m3devel@birch.elego.de", + header :contains "Cc" "m3devel@birch.elego.de", + # metalog + header :contains "List-Id" "", + # mplayer + header :contains "To" "dvdnav-discuss@mplayerhq.hu", + header :contains "Cc" "dvdnav-discuss@mplayerhq.hu", + # module-init-tools + header :contains "List-Id" "", + # mpfr + header :contains "List-Id" "", + # mtools + header :contains "List-Id" "", + # nano + header :contains "List-Id" "", + # nasm + header :contains "List-Id" "", + # nbd + header :contains "List-Id" "", + # ncurses + header :contains "List-Id" "", + # net-tools + header :contains "List-Id" "", + # NFS + header :contains "List-Id" "", + header :contains "List-Id" "", + # ode + header :contains "List-Id" "", + header :contains "List-Id" "", + # Open Group + header :contains "X-Loop" "austin-group-l@opengroup.org", + # powertop + header :contains "List-Id" "", + # procps + header :contains "List-Id" "", + # patch + header :contains "List-Id" "", + # readline + header :contains "List-Id" "", + # reiserfs + header :contains "List-Id" "", + # rsync + header :contains "List-Id" "", + # SDL + header :contains "List-Id" "", + header :contains "List-Id" "", + # shadow + header :contains "List-Id" "", + header :contains "List-Id" "", + # sigrok + header :contains "List-Id" "", + # speex + header :contains "List-Id" "", + # sqlite + header :contains "List-Id" "", + # ssl + header :contains "Sender" "owner-openssl-dev@openssl.org", + # strace + header :contains "List-Id" "", + header :contains "To" "strace-devel@lists.sourceforge.net", + header :contains "Cc" "strace-devel@lists.sourceforge.net", + # sudo + header :contains "List-Id" "", + # syslinux + header :contains "List-Id" "", + # sysvinit-devel + header :contains "List-Id" "", + # tar + header :contains "List-Id" "", + # timezone + header :contains "List-Id" "", + # uClinux + header :contains "List-Id" "", + # udev + header :contains "List-Id" "", + # urjtag + header :contains "List-Id" "", + # util-linux + header :contains "X-Mailing-List" "util-linux@vger.kernel.org", + # wget + header :contains "List-Id" "", + # yasm + header :contains "List-Id" "", + # zlib + header :contains "List-Id" "", + header :contains "To" "zlib-devel@madler.net", + header :contains "Cc" "zlib-devel@madler.net" +) +{ + fileinto "misc projects"; + stop; +} + +# Project: uclibc +if anyof ( + header :contains "List-Id" "", + header :contains "List-Id" "", + header :contains "List-Id" "", + header :contains "To" "uclibc@uclibc.org", + header :contains "Cc" "uclibc@uclibc.org", + header :contains "To" "uclibc-cvs@uclibc.org", + header :contains "Cc" "uclibc-cvs@uclibc.org" +) +{ + fileinto "misc projects/uclibc"; + stop; +} + +# Project: busybox (after uClibc) +if anyof ( + header :contains "List-Id" "", + header :contains "List-Id" "", + header :contains "List-Id" "", + header :contains "To" "busybox@busybox.net", + header :contains "Cc" "busybox@busybox.net" +) +{ + fileinto "misc projects/busybox"; + stop; +} + +# buildroot (after uClibc) +if anyof ( + header :contains "List-Id" "", + header :contains "To" "buildroot@buildroot.org", + header :contains "Cc" "buildroot@buildroot.org" +) +{ + fileinto "misc projects/buildroot"; + stop; +} + + +# +# Toolchain +# +if anyof ( + header :contains "List-Id" "", + header :contains "List-Id" "", + header :contains "To" "gdb@sourceware.org", + header :contains "Cc" "gdb@sourceware.org", + header :contains "To" "gdb-patches@sourceware.org", + header :contains "Cc" "gdb-patches@sourceware.org" +) +{ + fileinto "misc projects/toolchain"; + + if anyof(body :text :contains "sim/") + { + setflag "G"; + } + stop; +} + +if anyof ( + # binutils + header :contains "List-Id" "", + header :contains "List-Post" "", + # ccache + header :contains "List-Id" "", + # elfutils + header :contains "List-Id" "", + header :contains "To" "elfutils-devel@lists.fedorahosted.org", + header :contains "Cc" "elfutils-devel@lists.fedorahosted.org", + # gcc + header :contains "List-Post" "", + # glibc + header :regex "List-Post" "", + header :regex "To" "libc-(alpha|help|locales|ports|stable)@sourceware\.org", + header :regex "Cc" "libc-(alpha|help|locales|ports|stable)@sourceware\.org", + # gnuconfig + header :contains "List-Id" "", + # newlib + header :contains "List-Post" "", + # qemu + header :contains "List-Post" "", + header :contains "To" "qemu-devel@nongnu.org", + header :contains "Cc" "qemu-devel@nongnu.org", + # sourceware + header :contains "List-Post" "", + header :contains "List-Post" "", + header :contains "From" "sourceware-bugzilla@sourceware.org", + # misc + header :contains "To" "libunwind-devel@nongnu.org", + header :contains "Cc" "libunwind-devel@nongnu.org" +) +{ + fileinto "misc projects/toolchain"; + stop; +} + + +# Project: E +if anyof ( + header :contains "List-Id" "", + header :contains "List-Id" "", + header :contains "List-Id" "" +) +{ + fileinto "misc projects/e"; + stop; +} + + +# Project: u-boot +if anyof ( + header :contains "List-Id" "", + header :contains "List-Id" "", + header :contains "To" "u-boot@lists.denx.de", + header :contains "Cc" "u-boot@lists.denx.de" +) +{ + fileinto "misc projects/u-boot"; + stop; +} + + +# +# Arches +# +if anyof ( + # Alpha + header :contains "List-Id" "", + # ARM + header :contains "List-Id" "", + header :contains "List-Id" "", + header :contains "List-Id" "", + header :contains "List-Id" "", + # Blackfin + header :contains "List-Id" "", + # s390 + header :contains "X-Mailing-List" "linux-s390@vger.kernel.org", + header :contains "List-Id" "", + header :contains "To" "linux-390@vm.marist.edu", + header :contains "Cc" "linux-390@vm.marist.edu", + # m68k + header :contains "List-Id" "linux-mac68k.lists.purplehat.net", + # parisc + header :contains "List-Id" "", + header :contains "List-Id" "", + # SuperH + header :contains "List-Id" "", + header :contains "List-Id" "", + header :contains "List-Id" "", + header :contains "List-Id" "" +) +{ + fileinto "misc projects/archs"; + stop; +} + + +# +# Gentoo +# + +# Gentoo: graphics +if anyof ( + header :contains "To" "graphics@gentoo.org", + header :contains "Cc" "graphics@gentoo.org" +) +{ + fileinto "gentoo.org/bugs/graphics"; + stop; +} + +# Gentoo: openrc +if anyof ( + header :contains "To" "openrc@gentoo.org", + header :contains "Cc" "openrc@gentoo.org" +) +{ + fileinto "gentoo.org/bugs/base-system/openrc"; + stop; +} + +# Gentoo: base-system +if anyof ( + header :contains "To" "base-system@gentoo.org", + header :contains "Cc" "base-system@gentoo.org" +) +{ + fileinto "gentoo.org/bugs/base-system"; + stop; +} + +# Gentoo: portage +if anyof ( + header :regex "To" "(dev|tools)-portage@gentoo\\.org", + header :regex "Cc" "(dev|tools)-portage@gentoo\\.org", + header :contains "List-Id" "" +) +{ + fileinto "gentoo.org/bugs/portage"; + stop; +} + +# Gentoo: portage utils +if anyof ( + header :contains "To" "portage-utils@gentoo.org", + header :contains "Cc" "portage-utils@gentoo.org" +) +{ + fileinto "gentoo.org/bugs/portage-utils"; + stop; +} + +# Gentoo: docs team +if anyof ( + header :contains "To" "docs-team@gentoo.org", + header :contains "Cc" "docs-team@gentoo.org", + header :contains "To" "gentoo-doc@lists.gentoo.org", + header :contains "Cc" "gentoo-doc@lists.gentoo.org" +) +{ + fileinto "gentoo.org/docs"; + stop; +} + +if allof (header :contains "From" "bugzilla-daemon@gentoo.org") +{ + # Bugzilla + + # Gentoo: toolchain/gcc-porting + if allof (header :regex "To" "(toolchain|gcc-porting)@gentoo\\.org") + { + fileinto "gentoo.org/bugs/toolchain"; + stop; + } + + # Gentoo: games + elsif allof (header :contains "To" "games@gentoo.org") + { + fileinto "gentoo.org/bugs/games"; + stop; + } + + # Gentoo: security bugzilla + elsif allof (header :contains "To" "security@gentoo.org") + { + fileinto "gentoo.org/bugs/hardened"; + stop; + } + + # Gentoo: bugzilla me + elsif allof (header :contains "To" "vapier@gentoo.org") + { + fileinto "gentoo.org/bugs/mine"; + stop; + } + + # Gentoo: arches + elsif allof (header :regex "To" "(alpha|amd64|arm|arm64|ia64|hppa|m68k|mips|ppc|ppc64|s390|sh|sparc|x86)@gentoo.org") + { + # stable/keyword req + if anyof(header :regex "X-Bugzilla-Keywords" "((KEYWORD|STABLE)REQ|TESTFAILURE)") + { + setflag "\\Seen"; + fileinto "gentoo.org/bugs/arches/noise"; + stop; + } + + # Gentoo: my herds + elsif anyof (header :regex "X-Bugzilla-Assigned-To" "(toolchain|security|base-system|games|sandbox)@gentoo.org") + { + setflag "\\Seen"; + fileinto "trash"; + stop; + } + } + + fileinto "gentoo.org/bugs"; + stop; +} + +# Gentoo: arches +if anyof ( + header :regex "To" "(alpha|amd64|arm|arm64|ia64|hppa|m68k|mips|ppc|ppc64|s390|sh|sparc|x86)@gentoo.org", + header :regex "Cc" "(alpha|amd64|arm|arm64|ia64|hppa|m68k|mips|ppc|ppc64|s390|sh|sparc|x86)@gentoo.org" +) +{ + fileinto "gentoo.org/bugs/arches"; + stop; +} + +# Gentoo: embedded +if anyof ( + header :contains "List-Id" "", + header :contains "To" "dev-embedded@gentoo.org", + header :contains "Cc" "dev-embedded@gentoo.org", + header :contains "To" "gentoo-mips@lists.gentoo.org", + header :contains "Cc" "gentoo-mips@lists.gentoo.org" +) +{ + fileinto "gentoo.org/embedded"; + stop; +} + +# Gentoo: -commits +if anyof (header :contains "List-Id" "") +{ + fileinto "gentoo.org/commits"; + stop; +} + +if anyof ( + # -project + header :contains "List-Id" "", + header :contains "List-Id" "", + header :contains "List-Id" "", + header :contains "To" "soc-mentors@gentoo.org", + header :contains "Cc" "soc-mentors@gentoo.org", + # gentoo-dev + header :contains "List-Id" "", + header :contains "List-Id" "", + header :contains "List-Id" "", + header :contains "From" "no-reply@socghop.appspotmail.com", + # gentoo-licenses + header :contains "List-Id" "", + # gentoo-qa + header :contains "List-Id" "" +) +{ + fileinto "gentoo.org/dev"; + stop; +} + +# Gentoo: github +if anyof (header :contains "List-ID" "") +{ + fileinto "gentoo.org/github"; + stop; +} + +# Gentoo: NFP +if anyof (header :contains "List-Id" "") +{ + fileinto "gentoo.org/nfp"; + stop; +} + +# Gentoo: -core +if anyof (header :contains "List-Id" "") +{ + fileinto "gentoo.org/core"; + stop; +} + +# Gentoo: toolchain [not bugs] +if allof (header :regex "To" "(toolchain|gcc-porting)@gentoo\\.org") +{ + fileinto "gentoo.org/bugs/toolchain/list"; + stop; +} + +# Gentoo: catalyst +if anyof (header :contains "List-Id" "") +{ + fileinto "gentoo.org"; + stop; +} + +# Gentoo: security +if anyof ( + header :contains "To" "security@gentoo.org", + header :contains "Cc" "security@gentoo.org", + header :contains "To" "gentoo-hardened@lists.gentoo.org", + header :contains "Cc" "gentoo-hardened@lists.gentoo.org", + header :contains "To" "gentoo-security@lists.gentoo.org", + header :contains "Cc" "gentoo-security@lists.gentoo.org" +) +{ + fileinto "gentoo.org/hardened"; + stop; +} + +# Gentoo: catchall +if anyof ( + header :contains "To" "vapier@gentoo.org", + header :contains "Cc" "vapier@gentoo.org", + header :contains "From" "vapier@gentoo.org", + # Moderator! + header :contains "To" "gentoo-dev-announce+moderators@lists.gentoo.org", + header :contains "Cc" "gentoo-dev-announce+moderators@lists.gentoo.org" +) +{ + fileinto "gentoo.org"; + stop; +} diff --git a/.config/mail/filters.test b/.config/mail/filters.test new file mode 100755 index 0000000..9d1b436 --- /dev/null +++ b/.config/mail/filters.test @@ -0,0 +1,31 @@ +#!/bin/bash +set -e +cd ~/.config/mail +if [ $# -eq 0 ] ; then + echo "ERROR: specify a message" + exit 1 +fi + +writable=false +args=() +case $1 in +-e) + args+=( -e ) + writable=true + shift + ;; +esac + +for f in "$@" ; do + echo "${f}" + grep ^Subject: "${f}" + sieve-test \ + -c dovecot-lda.conf \ + -x 'fileinto body regex imap4flags' \ + "${args[@]}" \ + filters.siv "${f}" + if [ $? -eq 0 ] && ${writable} ; then + rm "${f}" + fi + echo +done diff --git a/.config/mail/setup-symlinks b/.config/mail/setup-symlinks new file mode 100755 index 0000000..d947632 --- /dev/null +++ b/.config/mail/setup-symlinks @@ -0,0 +1,70 @@ +#!/usr/bin/python + +"""Glue Maildir++/dovecot to kmail""" + +from __future__ import print_function + +import os +import sys + + +def main(argv): + mail = os.path.expanduser('~/.mail') + for root, dirs, files in os.walk(mail): + try: + dirs.remove('cur') + dirs.remove('new') + dirs.remove('tmp') + except ValueError: + pass + + if not root.endswith('.directory'): + continue + + print(root, file=sys.stderr) + for d in dirs: + # We will start with: + # root = ~/.mail/.gentoo.org.directory/ + # d = buildroot + # So create symlinks: + # ~/.mail/gentoo.org/.buildroot -> ../.gentoo.org.directory/buildroot + + # ~/.mail/ + parent = os.path.dirname(root) + + # .gentoo.org.directory + maildir = os.path.basename(root) + if maildir[0] == '.': + continue + # ../.gentoo.org.directory/buildroot + target = os.path.join('..', maildir, d) + # gentoo.org + maildir = maildir[1:-10] + # ~/.mail/gentoo.org/.buildroot + source = os.path.join(parent, maildir, '.' + d) + + print('%s -> %s' % (source, target), file=sys.stderr) + if not os.path.islink(source): + os.symlink(target, source) + + fsdir = root[len(mail) + 1:] + parts = fsdir.split('/') + fsdir = '/'.join(parts[0:-1] + [parts[-1][1:-10]]) + ns_parts = [x[1:-10] for x in parts] + ns = '/'.join(ns_parts) + + extra = '' + if ns == 'inbox': + extra = '\n\tinbox = yes' + + print("""\ +namespace "%(ns)s" {%(extra)s + separator = / + prefix = "%(ns)s/" + location = "maildir:~/.mail/%(fsdir)s" +} +""" % {'ns': ns, 'fsdir': fsdir, 'extra': extra}) + + +if __name__ == '__main__': + sys.exit(main(sys.argv[1:])) diff --git a/.gitignore b/.gitignore index 7ca8ba5..4a3fffd 100644 --- a/.gitignore +++ b/.gitignore @@ -364,7 +364,6 @@ lock /.google_authenticator /.mail /.maildir -/.config/mail /.npm/ /.netrc .nfs* -- 2.39.2