[spacemacs] use ZNC.el for irc (wraps around erc)
[~bandali/configs] / offlineimap / .offlineimap.py
CommitLineData
a52a2650
AB
1import os
2import subprocess
3
4def mailpasswd(acct):
5 acct = os.path.basename(acct)
6 path = "/home/amin/.passwd/%s.gpg" % acct
7 args = ["gpg", "--use-agent", "--quiet", "--batch", "-d", path]
8 try:
9 return subprocess.check_output(args).strip()
10 except subprocess.CalledProcessError:
11 return ""
12
51547bf2
AB
13def mailuser(acct):
14 acct = os.path.basename(acct)
15 path = "/home/amin/.passwd/%s" % acct
16 args = ["cat", path]
17 try:
18 return subprocess.check_output(args).strip()
19 except subprocess.CalledProcessError:
20 return ""
21
a52a2650
AB
22def prime_gpg_agent():
23 ret = False
24 i = 1
25 while not ret:
26 ret = (mailpasswd("prime") == "prime")
27 if i > 2:
28 from offlineimap.ui import getglobalui
29 sys.stderr.write("Error reading in passwords. Terminating.\n")
30 getglobalui().terminate()
31 i += 1
32 return ret
33
34prime_gpg_agent()