summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmin Bandali <me@aminb.org>2015-01-02 02:44:18 -0500
committerAmin Bandali <me@aminb.org>2015-01-02 02:44:18 -0500
commita52a2650aa43a27ea5dcd73a0e7aa0375233ef49 (patch)
tree5a86dabadc45a2aa57352fa1a7e84d16c33b13d8
parent7d53cf498c3641fbf54f1859f975286521a99f9e (diff)
downloadconfigs-a52a2650aa43a27ea5dcd73a0e7aa0375233ef49.tar.gz
configs-a52a2650aa43a27ea5dcd73a0e7aa0375233ef49.tar.xz
configs-a52a2650aa43a27ea5dcd73a0e7aa0375233ef49.zip
add offlineimap configurations
Diffstat (limited to '')
-rw-r--r--offlineimap/.offlineimap.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/offlineimap/.offlineimap.py b/offlineimap/.offlineimap.py
new file mode 100644
index 0000000..23ba11c
--- /dev/null
+++ b/offlineimap/.offlineimap.py
@@ -0,0 +1,25 @@
+import os
+import subprocess
+
+def mailpasswd(acct):
+ acct = os.path.basename(acct)
+ path = "/home/amin/.passwd/%s.gpg" % acct
+ args = ["gpg", "--use-agent", "--quiet", "--batch", "-d", path]
+ try:
+ return subprocess.check_output(args).strip()
+ except subprocess.CalledProcessError:
+ return ""
+
+def prime_gpg_agent():
+ ret = False
+ i = 1
+ while not ret:
+ ret = (mailpasswd("prime") == "prime")
+ if i > 2:
+ from offlineimap.ui import getglobalui
+ sys.stderr.write("Error reading in passwords. Terminating.\n")
+ getglobalui().terminate()
+ i += 1
+ return ret
+
+prime_gpg_agent()