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 #include "dkimrule.h" 0008 0009 using namespace MessageViewer; 0010 DKIMRule::DKIMRule() = default; 0011 0012 QString DKIMRule::domain() const 0013 { 0014 return mDomain; 0015 } 0016 0017 void DKIMRule::setDomain(const QString &domain) 0018 { 0019 mDomain = domain; 0020 } 0021 0022 QStringList DKIMRule::signedDomainIdentifier() const 0023 { 0024 return mSignedDomainIdentifier; 0025 } 0026 0027 void DKIMRule::setSignedDomainIdentifier(const QStringList &signedDomainIdentifier) 0028 { 0029 mSignedDomainIdentifier = signedDomainIdentifier; 0030 } 0031 0032 QString DKIMRule::from() const 0033 { 0034 return mFrom; 0035 } 0036 0037 void DKIMRule::setFrom(const QString &from) 0038 { 0039 mFrom = from; 0040 } 0041 0042 bool DKIMRule::enabled() const 0043 { 0044 return mEnabled; 0045 } 0046 0047 void DKIMRule::setEnabled(bool enabled) 0048 { 0049 mEnabled = enabled; 0050 } 0051 0052 bool DKIMRule::isValid() const 0053 { 0054 return !mDomain.isEmpty() && !mFrom.isEmpty() && (mRuleType != DKIMRule::RuleType::Unknown); 0055 } 0056 0057 DKIMRule::RuleType DKIMRule::ruleType() const 0058 { 0059 return mRuleType; 0060 } 0061 0062 void DKIMRule::setRuleType(RuleType ruleType) 0063 { 0064 mRuleType = ruleType; 0065 } 0066 0067 QString DKIMRule::listId() const 0068 { 0069 return mListId; 0070 } 0071 0072 void DKIMRule::setListId(const QString &listId) 0073 { 0074 mListId = listId; 0075 } 0076 0077 bool DKIMRule::operator==(const DKIMRule &other) const 0078 { 0079 if (other.domain() == mDomain && other.signedDomainIdentifier() == mSignedDomainIdentifier && other.from() == mFrom && other.listId() == mListId 0080 && other.ruleType() == mRuleType && other.enabled() == mEnabled && other.priority() == mPriority) { 0081 return true; 0082 } 0083 return false; 0084 } 0085 0086 bool DKIMRule::operator!=(const DKIMRule &other) const 0087 { 0088 return !operator==(other); 0089 } 0090 0091 int DKIMRule::priority() const 0092 { 0093 return mPriority; 0094 } 0095 0096 void DKIMRule::setPriority(int priority) 0097 { 0098 mPriority = priority; 0099 } 0100 0101 QDebug operator<<(QDebug d, const DKIMRule &t) 0102 { 0103 d << " mDomain: " << t.domain(); 0104 d << " mSignedDomainIdentifier: " << t.signedDomainIdentifier(); 0105 d << " mFrom: " << t.from(); 0106 d << " mEnabled: " << t.enabled(); 0107 d << " mRuleType " << t.ruleType(); 0108 d << " mListId " << t.listId(); 0109 d << " mPriority " << t.priority(); 0110 return d; 0111 } 0112 0113 #include "moc_dkimrule.cpp"