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.
1 # -*- coding: utf-8 -*-
3 import re, os, stat, time, atexit
5 base_excludes = ['delayed', 'outgoing', 'Trash', 'Sent', 'Queue']
6 full_excludes_re = ['discard', 'spool', 'spam', 'store\..+']
7 prioritised = ['outgoing','resubmit','drafts','inbox','ardex','debian','sudetia','admin','retrain']
8 deprioritised = ['discard','spam','store','spool']
10 def py_foldersort_main(x, y):
11 for prefix in prioritised:
12 if x.startswith(prefix):
14 elif y.startswith(prefix):
16 for prefix in deprioritised:
17 if x.startswith(prefix):
19 elif y.startswith(prefix):
23 def py_nametrans_main(x):
24 return re.sub('^INBOX', 'inbox', x)
26 def py_folderfilter_main(x):
27 if x in base_excludes:
30 elif re.search('^(' + '|'.join(full_excludes_re) + ')', x):
35 def py_foldersort_bulk(x, y):
36 if x == 'spool': return -1
37 if y == 'spool': return 1
38 if x in ('discard', 'spam'): return 1
39 if y in ('discard', 'spam'): return -1
41 def py_folderfilter_bulk(x):
42 if re.search('^(' + '|'.join(full_excludes_re) + ')', x):
47 def py_folderfilter_mbnames(acct, x):
48 full_excludes_re_mbnames = ['retrain/(sp|h)am'] + full_excludes_re
49 return acct in ['madduck.net', 'madduck.net-bulk'] \
50 and not re.search('^(' + '|'.join(full_excludes_re_mbnames) + ')', x)