Commit f58acdb2 authored by Tobias Koenig's avatar Tobias Koenig
Browse files

Set the signed/encrypted/hasAttachment/isInvitation flags

when receiving a message from the POP3/IMAP server

svn path=/trunk/KDE/kdepim/runtime/; revision=1197613
parent 477059c1
......@@ -28,6 +28,7 @@
#include <akonadi/cachepolicy.h>
#include <akonadi/collectionstatistics.h>
#include <akonadi/kmime/messageflags.h>
#include <akonadi/kmime/messageparts.h>
#include <KDE/KDebug>
......@@ -320,6 +321,17 @@ void RetrieveItemsTask::onHeadersReceived( const QString &mailBox, const QMap<qi
i.setMimeType( KMime::Message::mimeType() );
i.setPayload( KMime::Message::Ptr( messages[number] ) );
i.setSize( sizes[number] );
// update status flags
if ( KMime::isSigned( messages[number].get() ) )
i.setFlag( Akonadi::MessageFlags::Signed );
if ( KMime::isEncrypted( messages[number].get() ) )
i.setFlag( Akonadi::MessageFlags::Encrypted );
if ( KMime::isInvitation( messages[number].get() ) )
i.setFlag( Akonadi::MessageFlags::HasInvitation );
if ( KMime::hasAttachment( messages[number].get() ) )
i.setFlag( Akonadi::MessageFlags::HasAttachment );
const QList<QByteArray> akonadiFlags = toAkonadiFlags( flags[number] );
foreach( const QByteArray &flag, akonadiFlags ) {
i.setFlag( flag );
......
......@@ -24,6 +24,7 @@
#include <KDE/KDebug>
#include <KDE/KLocale>
#include <akonadi/kmime/messageflags.h>
#include <kimap/selectjob.h>
#include <kimap/session.h>
......@@ -103,6 +104,16 @@ void RetrieveItemTask::onMessagesReceived( const QString &mailBox, const QMap<qi
i.setMimeType( KMime::Message::mimeType() );
i.setPayload( KMime::Message::Ptr( message ) );
// update status flags
if ( KMime::isSigned( message.get() ) )
i.setFlag( Akonadi::MessageFlags::Signed );
if ( KMime::isEncrypted( message.get() ) )
i.setFlag( Akonadi::MessageFlags::Encrypted );
if ( KMime::isInvitation( message.get() ) )
i.setFlag( Akonadi::MessageFlags::HasInvitation );
if ( KMime::hasAttachment( message.get() ) )
i.setFlag( Akonadi::MessageFlags::HasAttachment );
kDebug(5327) << "Has Payload: " << i.hasPayload();
m_messageReceived = true;
......
......@@ -23,8 +23,10 @@
#include <Akonadi/CollectionFetchJob>
#include <Akonadi/ItemCreateJob>
#include <akonadi/kmime/messageflags.h>
#include <akonadi/kmime/specialmailcollectionsrequestjob.h>
#include <akonadi/kmime/specialmailcollections.h>
#include <kmime/kmime_util.h>
#include <Mailtransport/PrecommandJob>
#include <Mailtransport/Transport>
......@@ -604,6 +606,16 @@ void POP3Resource::messageFinished( int messageId, KMime::Message::Ptr message )
item.setMimeType( "message/rfc822" );
item.setPayload<KMime::Message::Ptr>( message );
// update status flags
if ( KMime::isSigned( message.get() ) )
item.setFlag( Akonadi::MessageFlags::Signed );
if ( KMime::isEncrypted( message.get() ) )
item.setFlag( Akonadi::MessageFlags::Encrypted );
if ( KMime::isInvitation( message.get() ) )
item.setFlag( Akonadi::MessageFlags::HasInvitation );
if ( KMime::hasAttachment( message.get() ) )
item.setFlag( Akonadi::MessageFlags::HasAttachment );
ItemCreateJob *itemCreateJob = new ItemCreateJob( item, mTargetCollection );
mPendingCreateJobs.insert( itemCreateJob, messageId );
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment