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

0001 /*
0002   SPDX-FileCopyrightText: 2021-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 namespace MessageViewer
0011 {
0012 /**
0013  * @brief The ScamDetectionInfo class
0014  * @author Laurent Montel <montel@kde.org>
0015  */
0016 class MESSAGEVIEWER_EXPORT ScamDetectionInfo
0017 {
0018 public:
0019     enum ScamDetectionField {
0020         None = 0,
0021         DisableAll = 1,
0022         RedirectUrl = 2,
0023         HasIp = 4,
0024     };
0025     Q_ENUMS(ScamDetectionField)
0026     Q_DECLARE_FLAGS(ScamDetectionFields, ScamDetectionField)
0027 
0028     ScamDetectionInfo();
0029     ~ScamDetectionInfo();
0030 
0031     [[nodiscard]] const QString &domainOrEmail() const;
0032     void setDomainOrEmail(const QString &newDomainOrEmail);
0033 
0034     [[nodiscard]] bool enabled() const;
0035     void setEnabled(bool newEnabled);
0036 
0037     [[nodiscard]] bool isValid() const;
0038 
0039     [[nodiscard]] ScamDetectionInfo::ScamDetectionFields scamChecks() const;
0040 
0041     [[nodiscard]] bool operator==(const ScamDetectionInfo &other) const;
0042 
0043 private:
0044     ScamDetectionFields mFields = None;
0045     QString mDomainOrEmail;
0046     bool mEnabled = false;
0047 };
0048 }
0049 Q_DECLARE_TYPEINFO(MessageViewer::ScamDetectionInfo, Q_RELOCATABLE_TYPE);
0050 MESSAGEVIEWER_EXPORT QDebug operator<<(QDebug d, const MessageViewer::ScamDetectionInfo &t);