Index: mail-source.el =================================================================== RCS file: /usr/local/cvsroot/gnus/lisp/mail-source.el,v retrieving revision 7.26 diff -r7.26 mail-source.el 38a39,40 > (autoload 'netrc-parse "netrc") > (autoload 'netrc-machine-user-or-password "netrc") 339a342,348 > (defcustom mail-source-authinfo-file nil > "Authinfo file. > When set, it will override :user and :password for a mail source > if that source's server is set in the authinfo file. See netrc.el" > :group 'mail-source > :type 'file) > 1017,1077c1026,1045 < (mail-source-run-script < prescript (format-spec-make ?p password ?t mail-source-crash-box < ?s server ?P port ?u user) < prescript-delay) < (let ((from (format "%s:%s:%s" server user port)) < (found 0) < (buf (generate-new-buffer " *imap source*")) < (mail-source-string (format "imap:%s:%s" server mailbox)) < (imap-shell-program (or (list program) imap-shell-program)) < remove) < (if (and (imap-open server port stream authentication buf) < (imap-authenticate < user (or (cdr (assoc from mail-source-password-cache)) < password) buf) < (imap-mailbox-select mailbox nil buf)) < (let ((coding-system-for-write mail-source-imap-file-coding-system) < str) < (with-temp-file mail-source-crash-box < ;; Avoid converting 8-bit chars from inserted strings to < ;; multibyte. < (mm-disable-multibyte) < ;; remember password < (with-current-buffer buf < (when (and imap-password < (not (assoc from mail-source-password-cache))) < (push (cons from imap-password) mail-source-password-cache))) < ;; if predicate is nil, use all uids < (dolist (uid (imap-search (or predicate "1:*") buf)) < (when (setq str < (if (imap-capability 'IMAP4rev1 buf) < (caddar (imap-fetch uid "BODY.PEEK[]" < 'BODYDETAIL nil buf)) < (imap-fetch uid "RFC822.PEEK" 'RFC822 nil buf))) < (push uid remove) < (insert "From imap " (current-time-string) "\n") < (save-excursion < (insert str "\n\n")) < (while (let ((case-fold-search nil)) < (re-search-forward "^From " nil t)) < (replace-match ">From ")) < (goto-char (point-max)))) < (nnheader-ms-strip-cr)) < (incf found (mail-source-callback callback server)) < (mail-source-delete-crash-box) < (when (and remove fetchflag) < (setq remove (nreverse remove)) < (imap-message-flags-add < (imap-range-to-message-set (gnus-compress-sequence remove)) < fetchflag nil buf)) < (if dontexpunge < (imap-mailbox-unselect buf) < (imap-mailbox-close nil buf)) < (imap-close buf)) < (imap-close buf) < ;; We nix out the password in case the error < ;; was because of a wrong password being given. < (setq mail-source-password-cache < (delq (assoc from mail-source-password-cache) < mail-source-password-cache)) < (error "IMAP error: %s" (imap-error-text buf))) < (kill-buffer buf) --- > (let* ((list ((when mail-source-authinfo-file > (gnus-message 7 "Parsing authinfo file `%s'." > mail-source-authinfo-file) > (netrc-parse mail-source-authinfo-file)))) > (user (if mail-source-authinfo-file > (netrc-machine-user-or-password > "login" > list > (list server) > (list port) > (list "imap" "imaps")) > user)) > (password (if mail-source-authinfo-file > (netrc-machine-user-or-password > "password" > list > (list server) > (list port) > (list "imap" "imaps")) > password))) 1079,1082c1047,1111 < postscript < (format-spec-make ?p password ?t mail-source-crash-box < ?s server ?P port ?u user)) < found))) --- > prescript (format-spec-make ?p password ?t mail-source-crash-box > ?s server ?P port ?u user) > prescript-delay) > (let ((from (format "%s:%s:%s" server user port)) > (found 0) > (buf (generate-new-buffer " *imap source*")) > (mail-source-string (format "imap:%s:%s" server mailbox)) > (imap-shell-program (or (list program) imap-shell-program)) > remove) > (if (and (imap-open server port stream authentication buf) > (imap-authenticate > user (or (cdr (assoc from mail-source-password-cache)) > password) buf) > (imap-mailbox-select mailbox nil buf)) > (let ((coding-system-for-write mail-source-imap-file-coding-system) > str) > (with-temp-file mail-source-crash-box > ;; Avoid converting 8-bit chars from inserted strings to > ;; multibyte. > (mm-disable-multibyte) > ;; remember password > (with-current-buffer buf > (when (and imap-password > (not (assoc from mail-source-password-cache))) > (push (cons from imap-password) mail-source-password-cache))) > ;; if predicate is nil, use all uids > (dolist (uid (imap-search (or predicate "1:*") buf)) > (when (setq str > (if (imap-capability 'IMAP4rev1 buf) > (caddar (imap-fetch uid "BODY.PEEK[]" > 'BODYDETAIL nil buf)) > (imap-fetch uid "RFC822.PEEK" 'RFC822 nil buf))) > (push uid remove) > (insert "From imap " (current-time-string) "\n") > (save-excursion > (insert str "\n\n")) > (while (let ((case-fold-search nil)) > (re-search-forward "^From " nil t)) > (replace-match ">From ")) > (goto-char (point-max)))) > (nnheader-ms-strip-cr)) > (incf found (mail-source-callback callback server)) > (mail-source-delete-crash-box) > (when (and remove fetchflag) > (setq remove (nreverse remove)) > (imap-message-flags-add > (imap-range-to-message-set (gnus-compress-sequence remove)) > fetchflag nil buf)) > (if dontexpunge > (imap-mailbox-unselect buf) > (imap-mailbox-close nil buf)) > (imap-close buf)) > (imap-close buf) > ;; We nix out the password in case the error > ;; was because of a wrong password being given. > (setq mail-source-password-cache > (delq (assoc from mail-source-password-cache) > mail-source-password-cache)) > (error "IMAP error: %s" (imap-error-text buf))) > (kill-buffer buf) > (mail-source-run-script > postscript > (format-spec-make ?p password ?t mail-source-crash-box > ?s server ?P port ?u user)) > found))))