diff lisp/net/imap.el @ 93820:7c273495693a

Merge from gnus--devo--0 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-1110
author Miles Bader <miles@gnu.org>
date Mon, 07 Apr 2008 13:08:33 +0000
parents d3767aa9ae49
children 1e3a407766b9
line wrap: on
line diff
--- a/lisp/net/imap.el	Mon Apr 07 11:11:28 2008 +0000
+++ b/lisp/net/imap.el	Mon Apr 07 13:08:33 2008 +0000
@@ -440,6 +440,12 @@
 The function should take two arguments, the first the IMAP tag and the
 second the status (OK, NO, BAD etc) of the command.")
 
+(defvar imap-enable-exchange-bug-workaround nil
+  "Send FETCH UID commands as *:* instead of *.
+Enabling this appears to be required for some servers (e.g.,
+Microsoft Exchange) which otherwise would trigger a response 'BAD
+The specified message set is invalid.'.")
+
 
 ;; Utility functions:
 
@@ -1774,7 +1780,8 @@
 	  (imap-message-data (make-vector 2 0)))
       (when (imap-mailbox-examine-1 mailbox)
 	(prog1
-	    (and (imap-fetch "*" "UID")
+	    (and (imap-fetch
+		  (if imap-enable-exchange-bug-workaround "*:*" "*") "UID")
 		 (list (imap-mailbox-get-1 'uidvalidity mailbox)
 		       (apply 'max (imap-message-map
 				    (lambda (uid prop) uid) 'UID))))
@@ -1818,7 +1825,8 @@
 	  (imap-message-data (make-vector 2 0)))
       (when (imap-mailbox-examine-1 mailbox)
 	(prog1
-	    (and (imap-fetch "*" "UID")
+	    (and (imap-fetch
+		  (if imap-enable-exchange-bug-workaround "*:*" "*") "UID")
 		 (list (imap-mailbox-get-1 'uidvalidity mailbox)
 		       (apply 'max (imap-message-map
 				    (lambda (uid prop) uid) 'UID))))