Commit 00d891ec authored by Volker Krause's avatar Volker Krause
Browse files

Adapt to upcoming MailTransport changes

See kmailtransport!13.
parent a59e0939
Pipeline #143798 passed with stage
in 7 minutes and 5 seconds
......@@ -47,6 +47,7 @@ target_link_libraries(akonadi_maildispatcher_agent
KF5::AkonadiMime
KF5::Mime
KF5::MailTransportAkonadi
KF5::MailTransport
KF5::AkonadiAgentBase
KF5::I18n
KF5::Notifications
......
......@@ -22,6 +22,7 @@
#include <KMime/Message>
#include <MailTransport/TransportManager>
#include <MailTransportAkonadi/DispatchModeAttribute>
#include <MailTransportAkonadi/SentBehaviourAttribute>
#include <MailTransportAkonadi/TransportAttribute>
......@@ -93,7 +94,7 @@ void OutboxQueue::addIfComplete(const Item &item)
const auto transportAttribute = item.attribute<TransportAttribute>();
Q_ASSERT(transportAttribute);
if (transportAttribute->transport() == nullptr) {
if (TransportManager::self()->transportById(transportAttribute->transportId(), false) == nullptr) {
qCWarning(MAILDISPATCHER_LOG) << "Item " << item.id() << "has invalid transport.";
return;
}
......
......@@ -53,13 +53,14 @@ void SendJob::doTransport()
// Is it an Akonadi transport or a traditional one?
const TransportAttribute *transportAttribute = mItem.attribute<TransportAttribute>();
const auto transport = TransportManager::self()->transportById(transportAttribute->transportId(), false);
Q_ASSERT(transportAttribute);
if (!transportAttribute->transport()) {
if (!transport) {
storeResult(false, i18n("Could not initiate message transport. Possibly invalid transport."));
return;
}
const TransportType type = transportAttribute->transport()->transportType();
const TransportType type = transport->transportType();
if (!type.isValid()) {
storeResult(false, i18n("Could not send message. Invalid transport."));
return;
......@@ -71,7 +72,7 @@ void SendJob::doTransport()
if (type.isAkonadiResource()) {
// Send the item directly to the resource that will send it.
mResourceId = transportAttribute->transport()->host();
mResourceId = transport->host();
doAkonadiTransport();
} else {
// Use a traditional transport job.
......
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