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 
0008 #include "scamdetectioninfo.h"
0009 using namespace MessageViewer;
0010 ScamDetectionInfo::ScamDetectionInfo() = default;
0011 
0012 ScamDetectionInfo::~ScamDetectionInfo() = default;
0013 
0014 const QString &ScamDetectionInfo::domainOrEmail() const
0015 {
0016     return mDomainOrEmail;
0017 }
0018 
0019 void ScamDetectionInfo::setDomainOrEmail(const QString &newDomainOrEmail)
0020 {
0021     mDomainOrEmail = newDomainOrEmail;
0022 }
0023 
0024 bool ScamDetectionInfo::enabled() const
0025 {
0026     return mEnabled;
0027 }
0028 
0029 void ScamDetectionInfo::setEnabled(bool newEnabled)
0030 {
0031     mEnabled = newEnabled;
0032 }
0033 
0034 bool ScamDetectionInfo::isValid() const
0035 {
0036     return !mDomainOrEmail.isEmpty();
0037 }
0038 
0039 ScamDetectionInfo::ScamDetectionFields ScamDetectionInfo::scamChecks() const
0040 {
0041     return mFields;
0042 }
0043 
0044 QDebug operator<<(QDebug d, const MessageViewer::ScamDetectionInfo &t)
0045 {
0046     d.space() << "isValid" << t.isValid();
0047     d.space() << "Enabled" << t.enabled();
0048     d.space() << "DomainOrName" << t.domainOrEmail();
0049     d.space() << "scamChecks" << t.scamChecks();
0050     return d;
0051 }
0052 
0053 bool ScamDetectionInfo::operator==(const ScamDetectionInfo &other) const
0054 {
0055     return domainOrEmail() == other.domainOrEmail() && enabled() == other.enabled() && scamChecks() == other.scamChecks();
0056 }