Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
PIM
PIM Messagelib
Commits
5e90c7b2
Commit
5e90c7b2
authored
Jun 04, 2020
by
Laurent Montel
Browse files
Move code in dmarcmanager class
parent
05cf526e
Pipeline
#22428
passed with stage
in 19 minutes and 33 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
messageviewer/src/CMakeLists.txt
View file @
5e90c7b2
...
...
@@ -93,6 +93,7 @@ if (${Qca-qt5_FOUND})
dkim-verify/dkimmanageruleswidget.cpp
dkim-verify/dkimruledialog.cpp
dkim-verify/dkimrulewidget.cpp
dkim-verify/dmarcmanager.cpp
)
endif
()
...
...
messageviewer/src/dkim-verify/dkimcheckpolicyjob.cpp
View file @
5e90c7b2
...
...
@@ -20,11 +20,10 @@
#include
"dkimcheckpolicyjob.h"
#include
"dmarcpolicyjob.h"
#include
"dkim-verify/dkimmanagerrules.h"
#include
"dkim-verify/dkimutil.h"
#include
"settings/messageviewersettings.h"
#include
"messageviewer_dkimcheckerdebug.h"
#include
"dkim-verify/dmarcmanager.h"
#include
<KConfigGroup>
using
namespace
MessageViewer
;
DKIMCheckPolicyJob
::
DKIMCheckPolicyJob
(
QObject
*
parent
)
:
QObject
(
parent
)
...
...
@@ -49,10 +48,7 @@ bool DKIMCheckPolicyJob::start()
return
false
;
}
if
(
mPolicy
.
useDMarc
())
{
const
KSharedConfig
::
Ptr
&
config
=
KSharedConfig
::
openConfig
(
MessageViewer
::
DKIMUtil
::
defaultConfigFileName
(),
KConfig
::
NoGlobals
);
KConfigGroup
grp
(
config
,
"NoExistingDmarcServer"
);
const
QStringList
addressList
=
grp
.
readEntry
(
"AddressList"
,
QStringList
());
if
(
addressList
.
contains
(
mEmailAddress
))
{
if
(
DMARCManager
::
self
()
->
isNoDMarcServerAddress
(
mEmailAddress
))
{
Q_EMIT
result
(
mCheckResult
);
deleteLater
();
return
true
;
...
...
@@ -121,13 +117,7 @@ void DKIMCheckPolicyJob::dmarcPolicyResult(const MessageViewer::DMARCPolicyJob::
mCheckResult
.
sdid
=
value
.
mSource
;
}
}
else
{
const
KSharedConfig
::
Ptr
&
config
=
KSharedConfig
::
openConfig
(
MessageViewer
::
DKIMUtil
::
defaultConfigFileName
(),
KConfig
::
NoGlobals
);
KConfigGroup
grp
(
config
,
"NoExistingDmarcServer"
);
QStringList
addressList
=
grp
.
readEntry
(
"AddressList"
,
QStringList
());
if
(
!
addressList
.
contains
(
emailAddress
))
{
addressList
.
append
(
emailAddress
);
grp
.
writeEntry
(
"AddressList"
,
addressList
);
}
DMARCManager
::
self
()
->
addNoDMarcServerAddress
(
emailAddress
);
}
Q_EMIT
result
(
mCheckResult
);
deleteLater
();
...
...
messageviewer/src/dkim-verify/dmarcmanager.cpp
0 → 100644
View file @
5e90c7b2
/*
Copyright (C) 2020 Laurent Montel <montel@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#include
"dmarcmanager.h"
#include
"dkimutil.h"
#include
<KConfigGroup>
#include
<KSharedConfig>
using
namespace
MessageViewer
;
DMARCManager
::
DMARCManager
()
{
loadNoServerKeys
();
}
DMARCManager
::~
DMARCManager
()
{
saveNoServerKeys
();
}
DMARCManager
*
DMARCManager
::
self
()
{
static
DMARCManager
s_self
;
return
&
s_self
;
}
bool
DMARCManager
::
isNoDMarcServerAddress
(
const
QString
&
address
)
const
{
return
mNoDMarcServer
.
contains
(
address
);
}
void
DMARCManager
::
addNoDMarcServerAddress
(
const
QString
&
address
)
{
if
(
!
mNoDMarcServer
.
contains
(
address
))
{
mNoDMarcServer
.
append
(
address
);
}
}
void
DMARCManager
::
saveNoServerKeys
()
{
const
KSharedConfig
::
Ptr
&
config
=
KSharedConfig
::
openConfig
(
MessageViewer
::
DKIMUtil
::
defaultConfigFileName
(),
KConfig
::
NoGlobals
);
KConfigGroup
grp
(
config
,
"NoExistingDmarcServer"
);
grp
.
writeEntry
(
"AddressList"
,
mNoDMarcServer
);
}
void
DMARCManager
::
loadNoServerKeys
()
{
const
KSharedConfig
::
Ptr
&
config
=
KSharedConfig
::
openConfig
(
MessageViewer
::
DKIMUtil
::
defaultConfigFileName
(),
KConfig
::
NoGlobals
);
KConfigGroup
grp
(
config
,
"NoExistingDmarcServer"
);
mNoDMarcServer
=
grp
.
readEntry
(
"AddressList"
,
QStringList
());
}
messageviewer/src/dkim-verify/dmarcmanager.h
0 → 100644
View file @
5e90c7b2
/*
Copyright (C) 2020 Laurent Montel <montel@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef DMARCMANAGER_H
#define DMARCMANAGER_H
#include
<QStringList>
namespace
MessageViewer
{
class
DMARCManager
{
public:
DMARCManager
();
~
DMARCManager
();
static
DMARCManager
*
self
();
void
addNoDMarcServerAddress
(
const
QString
&
address
);
Q_REQUIRED_RESULT
bool
isNoDMarcServerAddress
(
const
QString
&
address
)
const
;
private:
void
saveNoServerKeys
();
void
loadNoServerKeys
();
QStringList
mNoDMarcServer
;
};
}
#endif // DMARCMANAGER_H
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment