diff --git a/CMakeLists.txt b/CMakeLists.txt index 941f99e0..4cc2d58c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,140 +1,140 @@ cmake_minimum_required(VERSION 3.5) -set(PIM_VERSION "5.12.63") +set(PIM_VERSION "5.12.64") if (POLICY CMP0053) cmake_policy(SET CMP0053 NEW) endif() project(Messagelib VERSION ${PIM_VERSION}) option(MIMETREEPARSER_ONLY_BUILD "Build only mimetreeparser" FALSE) option(KDEPIM_ENTERPRISE_BUILD "Enable features specific to the enterprise branch, which are normally disabled. Also, it disables many components not needed for Kontact such as the Kolab client." FALSE) option(KDEPIM_RUN_AKONADI_TEST "Enable autotest based on Akonadi." TRUE) set(KF5_MIN_VERSION "5.63.0") set(MESSAGELIB_LIB_VERSION ${PIM_VERSION}) set(AKONADIMIME_LIB_VERSION "5.12.40") set(QT_REQUIRED_VERSION "5.11.0") set(AKONADI_VERSION "5.12.40") set(GRANTLEETHEME_LIB_VERSION "5.12.40") set(GRAVATAR_LIB_VERSION "5.12.40") set(IDENTITYMANAGEMENT_LIB_VERSION "5.12.40") set(KDEPIM_APPS_LIB_VERSION "5.12.40") set(KLDAP_LIB_VERSION "5.12.40") set(KMAILTRANSPORT_LIB_VERSION "5.12.40") set(KMBOX_LIB_VERSION "5.12.40") set(KMIME_LIB_VERSION "5.12.40") set(KPIMTEXTEDIT_LIB_VERSION "5.12.42") set(LIBKDEPIM_LIB_VERSION "5.12.40") set(LIBKLEO_LIB_VERSION "5.12.40") set(PIMCOMMON_LIB_VERSION "5.12.40") set(GPGME_LIB_VERSION "1.11.1") set(AKONADI_CONTACT_VERSION "5.12.42") if (${MIMETREEPARSER_ONLY_BUILD}) set(ECM_VERSION "5.26.0") set(KMIME_LIB_VERSION "5.1.40") else() set(ECM_VERSION ${KF5_MIN_VERSION}) endif() find_package(ECM ${ECM_VERSION} CONFIG REQUIRED) set(CMAKE_MODULE_PATH ${Messagelib_SOURCE_DIR}/cmake/modules ${ECM_MODULE_PATH}) set(LIBRARY_NAMELINK) include(KDEInstallDirs) include(KDECMakeSettings) include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE) include(GenerateExportHeader) include(ECMSetupVersion) include(ECMGenerateHeaders) include(ECMGeneratePriFile) include(FeatureSummary) include(ECMQtDeclareLoggingCategory) include(ECMAddTests) find_package(Qt5 ${QT_REQUIRED_VERSION} CONFIG REQUIRED Gui Test) find_package(KF5Codecs ${KF5_MIN_VERSION} CONFIG REQUIRED) find_package(KF5I18n ${KF5_MIN_VERSION} CONFIG REQUIRED) find_package(KF5Mime ${KMIME_LIB_VERSION} CONFIG REQUIRED) find_package(KF5NewStuff ${KMIME_LIB_VERSION} CONFIG REQUIRED) find_package(QGpgme ${GPGME_LIB_VERSION} CONFIG REQUIRED) if (NOT ${MIMETREEPARSER_ONLY_BUILD}) find_package(Qt5 ${QT_REQUIRED_VERSION} CONFIG REQUIRED Widgets Network PrintSupport WebEngine WebEngineWidgets) find_package(KF5Archive ${KF5_MIN_VERSION} CONFIG REQUIRED) find_package(KF5Completion ${KF5_MIN_VERSION} CONFIG REQUIRED) find_package(KF5Config ${KF5_MIN_VERSION} CONFIG REQUIRED) find_package(KF5ConfigWidgets ${KF5_MIN_VERSION} CONFIG REQUIRED) find_package(KF5IconThemes ${KF5_MIN_VERSION} CONFIG REQUIRED) find_package(KF5ItemViews ${KF5_MIN_VERSION} CONFIG REQUIRED) find_package(KF5JobWidgets ${KF5_MIN_VERSION} CONFIG REQUIRED) find_package(KF5KIO ${KF5_MIN_VERSION} CONFIG REQUIRED) find_package(KF5Service ${KF5_MIN_VERSION} CONFIG REQUIRED) find_package(KF5Sonnet ${KF5_MIN_VERSION} CONFIG REQUIRED) find_package(KF5TextWidgets ${KF5_MIN_VERSION} CONFIG REQUIRED) find_package(KF5WidgetsAddons ${KF5_MIN_VERSION} CONFIG REQUIRED) find_package(KF5XmlGui ${KF5_MIN_VERSION} CONFIG REQUIRED) find_package(KF5SyntaxHighlighting ${KF5_MIN_VERSION} CONFIG REQUIRED) find_package(KF5DBusAddons ${KF5_MIN_VERSION} CONFIG REQUIRED) find_package(Grantlee5 "5.1" CONFIG REQUIRED) find_package(KF5Akonadi ${AKONADI_VERSION} CONFIG REQUIRED) find_package(KF5AkonadiMime ${AKONADIMIME_LIB_VERSION} CONFIG REQUIRED) find_package(KF5Contacts ${KF5_MIN_VERSION} CONFIG REQUIRED) find_package(KF5AkonadiContact ${AKONADI_CONTACT_VERSION} CONFIG REQUIRED) find_package(KF5FollowupReminder ${KDEPIM_APPS_LIB_VERSION} CONFIG REQUIRED) find_package(KF5GrantleeTheme ${GRANTLEETHEME_LIB_VERSION} CONFIG REQUIRED) find_package(KF5Gravatar ${GRAVATAR_LIB_VERSION} CONFIG REQUIRED) find_package(KF5IdentityManagement ${IDENTITYMANAGEMENT_LIB_VERSION} CONFIG REQUIRED) find_package(KF5KaddressbookGrantlee ${KDEPIM_APPS_LIB_VERSION} CONFIG REQUIRED) find_package(KF5Ldap ${KLDAP_LIB_VERSION} CONFIG REQUIRED) find_package(KF5LibkdepimAkonadi ${LIBKDEPIM_LIB_VERSION} CONFIG REQUIRED) find_package(KF5Libkleo ${LIBKLEO_LIB_VERSION} CONFIG REQUIRED) find_package(KF5MailTransportAkonadi ${KMAILTRANSPORT_LIB_VERSION} CONFIG REQUIRED) find_package(KF5Mbox ${KMBOX_LIB_VERSION} CONFIG REQUIRED) find_package(KF5PimCommonAkonadi ${PIMCOMMON_LIB_VERSION} CONFIG REQUIRED) find_package(KF5PimTextEdit ${KPIMTEXTEDIT_LIB_VERSION} CONFIG REQUIRED) find_package(KF5SendLater ${KDEPIM_APPS_LIB_VERSION} CONFIG REQUIRED) find_package(KF5AkonadiSearch "5.12.40" CONFIG REQUIRED) set_package_properties(KF5AkonadiSearch PROPERTIES DESCRIPTION "The Akonadi Search libraries" URL "https://kde.org/" TYPE REQUIRED PURPOSE "Provides search capabilities in KMail and Akonadi") endif() set(CMAKE_CXX_STANDARD 14) if (EXISTS "${CMAKE_SOURCE_DIR}/.git") add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x060000) endif() #add_definitions( # -DKCOREADDONS_DISABLE_DEPRECATED_BEFORE_AND_AT=0x060000 # -DKWINDOWSYSTEM_DISABLE_DEPRECATED_BEFORE_AND_AT=0x060000 # -DKWIDGETSADDONS_DISABLE_DEPRECATED_BEFORE_AND_AT=0x060000 # -DKPARTS_DISABLE_DEPRECATED_BEFORE_AND_AT=0x060000 # -DKTEXTWIDGETS_DISABLE_DEPRECATED_BEFORE_AND_AT=0x060000 # -DKSERVICE_DISABLE_DEPRECATED_BEFORE_AND_AT=0x060000) if(BUILD_TESTING) add_definitions(-DBUILD_TESTING) endif() add_subdirectory(mimetreeparser) if (NOT ${MIMETREEPARSER_ONLY_BUILD}) add_subdirectory(messageviewer) add_subdirectory(templateparser) add_subdirectory(messagecomposer) add_subdirectory(messagecore) add_subdirectory(messagelist) add_subdirectory(webengineviewer) endif() install(FILES messagelib.renamecategories messagelib.categories DESTINATION ${KDE_INSTALL_LOGGINGCATEGORIESDIR}) feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES) diff --git a/messageviewer/src/dkim-verify/autotests/dmarcpolicyjobtest.cpp b/messageviewer/src/dkim-verify/autotests/dmarcpolicyjobtest.cpp index 1b26e201..65fd92c3 100644 --- a/messageviewer/src/dkim-verify/autotests/dmarcpolicyjobtest.cpp +++ b/messageviewer/src/dkim-verify/autotests/dmarcpolicyjobtest.cpp @@ -1,34 +1,36 @@ /* Copyright (C) 2019 Laurent Montel 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 "dmarcpolicyjobtest.h" #include "dkim-verify/dmarcpolicyjob.h" #include QTEST_GUILESS_MAIN(DMARCPolicyJobTest) DMARCPolicyJobTest::DMARCPolicyJobTest(QObject *parent) : QObject(parent) { } void DMARCPolicyJobTest::shouldHaveDefaultValues() { MessageViewer::DMARCPolicyJob job; + QVERIFY(job.emailAddress().isEmpty()); + QVERIFY(!job.canStart()); //TODO } diff --git a/messageviewer/src/dkim-verify/dkimkeyrecord.h b/messageviewer/src/dkim-verify/dkimkeyrecord.h index a0ba7a0a..16dc5328 100644 --- a/messageviewer/src/dkim-verify/dkimkeyrecord.h +++ b/messageviewer/src/dkim-verify/dkimkeyrecord.h @@ -1,69 +1,69 @@ /* Copyright (C) 2019 Laurent Montel 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 DKIMKEYRECORD_H #define DKIMKEYRECORD_H -#include "messageviewer_private_export.h" +#include "messageviewer_export.h" #include #include #include namespace MessageViewer { -class MESSAGEVIEWER_TESTS_EXPORT DKIMKeyRecord +class MESSAGEVIEWER_EXPORT DKIMKeyRecord { public: DKIMKeyRecord(); Q_REQUIRED_RESULT bool parseKey(const QString &key); Q_REQUIRED_RESULT QString version() const; void setVersion(const QString &version); Q_REQUIRED_RESULT QString keyType() const; void setKeyType(const QString &keyType); Q_REQUIRED_RESULT QString note() const; void setNote(const QString ¬e); Q_REQUIRED_RESULT QString publicKey() const; void setPublicKey(const QString &publicKey); Q_REQUIRED_RESULT QString service() const; void setService(const QString &service); Q_REQUIRED_RESULT QStringList hashAlgorithm() const; void setHashAlgorithm(const QStringList &hashAlgorithm); Q_REQUIRED_RESULT QStringList flags() const; void setFlags(const QStringList &flags); Q_REQUIRED_RESULT bool operator==(const DKIMKeyRecord &other) const; private: QString mVersion; QString mKeyType; QString mNote; QString mPublicKey; QString mService; QStringList mHashAlgorithm; QStringList mFlags; }; } Q_DECLARE_METATYPE(MessageViewer::DKIMKeyRecord) MESSAGEVIEWER_EXPORT QDebug operator <<(QDebug d, const MessageViewer::DKIMKeyRecord &t); #endif // DKIMKEYRECORD_H diff --git a/messageviewer/src/dkim-verify/dmarcpolicyjob.cpp b/messageviewer/src/dkim-verify/dmarcpolicyjob.cpp index 72fe44eb..eca48a4a 100644 --- a/messageviewer/src/dkim-verify/dmarcpolicyjob.cpp +++ b/messageviewer/src/dkim-verify/dmarcpolicyjob.cpp @@ -1,40 +1,90 @@ /* Copyright (C) 2019 Laurent Montel 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 "dmarcpolicyjob.h" +#include "dmarcrecordjob.h" +#include "dmarcinfo.h" +#include "messageviewer_dkimcheckerdebug.h" using namespace MessageViewer; DMARCPolicyJob::DMARCPolicyJob(QObject *parent) : QObject(parent) { } DMARCPolicyJob::~DMARCPolicyJob() { } bool DMARCPolicyJob::canStart() const +{ + return !mEmailAddress.isEmpty(); +} + +bool DMARCPolicyJob::start() +{ + if (!canStart()) { + qCWarning(MESSAGEVIEWER_DKIMCHECKER_LOG) << " Impossible to start DMARCPolicyJob"; + deleteLater(); + //TODO emit result + //Q_EMIT ... //TODO + return false; + } + + const QString emailDomainStr = emailDomain(); + DMARCRecordJob *job = new DMARCRecordJob(this); + //TODO ??? + connect(job, &MessageViewer::DMARCRecordJob::success, this, &DMARCPolicyJob::slotCheckDomain); + + connect(job, &MessageViewer::DMARCRecordJob::error, this, [](const QString &err, const QString &domainName) { + qDebug() << "error: " << err << " domain " << domainName; + }); + + job->setDomainName(emailDomainStr); + if (!job->start()) { + //TODO emit result + deleteLater(); + return false; + } + return true; +} + + +void DMARCPolicyJob::slotCheckDomain(const QList &lst, const QString &domainName) +{ + + qDebug() << "domainName: " << domainName << " lst " << lst; + //Parse result +} + +QString DMARCPolicyJob::emailDomain() const { //TODO - return false; + return {}; +} + +QString DMARCPolicyJob::emailAddress() const +{ + return mEmailAddress; } -void DMARCPolicyJob::start() +void DMARCPolicyJob::setEmailAddress(const QString &emailAddress) { + mEmailAddress = emailAddress; } diff --git a/messageviewer/src/dkim-verify/dmarcpolicyjob.h b/messageviewer/src/dkim-verify/dmarcpolicyjob.h index 9e6df138..8fafbbe9 100644 --- a/messageviewer/src/dkim-verify/dmarcpolicyjob.h +++ b/messageviewer/src/dkim-verify/dmarcpolicyjob.h @@ -1,38 +1,49 @@ /* Copyright (C) 2019 Laurent Montel 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 DMARCPOLICYJOB_H #define DMARCPOLICYJOB_H #include +#include "dmarcinfo.h" #include "messageviewer_private_export.h" namespace MessageViewer { class MESSAGEVIEWER_TESTS_EXPORT DMARCPolicyJob : public QObject { Q_OBJECT public: explicit DMARCPolicyJob(QObject *parent = nullptr); ~DMARCPolicyJob(); Q_REQUIRED_RESULT bool canStart() const; - void start(); + Q_REQUIRED_RESULT bool start(); + + Q_REQUIRED_RESULT QString emailAddress() const; + void setEmailAddress(const QString &emailAddress); + +Q_SIGNALS: + void result(const MessageViewer::DMARCInfo &info); + +private: + void slotCheckDomain(const QList &lst, const QString &domainName); + Q_REQUIRED_RESULT QString emailDomain() const; + QString mEmailAddress; }; } - #endif // DMARCPOLICYJOB_H diff --git a/messageviewer/src/settings/messageviewer.kcfg.cmake b/messageviewer/src/settings/messageviewer.kcfg.cmake index 2091cdb7..040bc813 100644 --- a/messageviewer/src/settings/messageviewer.kcfg.cmake +++ b/messageviewer/src/settings/messageviewer.kcfg.cmake @@ -1,267 +1,273 @@ QFontDatabase false false true false QFontDatabase::systemFont(QFontDatabase::FixedFont) 8 QFontDatabase::systemFont(QFontDatabase::GeneralFont) QFontDatabase::systemFont(QFontDatabase::GeneralFont) false false 100.0 true false false Enable this option to show different levels of quoted text. Disable to hide the levels of quoted text. 3 0 10 false Enable this option to show quoted text with a smaller font. false Never 100 180 defaultgrantlee fancy rich false false Smart false true true true true 0 0 true 0 Microsoft Outlook has a number of shortcomings in its implementation of the iCalendar standard; this option works around one of them. If you have problems with Outlook users not being able to get your replies, try setting this option. ${LEGACY_MANGLE_FROM_TO_HEADERS} Microsoft Outlook has a number of shortcomings in its implementation of the iCalendar standard; this option works around one of them. If you have problems with Outlook users not being able to get your invitations, try setting this option. ${LEGACY_BODY_INVITES} Microsoft Outlook, when used in combination with a Microsoft Exchange server, has a problem understanding standards-compliant groupware email. Turn this option on to send groupware invitations in a way that Microsoft Exchange understands. ${EXCHANGE_COMPATIBLE_INVITATIONS} When this is checked, you will not see the mail composer window. Instead, all invitation mails are sent automatically. If you want to see the mail before sending it, you can uncheck this option. However, be aware that the text in the composer window is in iCalendar syntax, and you should not try modifying it by hand. true When this is checked, received invitation emails that have been replied to will be moved to the Trash folder, once the reply has been successfully sent. false AskForAllButAcceptance false The most recent selected folder using for Todo. -1 The most recent selected folder using for Event. -1 The most recent selected folder using for Notes. -1 false false false + + false + + + false +