Skip to content

Commit

Permalink
offlineimap config
Browse files Browse the repository at this point in the history
  • Loading branch information
rodjek committed Oct 17, 2012
1 parent 9949fd3 commit 3be8a6e
Show file tree
Hide file tree
Showing 3 changed files with 89 additions and 0 deletions.
Empty file added .mail/.placeholder
Empty file.
16 changes: 16 additions & 0 deletions .mutt/offlineimap.py
@@ -0,0 +1,16 @@
#!/usr/bin/python
import re, subprocess
def get_keychain_pass(account=None, server=None):
params = {
'security': '/usr/bin/security',
'command': 'find-internet-password',
'account': account,
'server': server,
'keychain': '/Users/tsharpe/Library/Keychains/login.keychain',
}
command = "sudo -u tsharpe %(security)s -v %(command)s -g -a %(account)s -s %(server)s %(keychain)s" % params
output = subprocess.check_output(command, shell=True, stderr=subprocess.STDOUT)
outtext = [l for l in output.splitlines()
if l.startswith('password: ')][0]

return re.match(r'password: "(.*)"', outtext).group(1)
73 changes: 73 additions & 0 deletions .offlineimaprc
@@ -0,0 +1,73 @@
[general]
ui = ttyui
accounts = Personal, GitHub
pythonfile = ~/.mutt/offlineimap.py
fsync = False
maxsyncaccounts = 2
postsynchook = /opt/boxen/homebrew/bin/notmuch new

[Account Personal]
localrepository = Personal-Local
remoterepository = Personal-Remote
status_backend = sqlite

[Account GitHub]
localrepository = GitHub-Local
remoterepository = GitHub-Remote
status_backend = sqlite

[Repository Personal-Local]
type = Maildir
localfolders = ~/.mail/personal
nametrans = lambda folder: {'drafts': '[Gmail]/Drafts',
'sent': '[Gmail]/Sent Mail',
'flagged': '[Gmail]/Starred',
'trash': '[Gmail]/Trash',
'archive': '[Gmail]/All Mail',
}.get(folder, folder)

[Repository GitHub-Local]
type = Maildir
localfolders = ~/.mail/github
nametrans = lambda folder: {'drafts': '[Gmail]/Drafts',
'sent': '[Gmail]/Sent Mail',
'flagged': '[Gmail]/Starred',
'trash': '[Gmail]/Trash',
'archive': '[Gmail]/All Mail',
}.get(folder, folder)

[Repository Personal-Remote]
maxconnections = 1
type = Gmail
remoteuser = tim@sharpe.id.au
remotepasseval = get_keychain_pass(account="tim@sharpe.id.au", server="imap.gmail.com")
realdelete = no
nametrans = lambda folder: {'[Gmail]/Drafts': 'drafts',
'[Gmail]/Sent Mail': 'sent',
'[Gmail]/Starred': 'flagged',
'[Gmail]/Trash': 'trash',
'[Gmail]/All Mail': 'archive',
}.get(folder, folder)
folderfilter = lambda folder: folder not in ['[Gmail]/Trash',
'[Gmail]/Important',
'[Gmail]/Spam',
]
cert_fingerprint = 6d1b5b5ee0180ab493b71d3b94534b5ab937d042

[Repository GitHub-Remote]
maxconnections = 1
type = Gmail
remoteuser = tim@github.com
remotepasseval = get_keychain_pass(account="tim@github.com", server="imap.gmail.com")
realdelete = no
nametrans = lambda folder: {'[Gmail]/Drafts': 'drafts',
'[Gmail]/Sent Mail': 'sent',
'[Gmail]/Starred': 'flagged',
'[Gmail]/Trash': 'trash',
'[Gmail]/All Mail': 'archive',
}.get(folder, folder)
folderfilter = lambda folder: folder not in ['[Gmail]/Trash',
'[Gmail]/Important',
'[Gmail]/Spam',
]
cert_fingerprint = 6d1b5b5ee0180ab493b71d3b94534b5ab937d042

0 comments on commit 3be8a6e

Please sign in to comment.