Messagelib

dkimrule.cpp
1 /*
2  SPDX-FileCopyrightText: 2019-2023 Laurent Montel <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6 
7 #include "dkimrule.h"
8 
9 using namespace MessageViewer;
10 DKIMRule::DKIMRule() = default;
11 
12 QString DKIMRule::domain() const
13 {
14  return mDomain;
15 }
16 
17 void DKIMRule::setDomain(const QString &domain)
18 {
19  mDomain = domain;
20 }
21 
22 QStringList DKIMRule::signedDomainIdentifier() const
23 {
24  return mSignedDomainIdentifier;
25 }
26 
27 void DKIMRule::setSignedDomainIdentifier(const QStringList &signedDomainIdentifier)
28 {
29  mSignedDomainIdentifier = signedDomainIdentifier;
30 }
31 
32 QString DKIMRule::from() const
33 {
34  return mFrom;
35 }
36 
37 void DKIMRule::setFrom(const QString &from)
38 {
39  mFrom = from;
40 }
41 
42 bool DKIMRule::enabled() const
43 {
44  return mEnabled;
45 }
46 
47 void DKIMRule::setEnabled(bool enabled)
48 {
49  mEnabled = enabled;
50 }
51 
52 bool DKIMRule::isValid() const
53 {
54  return !mDomain.isEmpty() && !mFrom.isEmpty() && (mRuleType != DKIMRule::RuleType::Unknown);
55 }
56 
57 DKIMRule::RuleType DKIMRule::ruleType() const
58 {
59  return mRuleType;
60 }
61 
62 void DKIMRule::setRuleType(RuleType ruleType)
63 {
64  mRuleType = ruleType;
65 }
66 
67 QString DKIMRule::listId() const
68 {
69  return mListId;
70 }
71 
72 void DKIMRule::setListId(const QString &listId)
73 {
74  mListId = listId;
75 }
76 
77 bool DKIMRule::operator==(const DKIMRule &other) const
78 {
79  if (other.domain() == mDomain && other.signedDomainIdentifier() == mSignedDomainIdentifier && other.from() == mFrom && other.listId() == mListId
80  && other.ruleType() == mRuleType && other.enabled() == mEnabled && other.priority() == mPriority) {
81  return true;
82  }
83  return false;
84 }
85 
86 bool DKIMRule::operator!=(const DKIMRule &other) const
87 {
88  return !operator==(other);
89 }
90 
91 int DKIMRule::priority() const
92 {
93  return mPriority;
94 }
95 
96 void DKIMRule::setPriority(int priority)
97 {
98  mPriority = priority;
99 }
100 
101 QDebug operator<<(QDebug d, const DKIMRule &t)
102 {
103  d << " mDomain: " << t.domain();
104  d << " mSignedDomainIdentifier: " << t.signedDomainIdentifier();
105  d << " mFrom: " << t.from();
106  d << " mEnabled: " << t.enabled();
107  d << " mRuleType " << t.ruleType();
108  d << " mListId " << t.listId();
109  d << " mPriority " << t.priority();
110  return d;
111 }
112 
113 #include "moc_dkimrule.cpp"
KCALENDARCORE_EXPORT QDataStream & operator<<(QDataStream &out, const KCalendarCore::Alarm::Ptr &)
bool isEmpty() const const
The DKIMRule class.
Definition: dkimrule.h:17
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Sat Sep 23 2023 03:56:10 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.