summaryrefslogtreecommitdiff
path: root/credentials/imappwd.py
diff options
context:
space:
mode:
Diffstat (limited to 'credentials/imappwd.py')
-rwxr-xr-xcredentials/imappwd.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/credentials/imappwd.py b/credentials/imappwd.py
new file mode 100755
index 0000000..8570a5f
--- /dev/null
+++ b/credentials/imappwd.py
@@ -0,0 +1,11 @@
+import os.path
+import subprocess
+home = os.path.expanduser("~")
+def mailpasswd(acct):
+ acct = os.path.basename(acct)
+ path = "%s/.config/mutt/credentials/%s.gpg" % (home,acct)
+ args = ["gpg", "--use-agent", "--quiet", "--batch", "-d", path]
+ try:
+ return subprocess.check_output(args).strip()
+ except subprocess.CalledProcessError:
+ return ""