2008-04-02 Simon Josefsson <simon@josefsson.org>
authorSimon Josefsson <jas@extundo.com>
Wed, 2 Apr 2008 14:46:57 +0000 (14:46 +0000)
committerSimon Josefsson <jas@extundo.com>
Wed, 2 Apr 2008 14:46:57 +0000 (14:46 +0000)
* imap.el (imap-enable-exchange-bug-workaround): New variable.
(imap-message-copyuid-1): Use it.
(imap-message-appenduid-1): Likewise.  Based on patch by Nathan
J. Williams in
<http://permalink.gmane.org/gmane.emacs.gnus.general/65855>.

* nnimap.el (nnimap-enable-minmax-bug-workaround): Remove, replaced by
imap-enable-exchange-bug-workaround.
(nnimap-find-minmax-uid): Use imap-enable-exchange-bug-workaround.

lisp/ChangeLog
lisp/imap.el
lisp/nnimap.el

index d51c5c8..99f389b 100644 (file)
@@ -1,3 +1,15 @@
+2008-04-02  Simon Josefsson  <simon@josefsson.org>
+
+       * imap.el (imap-enable-exchange-bug-workaround): New variable.
+       (imap-message-copyuid-1): Use it.
+       (imap-message-appenduid-1): Likewise.  Based on patch by Nathan
+       J. Williams in
+       <http://permalink.gmane.org/gmane.emacs.gnus.general/65855>.
+
+       * nnimap.el (nnimap-enable-minmax-bug-workaround): Remove, replaced by
+       imap-enable-exchange-bug-workaround.
+       (nnimap-find-minmax-uid): Use imap-enable-exchange-bug-workaround.
+
 2008-04-01  Simon Josefsson  <simon@josefsson.org>
 
        * nnimap.el (nnimap-find-minmax-uid): Revert last fix, the "fix" turns
index 399d5ec..9e3d0a9 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:
 
@@ -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))))
index 483b45e..716fbaa 100644 (file)
@@ -219,19 +219,6 @@ will be downloaded."
 
 ;; Performance / bug workaround variables
 
-(defcustom nnimap-enable-minmax-bug-workaround nil
-  "Send UID FETCH UID commands as 1:* instead of 1,*.
-Enabling this appears to be required for some servers (e.g.,
-Exchange) which otherwise would trigger a response 'BAD The
-specified message set is invalid.'.
-Note that enabling this work around may cause significant
-performance penalties if you have large mailboxes.  It makes the
-code transfer one line of data for each message in a
-mailbox (i.e., O(n)) compared to transfering only two
-lines (i.e., O(1))."
-  :type 'boolean
-  :group 'nnimap)
-
 (defcustom nnimap-close-asynchronous t
   "Close mailboxes asynchronously in `nnimap-close-group'.
 This means that errors caught by nnimap when closing the mailbox will
@@ -568,7 +555,7 @@ If EXAMINE is non-nil the group is selected read-only."
              (imap-mailbox-select group examine))
       (let (minuid maxuid)
        (when (> (imap-mailbox-get 'exists) 0)
-         (imap-fetch (if nnimap-enable-minmax-bug-workaround "1:*" "1,*")
+         (imap-fetch (if imap-enable-exchange-bug-workaround "1,*:*" "1,*")
                      "UID" nil 'nouidfetch)
          (imap-message-map (lambda (uid Uid)
                              (setq minuid (if minuid (min minuid uid) uid)