Messagelib

dkimauthenticationstatusinfo.h
1/*
2 SPDX-FileCopyrightText: 2018-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 <QDebug>
11#include <QString>
12namespace MessageViewer
13{
14class MESSAGEVIEWER_TESTS_EXPORT DKIMAuthenticationStatusInfo
15{
16public:
17 DKIMAuthenticationStatusInfo();
18
19 struct AuthStatusInfo {
20 struct Property {
21 QString type;
22 QString value;
23 [[nodiscard]] bool isValid() const
24 {
25 return !type.isEmpty() && !value.isEmpty();
26 }
27
28 [[nodiscard]] bool operator==(const Property &other) const
29 {
30 return other.type == type && other.value == value;
31 }
32 };
33
34 QString method;
35 QString result;
36 QString reason;
37 int methodVersion = -1;
38
39 // Add Properties
40 QList<Property> smtp;
41 QList<Property> header;
42 QList<Property> body;
43 QList<Property> policy;
44
45 [[nodiscard]] bool operator==(const AuthStatusInfo &other) const;
46 [[nodiscard]] bool isValid() const;
47 };
48
49 [[nodiscard]] QString authservId() const;
50 void setAuthservId(const QString &authservId);
51
52 [[nodiscard]] bool parseAuthenticationStatus(const QString &key, bool relaxingParsing);
53
54 [[nodiscard]] int authVersion() const;
55 void setAuthVersion(int authVersion);
56
57 [[nodiscard]] QString reasonSpec() const;
58 void setReasonSpec(const QString &reasonSpec);
59
60 [[nodiscard]] bool operator==(const DKIMAuthenticationStatusInfo &other) const;
61
62 [[nodiscard]] QList<AuthStatusInfo> listAuthStatusInfo() const;
63 void setListAuthStatusInfo(const QList<AuthStatusInfo> &listAuthStatusInfo);
64
65private:
66 [[nodiscard]] AuthStatusInfo parseAuthResultInfo(QString &valueKey, bool relaxingParsing);
67 QList<AuthStatusInfo> mListAuthStatusInfo;
68 QString mAuthservId;
69 QString mReasonSpec;
70 int mAuthVersion = -1;
71};
72}
73Q_DECLARE_METATYPE(MessageViewer::DKIMAuthenticationStatusInfo)
74Q_DECLARE_TYPEINFO(MessageViewer::DKIMAuthenticationStatusInfo::AuthStatusInfo, Q_RELOCATABLE_TYPE);
75MESSAGEVIEWER_EXPORT QDebug operator<<(QDebug d, const MessageViewer::DKIMAuthenticationStatusInfo &t);
bool isValid(QStringView ifopt)
bool operator==(const StyleDelim &l, const StyleDelim &r)
QDebug operator<<(QDebug dbg, const PerceptualColor::MultiSpinBoxSection &value)
bool isEmpty() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:07:25 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.