From 3b36c17e9d67d74a8bc50e7a53a23da7d5f94e22 Mon Sep 17 00:00:00 2001 From: Miles Bader Date: Thu, 5 Feb 2009 02:34:34 +0000 Subject: Merge from gnus--devo--0 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-1537 --- lisp/net/imap.el | 44 +++++++++++++++++++++++++++++--------------- lisp/net/netrc.el | 21 ++++++++++++++++----- 2 files changed, 45 insertions(+), 20 deletions(-) (limited to 'lisp/net') diff --git a/lisp/net/imap.el b/lisp/net/imap.el index 6f2b2d11f9..88e897fa32 100644 --- a/lisp/net/imap.el +++ b/lisp/net/imap.el @@ -1798,25 +1798,38 @@ However, UIDS here is a cons, where the car is the canonical form of the UIDS specification, and the cdr is the one which works with Exchange 2007 or, potentially, other buggy servers. See `imap-enable-exchange-bug-workaround'." - ;; We don't unconditionally use the alternative (valid) form, since - ;; this is said to be significantly inefficient. The first time we - ;; get here for a given, we'll try the canonical form. If we get - ;; the known error from the buggy server, set the flag - ;; buffer-locally (to account for connections to multiple servers), - ;; then re-try with the alternative UIDS spec. + ;; The first time we get here for a given, we'll try the canonical + ;; form. If we get the known error from the buggy server, set the + ;; flag buffer-locally (to account for connections to multiple + ;; servers), then re-try with the alternative UIDS spec. We don't + ;; unconditionally use the alternative form, since the + ;; currently-used alternatives are seriously inefficient with some + ;; servers (although they are valid). + ;; + ;; FIXME: Maybe it would be cleaner to have a flag to not signal + ;; the error (which otherwise gives a message), and test + ;; `imap-failed-tags'. Also, Other IMAP clients use other forms of + ;; request which work with Exchange, e.g. Claws does "UID FETCH 1:* + ;; (UID)" rather than "FETCH UID 1,*". Is there a good reason not + ;; to do the same? (condition-case data - (imap-fetch (if imap-enable-exchange-bug-workaround - (cdr uids) - (car uids)) - props receive nouidfetch buffer) + ;; Binding `debug-on-error' allows us to get the error from + ;; `imap-parse-response' -- it's normally caught by Emacs around + ;; execution of a process filter. + (let ((debug-on-error t)) + (imap-fetch (if imap-enable-exchange-bug-workaround + (cdr uids) + (car uids)) + props receive nouidfetch buffer)) (error (if (and (not imap-enable-exchange-bug-workaround) - (string-match - "The specified message set is invalid" - (cadr data))) + ;; This is the Exchange 2007 response. It may be more + ;; robust just to check for a BAD response to the + ;; attempted fetch. + (string-match "The specified message set is invalid" + (cadr data))) (with-current-buffer (or buffer (current-buffer)) - (set (make-local-variable - 'imap-enable-exchange-bug-workaround) + (set (make-local-variable 'imap-enable-exchange-bug-workaround) t) (imap-fetch (cdr uids) props receive nouidfetch)) (signal (car data) (cdr data)))))) @@ -3027,6 +3040,7 @@ Return nil if no complete line has arrived." imap-list-to-message-set imap-fetch-asynch imap-fetch + imap-fetch-safe imap-message-put imap-message-get imap-message-map diff --git a/lisp/net/netrc.el b/lisp/net/netrc.el index 9c7f0176ef..80ae1b57ba 100644 --- a/lisp/net/netrc.el +++ b/lisp/net/netrc.el @@ -158,11 +158,22 @@ MODE can be \"login\" or \"password\", suitable for passing to (ports (or ports '(nil))) (defaults (or defaults '(nil))) info) - (dolist (machine machines) - (dolist (default defaults) - (dolist (port ports) - (let ((alist (netrc-machine authinfo-list machine port default))) - (setq info (or (netrc-get alist mode) info)))))) + (if (listp mode) + (setq info + (mapcar + (lambda (mode-element) + (netrc-machine-user-or-password + mode-element + authinfo-list + machines + ports + defaults)) + mode)) + (dolist (machine machines) + (dolist (default defaults) + (dolist (port ports) + (let ((alist (netrc-machine authinfo-list machine port default))) + (setq info (or (netrc-get alist mode) info))))))) info)) (defun netrc-get (alist type) -- cgit v1.2.3