Add shell/mu
This commit is contained in:
parent
7ed6fbfe9f
commit
22a82f0cbf
49
shell/mu/.offlineimaprc
Normal file
49
shell/mu/.offlineimaprc
Normal file
|
@ -0,0 +1,49 @@
|
|||
[general]
|
||||
accounts = Lissner,Gmail
|
||||
pythonfile = ~/.dotfiles/shell/mu/offlineimaprc.py
|
||||
|
||||
[Account Gmail]
|
||||
localrepository = LocalGmail
|
||||
remoterepository = RepositoryGmail
|
||||
autorefresh = 5
|
||||
quick = 10
|
||||
postsynchook = mu index --maildir ~/.mail/gmail.com
|
||||
status_backend = sqlite
|
||||
|
||||
[Repository LocalGmail]
|
||||
type = Maildir
|
||||
localfolders = ~/.mail/gmail.com
|
||||
nametrans = nametrans
|
||||
|
||||
[Repository RepositoryGmail]
|
||||
type = Gmail
|
||||
remoteusereval = get_pass("gmail.com")["user"]
|
||||
remotepasseval = get_pass("gmail.com")["password"]
|
||||
folderfilter = folder_filter
|
||||
ssl = true
|
||||
sslcacertfile = /usr/local/etc/openssl/cert.pem # This will only work for macOS
|
||||
sslcacertfile = /etc/ssl/certs/ca-certificates.crt
|
||||
nametrans = nametrans_reverse
|
||||
|
||||
###
|
||||
[Account Lissner]
|
||||
localrepository = LocalLissner
|
||||
remoterepository = RepositoryLissner
|
||||
quick = 10
|
||||
postsynchook = mu index --maildir ~/.mail/lissner.net
|
||||
status_backend = sqlite
|
||||
|
||||
[Repository LocalLissner]
|
||||
type = Maildir
|
||||
localfolders = ~/.mail/lissner.net
|
||||
nametrans = nametrans
|
||||
|
||||
[Repository RepositoryLissner]
|
||||
type = Gmail
|
||||
remoteusereval = get_pass("lissner.net")["user"]
|
||||
remotepasseval = get_pass("lissner.net")["password"]
|
||||
folderfilter = folder_filter
|
||||
ssl = true
|
||||
sslcacertfile = /usr/local/etc/openssl/cert.pem # This will only work for macOS
|
||||
sslcacertfile = /etc/ssl/certs/ca-certificates.crt
|
||||
nametrans = nametrans_reverse
|
13
shell/mu/install
Executable file
13
shell/mu/install
Executable file
|
@ -0,0 +1,13 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
case "$OSTYPE" in
|
||||
darwin*)
|
||||
brew install offlineimap
|
||||
brew install mu --with-emacs
|
||||
;;
|
||||
linux*)
|
||||
if [[ -f /etc/arch-release ]]; then
|
||||
pacaur --needed --noconfirm -S offlineimap mu
|
||||
fi
|
||||
;;
|
||||
esac
|
24
shell/mu/offlineimaprc.py
Normal file
24
shell/mu/offlineimaprc.py
Normal file
|
@ -0,0 +1,24 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
from subprocess import check_output
|
||||
from re import sub
|
||||
|
||||
def get_pass(account):
|
||||
data = check_output("pass email/" + account, shell=True).splitlines()
|
||||
password = data[0]
|
||||
tmp = [x for x in data if x.startswith('address:')]
|
||||
user = ""
|
||||
if len(tmp) > 0:
|
||||
user = tmp[0].split(":", 1)[1]
|
||||
|
||||
return {"password": password, "user": user}
|
||||
|
||||
def folder_filter(name):
|
||||
return not (name in ['[Gmail]/Spam', '[Gmail]/Important', '[Gmail]/All Mail'] or
|
||||
name.startswith('[Airmail]'))
|
||||
|
||||
def nametrans(name):
|
||||
return sub('^(Starred|Sent Mail|Drafts|Trash|All Mail|Spam)$', '[Gmail]/\\1', name)
|
||||
|
||||
def nametrans_reverse(name):
|
||||
return sub('^(\[Gmail\]/)', '', name)
|
Loading…
Reference in a new issue