fetchmail-friends
[Top] [All Lists]

[fetchmail]pop3 and fetchlimit

2001-05-23 05:53:26
Hi,

fetchlimit does not seem to work with pop3 now.

Assuming, there are 10 mails in mailbox,

$ fetchmail -p pop3 -B 1 bombay.retortsoft.com

downloads all messages. On looking at the code, it seems to look at
the expunge first. Since expunge is not set, all mails get downloaded.
Further experimenting,

$ fetchmail -p pop3 -B 2 -e 1 bombay.retortsoft.com

works correctly. Mails are downloaded in two sets.

$ fetchmail -p pop3 -B 3 -e 2 bombay.retortsoft.com

works slightly incorrectly. Mails are downloaded in two sets, but four
mails are downloaded instead of the upper limit of three.

This patch is an attempt to fix that:

=======================================================================
diff -Naur fetchmail-5.8.4.orig/driver.c fetchmail-5.8.4/driver.c
--- fetchmail-5.8.4.orig/driver.c       Mon May 14 12:29:22 2001
+++ fetchmail-5.8.4/driver.c    Wed May 23 19:09:59 2001
@@ -2552,6 +2552,8 @@
        int fetchlimit = NUM_VALUE_OUT(ctl->fetchlimit);
 
        do {
+           if (fetchlimit > 0 && (expunge == 0 || expunge > fetchlimit - 
totalcount))
+               expunge = fetchlimit - totalcount;
            ok = do_session(ctl, proto, expunge);
            totalcount += expunge;
            if (NUM_SPECIFIED(ctl->fetchlimit) && totalcount >= fetchlimit)
=======================================================================

the logic being that if there is no expunge limit or if expunge limit
is too high, set it to the remaining fetchlimit.

Sunil Shetye.


<Prev in Thread] Current Thread [Next in Thread>
  • [fetchmail]pop3 and fetchlimit, Sunil Shetye <=