properly honor resource when applying filters to new emails
Review Request #102446 - Created Aug. 26, 2011 and discarded
This is most probably just a dirty "get it working" patch, but I want to post it here for review. First the problem it solves: When starting kmail, it will apply all filters to all new emails without honoring the "apply this filter to incoming messages: from checked accounts only" setting. The easiest way to notice is by having a "spamc" or spamassassin (or similar) filter that takes a long time and have that apply to only a very specific account. Then, when a different account gets new email you should see a load spike / spamc processes even though there should be none. Imo the whole design of FilterManager::process's function signature is pretty bad. Shouldn't/couldn't the optional stuff be removed and item.parentCollection().resource() be used instead?
ran kmail2 for ~1 day. it finally worked like it should
Looks reasonable, but I'm not entirely sure whether this also works for POP3 accounts. Is the resource of a message downloaded via POP3 the corresponding POP3 resource? Or has the message already been assigned to the corresponding "inbox" folder of some local mail resource (maildir/mbox/mixedmail) before the filtering starts? The signature of process() is basically the same as before Akonadi. Only the types of the arguments have changed. This kind of explains its weirdness.
Review request changed
Cleaned up API+APIDox of FilterManager::process Should hopefully behave like my old version but now the diff is actually committable imo. I'll test it one more day and then push it when there are no other objections.
Revision 2 (+6 -9)