|
From: Sunil S. <sh...@bo...> - 2006-05-16 09:12:44
|
Quoting from Matthias Andree's mail on Mon, May 15, 2006:
> > But if I try to not to expunge the messages on the server after the
> > transfer (using "keep" configuration option), fetchmail immediately
> > terminates after fetching the first message. Don't know if this is intended
> > behaviour?
>
> Time to summon Sunil who knows a bit more about the idle code...
Thanks, Matthias.
> Well, --keep and --idle don't appear to be friends, but it doesn't
> appear to be intentional either, at least it's not documented; and the
> interfaces and assumptions in fetchmail aren't documented well, so I
> need to figure out which function expects what input and is expected to
> give what output...
>
> I need to think about this a bit and understand the IMAP message
> counting stuff a bit better -- and decide if I really want to fix this
> in 6.3.X or only in 6.4.X where I plan to add UID support for IMAP.
>
> I have committed this stopgap code to SVN however, but I'm not promising
> I can easily fix --keep --idle with reasonable effort.
Here is a patch which calculates recentcount as a difference between
new and old EXISTS count. fetchmail will now no longer use the RECENT
flag.
There was a reason why "keep" and "idle" options could not work
together before. The RECENT flag never gets cleared from a new mail
unless you logout or you delete and expunge the mail. Thus, when
"keep" is enabled, a mail which was \Recent remains so forever(*) for
that session, even if the mail is downloaded and marked as \Seen. Note
that the \Recent flag cannot be cleared by fetchmail (RFC 3501). This
would cause fetchmail to loop forever and not go into IDLE mode.
Now, with this patch, since the \Recent flag will not be used, it is
possible to try supporting "keep" and "idle" together. This patch also
patches driver.c to support this. Note that fetchmail will still not
enter the IDLE mode if you do not have any new mail. This table should
make the picture clearer:
with "keep" and "idle" options
Mails New mails Enter IDLE mode Enter IDLE mode
before patch? after patch?
---------------------------------------------------------------
0 0 Yes Yes
>= 1 0 No No
>= 1 >= 1 No Yes
Please try this patch and report. Note that this patch has to be
applied after the patch by Matthias Andree.
--
Sunil Shetye.
(*) Of course, you may find some mailservers who do clear the \Recent
flag automatically when the \Seen flag is set.
|