fetchmail-friends
[Top] [All Lists]

Re: [fetchmail] logout after idle delivery

2002-11-19 22:51:01
Quoting from Gordon Tetlow's mail on Tue, Nov 19, 2002 at 12:46:15PM -0800:
fetchmail: IMAP> A0010 STORE 1 +FLAGS (\Seen \Deleted)
fetchmail: IMAP< * 1 FETCH (FLAGS (\Seen \Deleted \Recent))

This line is being used by fetchmail to get the recentcount. This is a
bug. recentcount is incorrectly set to 1 here.

fetchmail: IMAP< A0010 OK STORE completed.
fetchmail: IMAP> A0011 EXPUNGE
fetchmail: IMAP< * 1 EXPUNGE
fetchmail: IMAP< * 0 EXISTS
fetchmail: IMAP< A0011 OK EXPUNGE completed.

Normally, EXPUNGE reports the number of recent mail too. Something
like:

IMAP> A0011 EXPUNGE
...
IMAP< * 0 EXISTS
IMAP< * 0 RECENT
IMAP< A0011 OK EXPUNGE completed.

Both problems are fixed in this patch:

======================================================
diff -Naur fetchmail-6.1.2.orig/imap.c fetchmail-6.1.2/imap.c
--- fetchmail-6.1.2.orig/imap.c Wed Nov 20 10:26:57 2002
+++ fetchmail-6.1.2/imap.c      Wed Nov 20 10:53:48 2002
@@ -92,7 +92,8 @@
                stage = STAGE_FETCH;
            }
        }
-       else if (strstr(buf, "RECENT"))
+       /* a space is required to avoid confusion with the \Recent flag */
+       else if (strstr(buf, " RECENT"))
        {
            recentcount = atoi(buf+2);
        }
@@ -545,6 +546,10 @@
         * for new mail.
         */
 
+       /* some servers do not report RECENT after an EXPUNGE. this check
+        * forces an incorrect recentcount to be ignored. */
+       if (recentcount > count)
+           recentcount = 0;
        /* this is a while loop because imap_idle() might return on other
         * mailbox changes also */
        while (recentcount == 0 && do_idle) {
======================================================

Sunil Shetye.

<Prev in Thread] Current Thread [Next in Thread>