Merge pull request #56 from ruediger/passwd
* mu4e: ask for password only when used interactively, detect if buffer is nil
This commit is contained in:
@ -549,7 +549,7 @@ split-window."
|
|||||||
(switch-to-buffer buf)
|
(switch-to-buffer buf)
|
||||||
(set-window-dedicated-p win t)
|
(set-window-dedicated-p win t)
|
||||||
(erase-buffer)
|
(erase-buffer)
|
||||||
(insert "\n") ;; FIXME -- needed so output starts
|
(insert "\n") ;; FIXME -- needed so output starts
|
||||||
(mu4e-update-mail buf t))))
|
(mu4e-update-mail buf t))))
|
||||||
|
|
||||||
|
|
||||||
@ -683,21 +683,28 @@ Currently the filter only checks if the command asks for a password by matching
|
|||||||
Currently the filter only checks if the command asks for a password by matching
|
Currently the filter only checks if the command asks for a password by matching
|
||||||
the output against `mu4e~get-mail-password-regexp'. The messages are inserted
|
the output against `mu4e~get-mail-password-regexp'. The messages are inserted
|
||||||
into the process buffer."
|
into the process buffer."
|
||||||
(save-current-buffer
|
(save-current-buffer
|
||||||
|
(when (process-buffer proc)
|
||||||
(set-buffer (process-buffer proc)))
|
(set-buffer (process-buffer proc)))
|
||||||
(let ((inhibit-read-only t))
|
(let ((inhibit-read-only t))
|
||||||
;; Check whether process asks for a password and query user
|
;; Check whether process asks for a password and query user
|
||||||
(when (string-match mu4e~get-mail-password-regexp msg)
|
(when (string-match mu4e~get-mail-password-regexp msg)
|
||||||
(process-send-string proc (concat
|
(if (process-get proc 'x-interactive)
|
||||||
(read-passwd mu4e~get-mail-ask-password)
|
(process-send-string proc (concat
|
||||||
"\n")))
|
(read-passwd mu4e~get-mail-ask-password)
|
||||||
|
"\n"))
|
||||||
|
;; TODO kill process?
|
||||||
|
(error "Get-mail process requires a password but was not called interactively")))
|
||||||
|
(when (process-buffer proc)
|
||||||
(insert msg)))))
|
(insert msg)))))
|
||||||
|
|
||||||
(defun mu4e-update-mail (&optional buf interactive)
|
(defun mu4e-update-mail (&optional buf interactive)
|
||||||
"Update mail (retrieve using `mu4e-get-mail-command' and update
|
"Update mail (retrieve using `mu4e-get-mail-command' and update
|
||||||
the database afterwards), with output going to BUF if not nil, or
|
the database afterwards), with output going to BUF if not nil, or
|
||||||
discarded if nil. After retrieving mail, update the database. Note,
|
discarded if nil. After retrieving mail, update the database. Note,
|
||||||
function is asynchronous, returns (almost) immediately, and all the
|
function is asynchronous, returns (almost) immediately, and all the
|
||||||
|
processing takes part in the background, unless buf is non-nil.
|
||||||
|
If INTERACTIVE is not nil then the user might be asked for a
|
||||||
password."
|
password."
|
||||||
(unless mu4e-get-mail-command
|
(unless mu4e-get-mail-command
|
||||||
(mu4e-error "`mu4e-get-mail-command' is not defined"))
|
(mu4e-error "`mu4e-get-mail-command' is not defined"))
|
||||||
@ -720,6 +727,7 @@ processing takes part in the background, unless buf is non-nil."
|
|||||||
(sit-for 5))
|
(sit-for 5))
|
||||||
(mu4e~proc-index mu4e-maildir mu4e-my-email-addresses)
|
(mu4e~proc-index mu4e-maildir mu4e-my-email-addresses)
|
||||||
(when (buffer-live-p buf)
|
(when (buffer-live-p buf)
|
||||||
|
(kill-buffer buf)))))
|
||||||
(process-put proc 'x-interactive interactive)
|
(process-put proc 'x-interactive interactive)
|
||||||
(set-process-filter proc 'mu4e~process-filter)))
|
(set-process-filter proc 'mu4e~process-filter)))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user