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 -*-
5 base_excludes = ['delayed', 'outgoing', 'Trash', 'Queue', 'inbox', 'Spam', 'Sent', 'Drafts']
6 base_excludes_re = [ '[Ss]ent.*' ]
7 full_excludes_re = ['discard', 'spool', 'spam', 'store/.+']
8 prioritised = ['resubmit','drafts','inbox','ardex','kbkg','toni','tahi','debian','mtfk','admin','retrain']
9 deprioritised = ['discard','spam','store','spool']
11 def py_foldersort_main(x, y):
12 for prefix in prioritised:
13 if x.startswith(prefix):
15 elif y.startswith(prefix):
17 for prefix in deprioritised:
18 if x.startswith(prefix):
20 elif y.startswith(prefix):
22 return (x > y) - (x < y)
25 return re.sub('^INBOX', 'inbox', x)
27 def py_folderfilter_main(x):
28 if x in base_excludes:
31 elif re.search('^(' + '|'.join(base_excludes_re) + ')', x):
34 elif re.search('^(' + '|'.join(full_excludes_re) + ')', x):
39 def py_foldersort_bulk(x, y):
40 if x == 'spool': return -1
41 if y == 'spool': return 1
42 if x in ('discard', 'spam'): return 1
43 if y in ('discard', 'spam'): return -1
45 def py_folderfilter_bulk(x):
46 if re.search('^(' + '|'.join(full_excludes_re) + ')', x):
51 def py_folderfilter_mbnames(acct, x):
52 full_excludes_re_mbnames = ['retrain(/(sp|h)am)?$'] + full_excludes_re
53 return acct in ['madduck.net', 'madduck.net_bulk'] \
54 and not re.search('^(' + '|'.join(full_excludes_re_mbnames) + ')', x)