summaryrefslogtreecommitdiff
path: root/base/offlineimap
diff options
context:
space:
mode:
authorJesse Morgan <jesse@jesterpm.net>2013-01-09 16:45:04 -0800
committerJesse Morgan <morganjm@amazon.com>2013-01-09 16:45:04 -0800
commit4e52a7884016a776cbd46d67d09324f2d80a9dc6 (patch)
treed80730dbb51309a0e617b15b0725c1c1b8f13be4 /base/offlineimap
parentd6cdd193535b974a70071b992bcb44a5b9efe26e (diff)
Various changes to make offlineimap work better on my laptop.
Diffstat (limited to 'base/offlineimap')
-rw-r--r--base/offlineimap/.nolink0
-rw-r--r--base/offlineimap/helper.py26
2 files changed, 26 insertions, 0 deletions
diff --git a/base/offlineimap/.nolink b/base/offlineimap/.nolink
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/base/offlineimap/.nolink
diff --git a/base/offlineimap/helper.py b/base/offlineimap/helper.py
new file mode 100644
index 0000000..9cb94d8
--- /dev/null
+++ b/base/offlineimap/helper.py
@@ -0,0 +1,26 @@
+#!/usr/bin/python
+
+import os, subprocess,sys
+
+
+def mailpasswd(file):
+ path = os.getenv("HOME") + "/.offlineimap/" + file + ".gpg"
+ 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()