Messagelib

dmarcpolicyjob.h
1/*
2 SPDX-FileCopyrightText: 2019-2024 Laurent Montel <montel@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#pragma once
8
9#include "messageviewer_private_export.h"
10#include <QObject>
11namespace MessageViewer
12{
13class MESSAGEVIEWER_TESTS_EXPORT DMARCPolicyJob : public QObject
14{
15 Q_OBJECT
16public:
17 struct DMARCResult {
18 bool isValid() const
19 {
20 return !mAdkim.isEmpty() && !mPolicy.isEmpty() && !mDomain.isEmpty() && !mSource.isEmpty();
21 }
22
23 [[nodiscard]] bool operator==(const DMARCPolicyJob::DMARCResult &other) const
24 {
25 return mAdkim == other.mAdkim && mPolicy == other.mPolicy && mDomain == other.mDomain && mSource == other.mSource
26 && mPercentage == other.mPercentage;
27 }
28
29 [[nodiscard]] bool operator!=(const DMARCPolicyJob::DMARCResult &other) const
30 {
31 return !DMARCResult::operator==(other);
32 }
33
34 QString mAdkim;
35 QString mPolicy;
36 QString mDomain;
37 QString mSource;
38 int mPercentage = -1;
39 };
40
41 explicit DMARCPolicyJob(QObject *parent = nullptr);
42 ~DMARCPolicyJob() override;
43
44 [[nodiscard]] bool canStart() const;
45 [[nodiscard]] bool start();
46
47 [[nodiscard]] QString emailAddress() const;
48 void setEmailAddress(const QString &emailAddress);
49
50Q_SIGNALS:
51 void result(const MessageViewer::DMARCPolicyJob::DMARCResult &value, const QString &emailAddress);
52
53private:
54 MESSAGEVIEWER_NO_EXPORT void checkSubDomain(const QString &domainName);
55 MESSAGEVIEWER_NO_EXPORT void slotCheckDomain(const QList<QByteArray> &lst, const QString &domainName);
56 MESSAGEVIEWER_NO_EXPORT void slotCheckSubDomain(const QList<QByteArray> &lst, const QString &domainName);
57 [[nodiscard]] MESSAGEVIEWER_NO_EXPORT QByteArray generateDMARCFromList(const QList<QByteArray> &lst) const;
58 [[nodiscard]] MESSAGEVIEWER_NO_EXPORT QString emailDomain() const;
59 [[nodiscard]] MESSAGEVIEWER_NO_EXPORT QString emailSubDomain(const QString &domainName) const;
60 QString mEmailAddress;
61};
62}
Q_SCRIPTABLE Q_NOREPLY void start()
KIOCORE_EXPORT bool operator!=(const UDSEntry &entry, const UDSEntry &other)
bool isValid(QStringView ifopt)
bool operator==(const StyleDelim &l, const StyleDelim &r)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 22 2024 12:05:10 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.