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','phd','ul','debian','sudetia','admin','retrain']
8 deprioritised = ['discard','spam','store','spool']
10 def py_foldersort_seamus(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_seamus(x):
24 return re.sub('^INBOX', 'inbox', x)
26 def should_do_full_sync():
27 FILE = os.path.expanduser('~/.var/offlineimap/lastrun')
29 now = int(time.time())
32 since = now - os.stat(FILE)[stat.ST_MTIME]
37 file(FILE, 'wb').close()
40 print 'Partial sync; next full sync in %d seconds...' \
44 do_full_sync = should_do_full_sync()
45 def py_folderfilter_seamus(x):
48 return x not in base_excludes
50 if x in base_excludes:
52 if x in ('spool', 'discard', 'spam'):
54 if re.search('^store(\..+)?', x):
58 def py_folderfilter_mbnames(acct, x):
59 full_excludes_re_mbnames = ['retrain/(sp|h)am'] + full_excludes_re
60 return acct in ['seamus.madduck.net'] \
61 and not re.search('^(' + '|'.join(full_excludes_re_mbnames) + ')', x)