$NetBSD: patch-ae,v 1.6 2015/09/03 14:49:02 wiz Exp $

Work around the broken IMAP implementation of Exchange 2010.
Patch taken from here:

http://dev.mutt.org/trac/ticket/3459

--- imap/message.c.orig	2010-08-24 17:34:21.000000000 +0100
+++ imap/message.c	2011-02-03 13:17:56.000000000 +0000
@@ -242,6 +242,14 @@
       char *cmd;
 
       fetchlast = msgend + 1;
+      /* Microsoft Exchange 2010 violates the IMAP protocol and 
+       * starts omitting messages if one FETCHes more than 2047 (or
+       * or somewhere around that number. We therefore split the
+       * FETCH into chunks of 2000 messages each. */
+      if (fetchlast - msgno - 1 > 2000)
+      {
+        fetchlast = msgno + 1 + 2000;
+      }
       safe_asprintf (&cmd, "FETCH %d:%d (UID FLAGS INTERNALDATE RFC822.SIZE %s)",
                      msgno + 1, fetchlast, hdrreq);
       imap_cmd_start (idata, cmd);
