Merge from emacs--devo--0, emacs--rel--22
[gnus] / lisp / imap.el
index 27b4345..2ae3ce5 100644 (file)
@@ -440,6 +440,12 @@ The actual value is really the text on the continuation line.")
 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.'.")
+
 \f
 ;; Utility functions:
 
@@ -1153,7 +1159,7 @@ necessary.  If nil, the buffer name is generated."
 (defcustom imap-ping-server t
   "If non-nil, check if IMAP is open.
 See the function `imap-ping-server'."
-  :version "23.0" ;; No Gnus
+  :version "23.1" ;; No Gnus
   :group 'imap
   :type 'boolean)
 
@@ -1774,7 +1780,8 @@ is non-nil return these properties."
          (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 @@ first element, rest of list contain the saved articles' UIDs."
          (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))))
@@ -2923,6 +2931,7 @@ Return nil if no complete line has arrived."
          imap-open-1
          imap-open
          imap-opened
+         imap-ping-server
          imap-authenticate
          imap-close
          imap-capability
@@ -2996,5 +3005,5 @@ Return nil if no complete line has arrived."
 
 (provide 'imap)
 
-;;; arch-tag: 27369ed6-33e4-482f-96f1-8bb906ba70f7
+;; arch-tag: 27369ed6-33e4-482f-96f1-8bb906ba70f7
 ;;; imap.el ends here