[Kde-pim] Re: IMAP filtering doesn't work?

Andre Heinecke aheinecke at intevation.de
Sun May 22 10:29:34 BST 2011


Hi,
Am Saturday, 21. May 2011, 09:58:47 schrieb Stephen Kelly:
> Tobias König wrote:
> > On Saturday 21 May 2011 08:17:45 Stephen Kelly wrote:
> >> Hi,
> > 
> > Hej,
> > 
> >> I was pointed to this on my blog:
> >> 
> >> https://bugs.kde.org/show_bug.cgi?id=255388
> >> (Kmail filters dont work in incoming mail)
> > 
> > After a short glance at the code it seems that the FilterManager will
> > only act on new emails that are in a collection with remote id 'inbox'
> > (see Kernel::folderIsInbox() in kdepim/mailcommon/mailkernel.cpp).
> > 
> > So we should ask the bug reporters if this applies to their setup. We
> > have one bug report about broken filtering with POP3, where the target
> > folder of the POP3 resource is != inbox.
I can reproduce the bug here and my remote collection id is /INBOX I've added 
some debug output in Kernel::folderIsInbox and when it is called it correctly 
returns that my inbox folder is an Inbox.
> > 
> > The correct fix for this would be a list of collections that the filter
> > code shall look in. And the POP3 resource and KMail allows the user to
> > add additional collections to this list.
> 
> Is it normal to only filter inbox?
> 
> How did KMail1 handle this? Filter on all folders all the time? Make the
> user use a dialog?
It is normal to only filter on Inbox and KMail1 / KMail2 do not allow different 
configurations from the UI. (Which makes sense imho)
> 
> Any reason a patch like
> 
> diff --git a/mailcommon/filtermanager.cpp b/mailcommon/filtermanager.cpp
> index e874ec9..e578ec0 100644
> --- a/mailcommon/filtermanager.cpp
> +++ b/mailcommon/filtermanager.cpp
> @@ -102,12 +102,10 @@ void FilterManager::Private::tryToMonitorCollection()
>  void FilterManager::Private::slotInitialCollectionsFetched( const
> Akonadi::Collection::List &collections )
>  {
>    foreach ( const Akonadi::Collection &collection, collections ) {
> -    if ( CommonKernel->folderIsInbox( collection ) ) {
> -      Akonadi::ItemFetchJob *job = new Akonadi::ItemFetchJob( collection, q
> );
> -      job->fetchScope().fetchAllAttributes();
> -      q->connect( job, SIGNAL( itemsReceived( const Akonadi::Item::List& )
> ),
> -                  q, SLOT( slotInitialItemsFetched( const
> Akonadi::Item::List& ) ) );
> -    }
> +    Akonadi::ItemFetchJob *job = new Akonadi::ItemFetchJob( collection, q
> );
> +    job->fetchScope().fetchAllAttributes();
> +    q->connect( job, SIGNAL( itemsReceived( const Akonadi::Item::List& ) ),
> +                q, SLOT( slotInitialItemsFetched( const
> Akonadi::Item::List& ) ) );
>    }
>  }
>
> Would not work?
The problem here is not that folderIsInbox is not called. When i have KMail 
running filters work fine on incoming mails the code is triggered and works 
correctly. 
I did a test 
-> Create a filter
-> Send a mail with my local client to myself 
Mail recieved with imap idle, was correctly filtered. 
-> Shut down KMail
-> Send a Mail from another Mail client to myself
-> Trigger Imap Sync with akonadiconsole
-> Start Kmail2
Mail was not filtered the Code to check for the inbox remote ID was never 
reached.

I think the problem is that the slotInitialCollectionsFeteched is only 
triggered when KMail ( and thus the filtermanager ) is running. The only 
solution i see there is to apply all Filters on the inbox on startup?


Regards,
Andre
-- 
Andre Heinecke |  ++49-541-335083-262  |  http://www.intevation.de/
Intevation GmbH, Neuer Graben 17, 49074 Osnabrück | AG Osnabrück, HR B 18998
Geschäftsführer: Frank Koormann, Bernhard Reiter, Dr. Jan-Oliver Wagner
-- 
Andre Heinecke |  ++49-541-335083-262  |  http://www.intevation.de/
Intevation GmbH, Neuer Graben 17, 49074 Osnabrück | AG Osnabrück, HR B 18998
Geschäftsführer: Frank Koormann, Bernhard Reiter, Dr. Jan-Oliver Wagner
_______________________________________________
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