From b8e124cf9f04774250a68ec4585c72b1ebd22ddd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Thu, 18 Aug 2016 00:02:08 +0200 Subject: Add suncemail and annoyme --- local/sbin/syncemail | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100755 local/sbin/syncemail (limited to 'local/sbin/syncemail') diff --git a/local/sbin/syncemail b/local/sbin/syncemail new file mode 100755 index 0000000..95deb7e --- /dev/null +++ b/local/sbin/syncemail @@ -0,0 +1,36 @@ +#!/usr/bin/python2 +# This starts offlineimap, but first it requests passwords from pass by user +# notification launching script at front. +import os +import sys +import subprocess +from offlineimap import OfflineImap + +frontscript = """ +echo "Asking for gpg password to access pass" 1>&2 +pass mail/cynerd@email.cz +echo "All done" 1>&2 +""" +annoyme = [ + os.path.expanduser("~/.local/sbin/annoyme-request"), + "syncemail", + "Imap email synchronization service password request." + ] + +anproc = subprocess.Popen(annoyme, stdin=subprocess.PIPE, + stdout=subprocess.PIPE) +anproc.stdin.write(frontscript) +anproc.stdin.close() +output = anproc.stdout.read().splitlines() +excode = anproc.wait() + +if excode != 0: + print("Authentication failed. Please start emailsync again") + sys.exit(1) +print(output) + +sys.argv.append('-k') +sys.argv.append('Repository_email-remote:remotepass=' + output[0]) + + +OfflineImap().run() -- cgit v1.2.3