Messagelib

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

KDE's Doxygen guidelines are available online.