7#include "dkimdownloadkeyjob.h"
8#include "messageviewer_dkimcheckerdebug.h"
11using namespace MessageViewer;
12DKIMDownloadKeyJob::DKIMDownloadKeyJob(
QObject *parent)
17DKIMDownloadKeyJob::~DKIMDownloadKeyJob() =
default;
19bool DKIMDownloadKeyJob::start()
22 qCWarning(MESSAGEVIEWER_DKIMCHECKER_LOG) <<
"Impossible to start download public keys";
26 mDnsLookup =
new QDnsLookup(
this);
30 mDnsLookup->setName(resolvDnsValue());
35bool DKIMDownloadKeyJob::canStart()
const
37 return !mDomainName.isEmpty() && !mSelectorName.isEmpty();
40QString DKIMDownloadKeyJob::domainName()
const
45void DKIMDownloadKeyJob::setDomainName(
const QString &domainName)
47 mDomainName = domainName;
50QString DKIMDownloadKeyJob::selectorName()
const
55void DKIMDownloadKeyJob::setSelectorName(
const QString &selectorName)
57 mSelectorName = selectorName;
60QString DKIMDownloadKeyJob::resolvDnsValue()
const
62 const QString
name = mSelectorName + QLatin1StringView(
"._domainkey.") + mDomainName;
63 qDebug(MESSAGEVIEWER_DKIMCHECKER_LOG) <<
"DKIMDownloadKeyJob::resolvDnsValue" <<
name;
67QDnsLookup *DKIMDownloadKeyJob::dnsLookup()
const
72void DKIMDownloadKeyJob::resolvDnsDone()
76 qCWarning(MESSAGEVIEWER_DKIMCHECKER_LOG) <<
"Error during resolving: " << mDnsLookup->errorString();
77 Q_EMIT error(mDnsLookup->errorString());
83 const auto records = mDnsLookup->textRecords();
84 QList<QByteArray> textRecordResult;
85 textRecordResult.
reserve(records.count());
86 for (
const QDnsTextRecord &record : records) {
87 textRecordResult << record.values();
90 Q_EMIT success(textRecordResult, mDomainName, mSelectorName);
94#include "moc_dkimdownloadkeyjob.cpp"
QString name(StandardAction id)
void reserve(qsizetype size)
QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)