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

List:       kde-pim
Subject:    Re: [Kde-pim] mailfilter does not see all incoming messages
From:       Wolfgang Rohdewald <wolfgang () rohdewald ! de>
Date:       2013-02-26 12:34:36
Message-ID: 2380017.Clc1X9WGug () i5
[Download RAW message or body]

Am Mittwoch, 13. Februar 2013, 10:34:46 schrieb Wolfgang Rohdewald:
> my filter for incoming mail does not get noticed of all new mails.
> if I get 10 mails (sent by myself from somewhere else), between 0 and 3
> remain in inbox. The ignored mails are always some of the last ones,
> the first 5 mails always get through to mailfilter.

what happens:

MonitorPrivate::dispatchNotifications() deqeues a msg
from pendingNotifications

This emits itemChanged
processing that signal indirectly calls ChangeRecorder::changeProcessed()
which dequeues a message from pendingNotifications. This is the
lost message. This only happens sometimes - only if pendingNotifications
is not empty.

There are two dequeues for one message, so one of them is too much.

I now removed one call to changeProcessed() from mailfilteragent
by overriding 
AgentBase::Observer::itemChanged (which does call changeProcessed)
with an empty version which does not call changeProcessed.

This seems to work. Patch attached. Please review - if OK, I will commit
to 4.10 and merge to master.

But then I do not understand some comments in changerecorder.cpp
like
      // The msg is now in both pipeline and pendingNotifications.
      // When data is available, MonitorPrivate::flushPipeline will emitNotification.
      // When changeProcessed is called, we'll finally remove it from pendingNotifications.

it seems to me that the API of Monitor and ChangeRecorder can easily be misunderstood
and wrongly used. The API doc certainly does not say that slots like itemAdded must
call changeProcessed. But then the default implementations in AgentBase::Monitor::itemAdded etc
do call it. Which one is correct? If the slots should not call changeProcessed, who should in light
of the comment above?


-- 
Wolfgang
["mailfilter.patch" (mailfilter.patch)]

diff --git a/mailfilteragent/mailfilteragent.cpp b/mailfilteragent/mailfilteragent.cpp
index 00df47c..6e94b25 100644
--- a/mailfilteragent/mailfilteragent.cpp
+++ b/mailfilteragent/mailfilteragent.cpp
@@ -169,6 +169,10 @@ void MailFilterAgent::itemAdded( const Akonadi::Item &item, const Akonadi::Colle
   //TODO: Error handling?
 }
 
+void MailFilterAgent::itemChanged(const Akonadi::Item& item, const QSet< QByteArray >& partIdentifiers)
+{
+}
+
 void MailFilterAgent::itemsReceiviedForFiltering (const Akonadi::Item::List& items)
 {
   if (items.isEmpty())
diff --git a/mailfilteragent/mailfilteragent.h b/mailfilteragent/mailfilteragent.h
index 2e6cc9d..e68f3c3 100644
--- a/mailfilteragent/mailfilteragent.h
+++ b/mailfilteragent/mailfilteragent.h
@@ -40,6 +40,7 @@ class MailFilterAgent : public Akonadi::AgentBase, public Akonadi::AgentBase::Ob
     ~MailFilterAgent();
 
     void itemAdded( const Akonadi::Item &item, const Akonadi::Collection &collection );
+    void itemChanged(const Akonadi::Item& item, const QSet< QByteArray >& partIdentifiers);
 
     QString createUniqueName( const QString &nameTemplate );
     void filterItems( const QList< qint64 >& itemIds, int filterSet );


_______________________________________________
KDE PIM mailing list kde-pim@kde.org
https://mail.kde.org/mailman/listinfo/kde-pim
KDE PIM home page at http://pim.kde.org/

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

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