From a52a2650aa43a27ea5dcd73a0e7aa0375233ef49 Mon Sep 17 00:00:00 2001
From: Amin Bandali <me@aminb.org>
Date: Fri, 2 Jan 2015 02:44:18 -0500
Subject: add offlineimap configurations

---
 offlineimap/.offlineimap.py | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)
 create mode 100644 offlineimap/.offlineimap.py

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()
-- 
cgit v1.2.3-60-g2f50