fetchmail-friends
[Top] [All Lists]

Re: [fetchmail] Problem trying to fetch from a mbox containing a dummy IMAP message

2002-06-21 04:35:45
Quoting from Pierre-Michel Ansel's mail on Thu, Jun 20, 2002 at 06:40:28PM 
-0700:
The problem that i have is that fetchmails retrieves this dummy
message and then, decides not to fetch it ('retained'):

see transact.c, function readheaders

/*
 * The University of Washington IMAP server (the reference
 * implementation of IMAP4 written by Mark Crispin) relies
 * on being able to keep base-UID information in a special
 * message at the head of the mailbox.  This message should
 * neither be deleted nor forwarded.
*/
if (num == 1 && !strncasecmp(line, "X-IMAP:", 7)) {
      free(line);
      free(msgblk.headers);
      msgblk.headers = NULL;
      return(PS_RETAINED);
}

Because of the -e 1 option given to fetchmail, it issues a QUIT
(this option cannot be changed as I need to protect myself from
line drops) and then reconnects and gets the same dummy message
again and again, never fetching the remaining messages.

My question is the following :
Is there a way, without changing/removing the -e 1 option,
to fetch emails using the POP3 protocol from a mail box in which
the first message is a "dummy X-IMAP message"?.

Please try the following patch. It suppresses everything for the
retained message. Also, it does not increase the count of mails for
that message.

==============================================
diff -Naur fetchmail-5.9.12.orig/driver.c fetchmail-5.9.12/driver.c
--- fetchmail-5.9.12.orig/driver.c      Fri Jun 21 16:34:53 2002
+++ fetchmail-5.9.12/driver.c   Fri Jun 21 16:48:15 2002
@@ -495,7 +495,7 @@
            err = readheaders(mailserver_socket, len, msgsizes[num-1],
                             ctl, num);
            if (err == PS_RETAINED)
-               suppress_forward = retained = TRUE;
+               suppress_readbody = suppress_forward = suppress_delete = 
retained = TRUE;
            else if (err == PS_TRANSIENT)
                suppress_delete = suppress_forward = TRUE;
            else if (err == PS_REFUSED)
@@ -631,7 +631,8 @@
                ctl->errcount++;
                suppress_delete = TRUE;
            }
-           (*fetches)++;
+           if (!retained)
+               (*fetches)++;
        }
 
        /*
==============================================

Sunil Shetye.


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