[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kmail-devel
Subject:    PATCH: Asynchronous filtering
From:       Don Sanders <sanders () trolltech ! com>
Date:       2003-10-25 14:30:12
[Download RAW message or body]

Hi,

Here is a patch that Till and I have been working on for a few months 
and that I have spent today testing. Essentially it's a bugfix for 
Bug#41514 "KMail freezes the UI when checking for new mail".

This patch makes manually applying filters and applying ad hoc filters 
async. It doesn't make filtering mail as it is retrieved from pop and 
local accounts asynchronous, and does not add support for automatic 
client side filtering of new messages on imap accounts. But these 
things are natural extensions of this patch, (which is sufficiently 
large now that I don't want to go futher before what has been done is 
committed).

This patch also fixes some bugs and annoyances with filters. It fixes 
a crash in ad hoc filters which was triggered by an ad hoc filter 
moving a message to a new folder. 

It also removes the annoyance that the move to action had to be the 
last in the list of actions for a filter. This was done by modifying 
move filter action so it sets a message property specifying which 
folder to move a message into, rather than doing the 
actual move.

The patch also gets rid of KMFilterMgr::cleanup and replaces it with 
ref counting of the filter manager via KMFilterMgr::ref() and deref
(). I think this makes a lot of sense, (for example it fixes the bug 
in ad hoc filters).

To implement async filter actions we've enhanced KMFilterAction with a 
processAsync(KMMessage* msg) method. To prepare for optional body 
downloading we've introduced a requiresBody(KMMsgBase* msgBase) 
method. The advantage of this approach is that it's very simple, 
requiring minimal changes to KMFilterAction.

We've also optimized KMMsgBase::getMsgSerNum() so that it caches the 
serial number of a message without bloating KMMsgBase with another 
int member variable. Previously getMsgSerNum would search all 
messages in the parent folder to find a messages serial number.

This patch also introduces two new classes ActionScheduler and 
MessageProperty.

The MessageProperty class was crated to allow message properties to be 
set (like a cached serNum, and a folder to filter a message into) 
without bloating any of the message classes. I've been testing the 
changes related to this class for several weeks now and it's mainly 
these changes that I would like to get committed.

The Action Scheduler class is essentially a finite state machine that 
fetches and fiters messages async. In the future hopefully it will do 
this without downloading the body if possible but this hasn't been 
done yet.

The Action Scheduler is used by ad hoc filters and when manually 
applying filters. If bugs or performance issues have been introduced 
in these actions then it will be easy to revert the use of the Action 
Scheduler leaving only the well testing Message Property changes. 
(I'm not sure if performance issue have been introduced as I haven't 
done any profiling).

Finally the patch introduces use of the new Thread Weaver class to 
make the filter through action async. Perhaps Till would like to give 
more info on this.

Basically before moving on to making filtering of incoming mail async 
I'd like to get what Till and I have been working on committed and 
tested.

I would haved like to get incoming mail filtering async, and on IRC 
Ingo proposed a method that means it shouldn't be too much more work 
but I have personal obligations tomorrow which will prevent me from 
getting that done this weekend.

Don.

["asyncfiltering.tgz" (application/x-tgz)]

_______________________________________________
KMail Developers mailing list
kmail@mail.kde.org
http://mail.kde.org/mailman/listinfo/kmail

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic