mu4e-utils: Detect if update process asks for a password.

Offlineimap (or other mail fetchers) may query the user for a
password. This patch adds a process filter to the `mu4e-update-mail'
process and checks if the process asks for a password (Currently only
matches "^Remote: Enter password: $"). It then reads the password from
the user.

Signed-off-by: Rüdiger Sonderfeld <ruediger@c-plusplus.de>
This commit is contained in:
Rüdiger Sonderfeld 2012-08-24 13:20:44 +02:00
parent b034936271
commit 18aa453a3a
1 changed files with 10 additions and 1 deletions

View File

@ -709,7 +709,16 @@ processing takes part in the background, unless buf is non-nil."
(sit-for 5))
(mu4e~proc-index mu4e-maildir mu4e-my-email-addresses)
(when (buffer-live-p buf)
(kill-buffer buf)))))))
(kill-buffer buf)))))
(set-process-filter proc
(lambda (proc msg)
(save-current-buffer
(set-buffer (process-buffer proc))
(let ((inhibit-read-only t))
;; Check whether process asks for a password and query user
(when (string-match "^Remote: Enter password: $" msg)
(process-send-string proc (concat (read-passwd "Password: ") "\n")))
(insert msg)))))))