;; This file is part of GNU Emacs.
-;; GNU Emacs is free software; you can redistribute it and/or modify
+;; GNU Emacs is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 3, or (at your option)
-;; any later version.
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-;; Boston, MA 02110-1301, USA.
+;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
(eval-when-compile (require 'cl))
+(eval-and-compile
+ (autoload 'auth-source-user-or-password "auth-source"))
+
(nnoo-declare nnimap)
(defconst nnimap-version "nnimap 1.0")
lines (imap-body-lines (imap-message-body imap-current-message))
chars (imap-message-get imap-current-message 'RFC822.SIZE)))
(nnheader-insert-nov
- (with-temp-buffer
+ ;; At this stage, we only have bytes, so let's use unibyte buffers
+ ;; to make it more clear.
+ (mm-with-unibyte-buffer
(buffer-disable-undo)
(insert headers)
(let ((head (nnheader-parse-naked-head uid)))
(port (if nnimap-server-port
(int-to-string nnimap-server-port)
"imap"))
- (user (netrc-machine-user-or-password
- "login"
- list
- (list server
- (or nnimap-server-address
- nnimap-address))
- (list port)
- (list "imap" "imaps" "143" "993")))
- (passwd (netrc-machine-user-or-password
- "password"
- list
- (list server
- (or nnimap-server-address
- nnimap-address))
- (list port)
- (list "imap" "imaps" "143" "993"))))
+ (user (or
+ (auth-source-user-or-password "login" server port) ; this is preferred to netrc-*
+ (netrc-machine-user-or-password
+ "login"
+ list
+ (list server
+ (or nnimap-server-address
+ nnimap-address))
+ (list port)
+ (list "imap" "imaps" "143" "993"))))
+ (passwd (or
+ (auth-source-user-or-password "password" server port) ; this is preferred to netrc-*
+ (netrc-machine-user-or-password
+ "password"
+ list
+ (list server
+ (or nnimap-server-address
+ nnimap-address))
+ (list port)
+ (list "imap" "imaps" "143" "993")))))
(if (imap-authenticate user passwd nnimap-server-buffer)
(prog2
(setq nnimap-server-buffer-alist
;; request the article only when the move is NOT internal
(and (or move-is-internal
(nnimap-request-article article group server))
- (save-excursion
- (set-buffer buf)
+ (with-current-buffer buf
(buffer-disable-undo (current-buffer))
(insert-buffer-substring nntp-server-buffer)
(setq result (eval accept-form))