Commit 1052735e authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Fix duplicate code

parent c643b3c5
......@@ -169,22 +169,10 @@ void DKIMCheckFullJob::storeResult(const DKIMCheckSignatureJob::CheckSignatureRe
if (mCheckPolicy.autogenerateRule()) {
if (mCheckPolicy.autogenerateRuleOnlyIfSenderInSDID()) {
//TODO
//Check value SDID !
if (checkResult.status == DKIMCheckSignatureJob::DKIMStatus::Valid) {
DKIMGenerateRuleJob *job = new DKIMGenerateRuleJob(this);
job->setResult(checkResult);
if (!job->start()) {
qCWarning(MESSAGEVIEWER_DKIMCHECKER_LOG) << "Impossible to start autogenerate rule";
}
}
//FIXME Check value SDID !
generateRule(checkResult);
} else {
if (checkResult.status == DKIMCheckSignatureJob::DKIMStatus::Valid) {
DKIMGenerateRuleJob *job = new DKIMGenerateRuleJob(this);
job->setResult(checkResult);
if (!job->start()) {
qCWarning(MESSAGEVIEWER_DKIMCHECKER_LOG) << "Impossible to start autogenerate rule";
}
}
generateRule(checkResult);
}
}
......@@ -193,6 +181,17 @@ void DKIMCheckFullJob::storeResult(const DKIMCheckSignatureJob::CheckSignatureRe
deleteLater();
}
void DKIMCheckFullJob::generateRule(const DKIMCheckSignatureJob::CheckSignatureResult &checkResult)
{
if (checkResult.status == DKIMCheckSignatureJob::DKIMStatus::Valid) {
DKIMGenerateRuleJob *job = new DKIMGenerateRuleJob(this);
job->setResult(checkResult);
if (!job->start()) {
qCWarning(MESSAGEVIEWER_DKIMCHECKER_LOG) << "Impossible to start autogenerate rule";
}
}
}
void DKIMCheckFullJob::slotCheckSignatureResult(const DKIMCheckSignatureJob::CheckSignatureResult &checkResult)
{
if (mCheckPolicy.checkIfEmailShouldBeSigned()
......
......@@ -52,6 +52,7 @@ private:
void storeKey(const QString &key, const QString &domain, const QString &selector);
void storeInKeyManager(const QString &key, const QString &domain, const QString &selector, bool verify);
void storeResult(const DKIMCheckSignatureJob::CheckSignatureResult &checkResult);
void generateRule(const DKIMCheckSignatureJob::CheckSignatureResult &checkResult);
void checkAuthenticationResults();
DKIMCheckPolicy mCheckPolicy;
KMime::Message::Ptr mMessage;
......
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