Summary: | Signed email cannot be marked as read [Exchange server] | ||
---|---|---|---|
Product: | [Frameworks and Libraries] Akonadi | Reporter: | Thiago Macieira <thiago> |
Component: | IMAP resource | Assignee: | Kevin Ottens <ervin> |
Status: | VERIFIED FIXED | ||
Severity: | normal | CC: | amantia, kdepim-bugs, vkrause |
Priority: | NOR | ||
Version: | 1.4.80 | ||
Target Milestone: | --- | ||
Platform: | Compiled Sources | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: |
Description
Thiago Macieira
2010-12-07 19:54:10 UTC
From a quick research indeed Exchange doesn't support custom flags. :( So we need: 1) to detect if the server we are talking to supports it or not, and if not clean the FLAGS arguments from custom flags 2) store the flags inside the mail as well, in custom headers It gets a bit worse, since KMail also uses a few other marks. That means a replied-to message can never be marked unread again. commit e6d4e256d84e170c25cdd833d69bd2d7339bc256 branch master Author: Volker Krause <vkrause@kde.org> Date: Tue Dec 28 12:43:19 2010 +0100 Do not try to write flags to the server that it does not support. Can happen even with servers that do support arbitrary flags, but where you lack access rights to change them in a specific folder. BUG: 259160 diff --git a/resources/imap/changeitemtask.cpp b/resources/imap/changeitemtask.cpp index 3ababf2..c1b4b73 100644 --- a/resources/imap/changeitemtask.cpp +++ b/resources/imap/changeitemtask.cpp @@ -34,6 +34,7 @@ #include "imapflags.h" #include "uidnextattribute.h" +#include "collectionflagsattribute.h" ChangeItemTask::ChangeItemTask( ResourceStateInterface::Ptr resource, QObject *parent ) : ResourceTask( DeferIfNoSession, resource, parent ), m_session( 0 ), m_oldUid( 0 ), m_newUid( 0 ) @@ -104,11 +105,25 @@ void ChangeItemTask::onPreStoreSelectDone( KJob *job ) void ChangeItemTask::triggerStoreJob() { + QList<QByteArray> flags = fromAkonadiFlags( item().flags().toList() ); + Akonadi::CollectionFlagsAttribute *flagAttr = item().parentCollection().attribute<Akonadi::CollectionFlagsAttribute>(); + // the server does not support arbitrary flags, so filter out those it can't handle + if ( flagAttr && !flagAttr->flags().isEmpty() && !flagAttr->flags().contains( "\\*" ) ) { + for ( QList< QByteArray >::iterator it = flags.begin(); it != flags.end(); ) { + if ( flagAttr->flags().contains( *it ) ) { + ++it; + } else { + kDebug() << "Server does not support flag" << *it; + it = flags.erase( it ); + } + } + } + KIMAP::StoreJob *store = new KIMAP::StoreJob( m_session ); store->setUidBased( true ); store->setSequenceSet( KIMAP::ImapSet( m_oldUid ) ); - store->setFlags( fromAkonadiFlags( item().flags().toList() ) ); + store->setFlags( flags ); store->setMode( KIMAP::StoreJob::SetFlags ); connect( store, SIGNAL( result( KJob* ) ), diff --git a/resources/imap/retrieveitemstask.cpp b/resources/imap/retrieveitemstask.cpp index 86917ec..196bba5 100644 --- a/resources/imap/retrieveitemstask.cpp +++ b/resources/imap/retrieveitemstask.cpp @@ -148,7 +148,7 @@ void RetrieveItemsTask::onFinalSelectDone( KJob *job ) const int messageCount = select->messageCount(); const qint64 uidValidity = select->uidValidity(); const qint64 nextUid = select->nextUid(); - const QList<QByteArray> flags = select->flags(); + const QList<QByteArray> flags = select->permanentFlags(); // uidvalidity can change between sessions, we don't want to refetch // folders in that case. Keep track of what is processed and what not. Fix confirmed. |