Commit 1c74cf3f authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Fix Bug 416306 - send later agent wrongly store sended message to local storage

BUG: 416306
FIXED-IN: 5.14.0
parent 8f69cad4
......@@ -34,6 +34,8 @@
#include <mailtransport/transport.h>
#include <mailtransport/transportmanager.h>
#include <MessageCore/StringUtil>
#include <KIdentityManagement/Identity>
#include <KIdentityManagement/IdentityManager>
using namespace KMime::Types;
using namespace KPIM;
......@@ -139,6 +141,26 @@ void AkonadiSender::sendOrQueueMessage(const KMime::Message::Ptr &message, Messa
const int sentCollectionId = hrd->asUnicodeString().toInt();
qjob->sentBehaviourAttribute().setMoveToCollection(
Akonadi::Collection(sentCollectionId));
} else if (auto hrd = message->headerByType("X-KMail-Identity")) {
KIdentityManagement::IdentityManager *im = KIdentityManagement::IdentityManager::self();
const QString identityStrId = hrd->asUnicodeString();
const KIdentityManagement::Identity id = im->modifyIdentityForUoid(identityStrId.toUInt());
const QString fccId = id.fcc();
qjob->sentBehaviourAttribute().setSentBehaviour(
SentBehaviourAttribute::MoveToCollection);
const int sentCollectionId = fccId.toInt();
qjob->sentBehaviourAttribute().setMoveToCollection(
Akonadi::Collection(sentCollectionId));
} else if (auto hrd = message->headerByType("X-KMail-Identity-Name")) {
KIdentityManagement::IdentityManager *im = KIdentityManagement::IdentityManager::self();
const QString identityStrName = hrd->asUnicodeString();
const KIdentityManagement::Identity id = im->modifyIdentityForName(identityStrName);
const QString fccId = id.fcc();
qjob->sentBehaviourAttribute().setSentBehaviour(
SentBehaviourAttribute::MoveToCollection);
const int sentCollectionId = fccId.toInt();
qjob->sentBehaviourAttribute().setMoveToCollection(
Akonadi::Collection(sentCollectionId));
} else {
qjob->sentBehaviourAttribute().setSentBehaviour(
MailTransport::SentBehaviourAttribute::MoveToDefaultSentCollection);
......
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