[Kde-pim] [PATCH] fix IMAP filtering (Bug 95064)

Ingo Klöcker kloecker at kde.org
Tue Oct 28 12:17:50 GMT 2008


On Tuesday 28 October 2008, Thomas McGuire wrote:
> Hi,
>
> On Sunday 26 October 2008 20:19:39 Thomas Neumann wrote:
> > the attached patch fixes filtering for online IMAP accounts (Bug
> > 95064). What it basically does is avoiding duplicate filtering (see
> > below for a discussion).
> >
> > There might be a simpler way to achieve the same goal, but
> > I could not come up with an alternative strategy that is as robust
> > regarding IMAP server behavior.
>
> UIDPLUS and a MD5-to-serialnumber map can be used for this, see
> below.
>
> > The basic problem is as follows: A new message arrives, KMail
> > filters it, and updates the filtered result back on the IMAP
> > server. Due to the asynchronous execution if IMAP accesses, it can
> > happen that KMail sees its own update (which is a delete+insert) as
> > new mail, triggering a new filter run (and creating a duplicate in
> > some cases, otherwise just filtering and re-filtering all over).
> >
> > The way I avoided this problem was to add a "filtered" flag in
> > MessageStatus, explicitly keeping track of already filtered
> > messages and refusing to filter them again. I don't think this can
> > be avoided, as all operations are asynchronous (e.g., new messages
> > might arrive in-between) and there does not seem to be a foolproof
> > way to detect that the "new" mail is really caused by an update.
> >
> > Comments/suggestions welcome, if you think this is the right
> > approach please commit it, as I do not have SVN write access.
>
> I finally managed to have a deeper look into this and found the
> following:
>
> IMAP filtering is indeed broken, although I could never reproduce
> duplicates. Did you find a way to reliably reproduce duplicates?

FWIW, I never saw duplicates. But occasionally I see infinite filtering, 
i.e. the same message is filtered over and over again. This happens 
only for large messages for which uploading takes a long time. My 
unchecked theory is that this happens because KMail does already see 
the message that is still being uploaded before the upload has been 
completed. I have never seen this happen for smaller messages.

KMail adds the header X-KMail-Filtered with some number as content to 
filtered messages. I guess this number is meant to be used for 
correlating the filtered messages with the messages the IMAP server 
reports as new. Maybe this mechanism has a bug or it is not fully 
implemented.


Regards,
Ingo
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-pim/attachments/20081028/94374c2a/attachment.sig>
-------------- next part --------------
_______________________________________________
KDE PIM mailing list kde-pim at kde.org
https://mail.kde.org/mailman/listinfo/kde-pim
KDE PIM home page at http://pim.kde.org/


More information about the kde-pim mailing list