X-Git-Url: https://git.rmz.io/dotfiles.git/blobdiff_plain/e8a6cf2a1c5ab04da7f837ff863165782293bb4a..c3a03e540dae7adafed0124b1a83c63436b597d7:/bin/offlineimap_utils.py diff --git a/bin/offlineimap_utils.py b/bin/offlineimap_utils.py new file mode 100644 index 0000000..3f21e66 --- /dev/null +++ b/bin/offlineimap_utils.py @@ -0,0 +1,41 @@ +import re + +mapping = { 'INBOX': 'inbox' + , '[Google Mail]/All Mail': 'all_mail' + , '[Google Mail]/Drafts': 'drafts' + , '[Google Mail]/Important': 'important' + , '[Google Mail]/Sent Mail': 'sent' + , '[Google Mail]/Spam': 'spam' + , '[Google Mail]/Starred': 'flagged' + , '[Google Mail]/Bin': 'bin' + } + +r_mapping = { val: key for key, val in mapping.items() } + +def transremote(foldername): + return mapping.get(foldername, foldername) + +def translocal(foldername): + return r_mapping.get(foldername, foldername) + +top = [ 'inbox' + , 'chakra' + , 'unimaas' + , 'clementine' + , 'youtube' + , 'hotmail' + ] + +bot = [ 'flagged' + , 'drafts' + , 'spam' + , 'bin' + ] + +def sort_key(d): + folder = d['foldername'] + if folder in top: + return top.index(folder) + elif folder in bot: + return 21 + bot.index(folder) + return 20