X-Git-Url: http://cgit.sxemacs.org/?a=blobdiff_plain;f=lisp%2Fnnimap.el;h=49166b8de825aa37cf6edf306cf609d673be75b2;hb=163d2723fd89f24a594c766b34163c25c3fd2d28;hp=716fbaa40a13ed78a32cedd3f701708d9ab620e5;hpb=111c6d10d7db5882238eddee1339638aa3a8ff2c;p=gnus diff --git a/lisp/nnimap.el b/lisp/nnimap.el index 716fbaa40..49166b8de 100644 --- a/lisp/nnimap.el +++ b/lisp/nnimap.el @@ -1,7 +1,7 @@ ;;; nnimap.el --- imap backend for Gnus -;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, -;; 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, +;; 2007, 2008 Free Software Foundation, Inc. ;; Author: Simon Josefsson ;; Jim Radford @@ -9,20 +9,18 @@ ;; 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 . ;;; Commentary: @@ -73,6 +71,8 @@ (eval-when-compile (require 'cl)) +(autoload 'auth-source-user-or-password "auth-source") + (nnoo-declare nnimap) (defconst nnimap-version "nnimap 1.0") @@ -424,8 +424,8 @@ restrict visible folders.") (defcustom nnimap-id nil "Plist with client identity to send to server upon login. -Nil means no information is sent, symbol `no' to disable ID query -alltogheter, or plist with identifier-value pairs to send to +A nil value means no information is sent, symbol `no' to disable ID query +altogether, or plist with identifier-value pairs to send to server. RFC 2971 describes the list as follows: Any string may be sent as a field, but the following are defined to @@ -617,7 +617,9 @@ If EXAMINE is non-nil the group is selected read-only." 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))) @@ -796,22 +798,26 @@ If EXAMINE is non-nil the group is selected read-only." (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 @@ -1553,8 +1559,7 @@ function is generally only called when Gnus is shutting down." ;; 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)) @@ -1603,6 +1608,8 @@ function is generally only called when Gnus is shutting down." (deffoo nnimap-request-delete-group (group force &optional server) (when (nnimap-possibly-change-server server) + (when (string= group (imap-current-mailbox nnimap-server-buffer)) + (imap-mailbox-unselect nnimap-server-buffer)) (with-current-buffer nnimap-server-buffer (if force (or (null (imap-mailbox-status group 'uidvalidity))