Messagelib

dkimgeneraterulejob.cpp
1/*
2 SPDX-FileCopyrightText: 2019-2024 Laurent Montel <montel@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#include "dkimgeneraterulejob.h"
8#include "dkimmanagerrules.h"
9#include "messageviewer_debug.h"
10using namespace MessageViewer;
11
12DKIMGenerateRuleJob::DKIMGenerateRuleJob(QObject *parent)
13 : QObject(parent)
14{
15}
16
17DKIMGenerateRuleJob::~DKIMGenerateRuleJob() = default;
18
19bool DKIMGenerateRuleJob::canStart() const
20{
21 if (!mResult.isValid()) {
22 qCWarning(MESSAGEVIEWER_LOG) << "Rule is not valid";
23 return false;
24 }
25 return true;
26}
27
28bool DKIMGenerateRuleJob::start()
29{
30 if (!canStart()) {
32 qCWarning(MESSAGEVIEWER_LOG) << "Impossible to start DKIMGenerateRuleJob";
33 return false;
34 }
35 verifyAndGenerateRule();
36 return true;
37}
38
39void DKIMGenerateRuleJob::verifyAndGenerateRule()
40{
41 DKIMRule rule;
42 rule.setEnabled(true);
43 rule.setFrom(mResult.fromEmail);
44 // TODO add Domain when we create a rule from base domain.
45 rule.setSignedDomainIdentifier(QStringList() << mResult.sdid);
46 rule.setRuleType(DKIMRule::RuleType::MustBeSigned);
48}
49
50DKIMCheckSignatureJob::CheckSignatureResult DKIMGenerateRuleJob::result() const
51{
52 return mResult;
53}
54
55void DKIMGenerateRuleJob::setResult(const DKIMCheckSignatureJob::CheckSignatureResult &checkResult)
56{
57 mResult = checkResult;
58}
59
60#include "moc_dkimgeneraterulejob.cpp"
The DKIMRule class.
Definition dkimrule.h:18
void deleteLater()
T qobject_cast(QObject *object)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sun Feb 25 2024 18:37:31 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.