shell/mu: update .offlineimaprc + lib.py

This commit is contained in:
Henrik Lissner 2017-04-18 23:18:28 -04:00
parent 30e7f6f9c9
commit 78104d802f
2 changed files with 11 additions and 14 deletions

View file

@ -11,10 +11,11 @@ fsync = False
localrepository = LocalGmail localrepository = LocalGmail
remoterepository = RepositoryGmail remoterepository = RepositoryGmail
postsynchook = mu index --maildir ~/.mail postsynchook = mu index --maildir ~/.mail
status_backend = sqlite synclabels = yes
labelsheader = X-Keywords
[Repository LocalGmail] [Repository LocalGmail]
type = Maildir type = GmailMaildir
localfolders = ~/.mail/gmail.com localfolders = ~/.mail/gmail.com
nametrans = nametrans nametrans = nametrans
@ -34,10 +35,11 @@ nametrans = nametrans_reverse
localrepository = LocalLissner localrepository = LocalLissner
remoterepository = RepositoryLissner remoterepository = RepositoryLissner
postsynchook = mu index --maildir ~/.mail postsynchook = mu index --maildir ~/.mail
status_backend = sqlite synclabels = yes
labelsheader = X-Keywords
[Repository LocalLissner] [Repository LocalLissner]
type = Maildir type = GmailMaildir
localfolders = ~/.mail/lissner.net localfolders = ~/.mail/lissner.net
nametrans = nametrans nametrans = nametrans

View file

@ -2,7 +2,6 @@
from subprocess import check_output from subprocess import check_output
from re import sub from re import sub
import sys
def get_pass(account): def get_pass(account):
data = check_output("/usr/bin/pass email/" + account, shell=True).splitlines() data = check_output("/usr/bin/pass email/" + account, shell=True).splitlines()
@ -15,18 +14,14 @@ def get_pass(account):
return {"password": password, "user": user} return {"password": password, "user": user}
def folder_filter(name): def folder_filter(name):
return not (name in ['[Gmail]/Spam', return not (name in ['INBOX',
'[Gmail]/Spam',
'[Gmail]/Important', '[Gmail]/Important',
'[Gmail]/Starred', '[Gmail]/Starred'] or
'[Gmail]/All Mail'] or
name.startswith('[Airmail]')) name.startswith('[Airmail]'))
def nametrans(name): def nametrans(name):
return sub('^INBOX/(Starred|Sent Mail|Drafts|Trash|All Mail|Spam)$', '[Gmail]/\\1', name) return sub('^(Starred|Sent Mail|Drafts|Trash|All Mail|Spam)$', '[Gmail]/\\1', name)
def nametrans_reverse(name): def nametrans_reverse(name):
return sub('^(\[Gmail\])', 'INBOX.', name) return sub('^(\[Gmail\]/)', '', name)
if __name__ == '__main__':
print(get_pass(sys.argv[1].strip())['password'])