File indexing completed on 2025-03-09 04:54:30

0001 /*
0002    SPDX-FileCopyrightText: 2019-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 #include "messageviewer_export.h"
0009 #include <QDebug>
0010 
0011 namespace MessageViewer
0012 {
0013 /**
0014  * @brief The DKIMRule class
0015  * @author Laurent Montel <montel@kde.org>
0016  */
0017 class MESSAGEVIEWER_EXPORT DKIMRule
0018 {
0019     Q_GADGET
0020 public:
0021     enum class RuleType {
0022         Unknown = 0,
0023         MustBeSigned = 1,
0024         CanBeSigned = 2,
0025         IgnoreEmailNotSigned = 3,
0026     };
0027     Q_ENUM(RuleType)
0028 
0029     DKIMRule();
0030     [[nodiscard]] QString domain() const;
0031     void setDomain(const QString &domain);
0032 
0033     [[nodiscard]] QStringList signedDomainIdentifier() const;
0034     void setSignedDomainIdentifier(const QStringList &signedDomainIdentifier);
0035 
0036     [[nodiscard]] QString from() const;
0037     void setFrom(const QString &from);
0038 
0039     [[nodiscard]] bool enabled() const;
0040     void setEnabled(bool enabled);
0041 
0042     [[nodiscard]] bool isValid() const;
0043 
0044     [[nodiscard]] RuleType ruleType() const;
0045     void setRuleType(MessageViewer::DKIMRule::RuleType ruleType);
0046 
0047     [[nodiscard]] QString listId() const;
0048     void setListId(const QString &listId);
0049 
0050     [[nodiscard]] bool operator==(const DKIMRule &other) const;
0051     [[nodiscard]] bool operator!=(const DKIMRule &other) const;
0052 
0053     [[nodiscard]] int priority() const;
0054     void setPriority(int priority);
0055 
0056 private:
0057     QStringList mSignedDomainIdentifier;
0058     QString mDomain;
0059     QString mFrom;
0060     QString mListId;
0061     RuleType mRuleType = DKIMRule::RuleType::Unknown;
0062     int mPriority = 1000;
0063     bool mEnabled = true;
0064 };
0065 }
0066 Q_DECLARE_TYPEINFO(MessageViewer::DKIMRule, Q_RELOCATABLE_TYPE);
0067 MESSAGEVIEWER_EXPORT QDebug operator<<(QDebug d, const MessageViewer::DKIMRule &t);