Skip to content

Commit

Permalink
Merge branch 'contrib-pgp-signature' into 'master'
Browse files Browse the repository at this point in the history
[messagingframework] Update to upstream digital signatures. Contributes to JB#43783

See merge request mer-core/messagingframework!18
  • Loading branch information
chriadam committed Dec 19, 2018
2 parents ad366fd + 9da5410 commit 731e3fd
Show file tree
Hide file tree
Showing 3 changed files with 194 additions and 1 deletion.
188 changes: 188 additions & 0 deletions rpm/0020-Add-signature-settings-in-account.patch
@@ -0,0 +1,188 @@
From 6573f8dff024a3a863f9e70cc38f6cf5e2832509 Mon Sep 17 00:00:00 2001
From: Damien Caliste <dcaliste@free.fr>
Date: Mon, 5 Nov 2018 16:11:29 +0100
Subject: [PATCH] Add signature settings in account

---
src/libraries/qmfclient/qmailaccount.cpp | 48 ++++++++++++++++++++++++++++++++
src/libraries/qmfclient/qmailaccount.h | 6 ++++
src/libraries/qmfclient/qmailstore_p.cpp | 18 ++++++++++++
3 files changed, 72 insertions(+)

diff --git a/src/libraries/qmfclient/qmailaccount.cpp b/src/libraries/qmfclient/qmailaccount.cpp
index 8579636..b9381b9 100644
--- a/src/libraries/qmfclient/qmailaccount.cpp
+++ b/src/libraries/qmfclient/qmailaccount.cpp
@@ -61,6 +61,7 @@ static quint64 canCreateFoldersFlag = 0;
static quint64 useSmartReplyFlag = 0;
static quint64 canSearchOnServerFlag = 0;
static quint64 hasPersistentConnectionFlag = 0;
+static quint64 useCryptoSignatureFlag = 0;

class QMailAccountPrivate : public QSharedData
{
@@ -80,6 +81,8 @@ public:
QMailMessage::MessageType _messageType;
quint64 _status;
QString _signature;
+ QStringList _cryptoSignatureIds;
+ QString _cryptoSignatureType;
QMailTimeStamp _lastSynchronized;
QMailAddress _address;
QStringList _sources;
@@ -371,6 +374,7 @@ const quint64 &QMailAccount::CanCreateFolders = canCreateFoldersFlag;
const quint64 &QMailAccount::UseSmartReply = useSmartReplyFlag;
const quint64 &QMailAccount::CanSearchOnServer = canSearchOnServerFlag;
const quint64 &QMailAccount::HasPersistentConnection = hasPersistentConnectionFlag;
+const quint64 &QMailAccount::UseCryptoSignature = useCryptoSignatureFlag;

/*!
Creates an uninitialised account object.
@@ -480,6 +484,50 @@ void QMailAccount::setSignature(const QString &str)
}

/*!
+ Returns an id list configured for the account. These ids should be used to
+ numericaly sign an outgoing mail of this account.
+
+ \sa setCryptoSignatureIds()
+*/
+QStringList QMailAccount::cryptoSignatureIds() const
+{
+ return d->_cryptoSignatureIds;
+}
+
+/*!
+ Sets the ids configured for the account to \a str. These ids should be used
+ to numericaly sign an outgoing mail of this account.
+
+ \sa cryptoSignatureIds()
+*/
+void QMailAccount::setCryptoSignatureIds(const QStringList &ids)
+{
+ d->_cryptoSignatureIds = ids;
+}
+
+/*!
+ Returns a crypto type configured for the account. This type should be used to
+ numericaly sign an outgoing mail of this account.
+
+ \sa setCryptoSignatureType()
+*/
+QString QMailAccount::cryptoSignatureType() const
+{
+ return d->_cryptoSignatureType;
+}
+
+/*!
+ Sets the crypto type configured for the account to \a str. This type should be used
+ to numericaly sign an outgoing mail of this account.
+
+ \sa cryptoSignatureType()
+*/
+void QMailAccount::setCryptoSignatureType(const QString &type)
+{
+ d->_cryptoSignatureType = type;
+}
+
+/*!
Returns the time the account was last succesfully synchronized.

Should be updated by QMailRetrievalAction::retrieveMessageList() when an account is synchronized.
diff --git a/src/libraries/qmfclient/qmailaccount.h b/src/libraries/qmfclient/qmailaccount.h
index 8ba3efa..2eb24fe 100644
--- a/src/libraries/qmfclient/qmailaccount.h
+++ b/src/libraries/qmfclient/qmailaccount.h
@@ -77,6 +77,7 @@ public:
static const quint64 &UseSmartReply;
static const quint64 &CanSearchOnServer;
static const quint64 &HasPersistentConnection;
+ static const quint64 &UseCryptoSignature;

QMailAccount();
explicit QMailAccount(const QMailAccountId& id);
@@ -98,6 +99,11 @@ public:
QString signature() const;
void setSignature(const QString &str);

+ QStringList cryptoSignatureIds() const;
+ void setCryptoSignatureIds(const QStringList &ids);
+ QString cryptoSignatureType() const;
+ void setCryptoSignatureType(const QString &type);
+
QMailTimeStamp lastSynchronized() const;
void setLastSynchronized(const QMailTimeStamp &synced);

diff --git a/src/libraries/qmfclient/qmailstore_p.cpp b/src/libraries/qmfclient/qmailstore_p.cpp
index 599b573..f6af612 100644
--- a/src/libraries/qmfclient/qmailstore_p.cpp
+++ b/src/libraries/qmfclient/qmailstore_p.cpp
@@ -2671,6 +2671,10 @@ bool SSOAccountSatisfyTheProperty(Accounts::Account* ssoAccount, const QMailAcco
status &= (~QMailAccount::AppendSignature);
status |= appendSignature?(QMailAccount::AppendSignature):0;

+ bool useCryptoSignature = ssoAccount->valueAsBool("crypto/sign");
+ status &= (~QMailAccount::UseCryptoSignature);
+ status |= useCryptoSignature?(QMailAccount::UseCryptoSignature):0;
+
bool hasPersistentConnection = ssoAccount->valueAsBool("hasPersistentConnection", false);
status &= (~QMailAccount::HasPersistentConnection);
status |= hasPersistentConnection?(QMailAccount::HasPersistentConnection):0;
@@ -3224,6 +3228,8 @@ bool QMailStorePrivate::initStore()
63, true, const_cast<quint64 *>(&QMailMessage::Todo), t, false)
|| attemptRegisterStatusBit(QLatin1String("HasSignature"), QLatin1String("messagestatus"),
63, true, const_cast<quint64 *>(&QMailMessage::HasSignature), t, false)
+ || attemptRegisterStatusBit(QLatin1String("UseCryptoSignature"), QLatin1String("accountstatus"),
+ 63, true, const_cast<quint64 *>(&QMailAccount::UseCryptoSignature), t, false)
|| attemptRegisterStatusBit(QLatin1String("NoNotification"), QLatin1String("messagestatus"),
63, true, const_cast<quint64 *>(&QMailMessage::NoNotification), t, false);

@@ -3717,17 +3723,21 @@ QMailAccount QMailStorePrivate::extractAccount(const QSharedPointer<Accounts::Ac
const bool& canTransmit = ssoAccount->valueAsBool("canTransmit", true);
const bool& appendSignature = ssoAccount->valueAsBool("signatureEnabled", true);
const bool& hasPersistentConnection = ssoAccount->valueAsBool("hasPersistentConnection", false);
+ const bool& useCryptoSignature = ssoAccount->valueAsBool("crypto/sign");

result.setStatus(QMailAccount::Enabled, enabled);
result.setStatus(QMailAccount::PreferredSender, isDefault);
result.setStatus(QMailAccount::CanTransmit, canTransmit);
result.setStatus(QMailAccount::AppendSignature, appendSignature);
result.setStatus(QMailAccount::HasPersistentConnection, hasPersistentConnection);
+ result.setStatus(QMailAccount::UseCryptoSignature, useCryptoSignature);

result.setSignature(ssoAccount->valueAsString("signature"));
result.setFromAddress(ssoAccount->contains("fullName")?
QMailAddress(ssoAccount->valueAsString("fullName"),ssoAccount->valueAsString("emailaddress")):
QMailAddress(ssoAccount->valueAsString("emailaddress")));
+ result.setCryptoSignatureType(ssoAccount->valueAsString("crypto/pluginName"));
+ result.setCryptoSignatureIds(ssoAccount->value("crypto/keyNames").toStringList());

if ((static_cast<uint>(ssoAccount->valueAsUInt64("lastSynchronized"))) == 0) {
result.setLastSynchronized(QMailTimeStamp());
@@ -6229,7 +6239,11 @@ QMailStorePrivate::AttemptResult QMailStorePrivate::attemptAddAccount(QMailAccou
ssoAccount->setValue("signatureEnabled", appendSignature);
const bool hasPersistentConnection = (account->status() & QMailAccount::HasPersistentConnection);
ssoAccount->setValue("hasPersistentConnection", hasPersistentConnection);
+ const bool useCryptoSignature = (account->status() & QMailAccount::UseCryptoSignature);
+ ssoAccount->setValue("crypto/sign", useCryptoSignature);
ssoAccount->setValue("signature", account->signature());
+ ssoAccount->setValue("crypto/pluginName", account->cryptoSignatureType());
+ ssoAccount->setValue("crypto/keyNames", account->cryptoSignatureIds());
ssoAccount->setValue("emailaddress", account->fromAddress().address());
ssoAccount->setValue("fullName", account->fromAddress().name());
//Account was never synced
@@ -7033,7 +7047,11 @@ QMailStorePrivate::AttemptResult QMailStorePrivate::attemptUpdateAccount(QMailAc
ssoAccount->setValue("signatureEnabled", signatureEnabled);
bool hasPersistentConnection = account->status() & QMailAccount::HasPersistentConnection;
ssoAccount->setValue("hasPersistentConnection", hasPersistentConnection);
+ bool useCryptoSignature = account->status() & QMailAccount::UseCryptoSignature;
+ ssoAccount->setValue("crypto/sign", useCryptoSignature);
ssoAccount->setValue("signature", account->signature());
+ ssoAccount->setValue("crypto/pluginName", account->cryptoSignatureType());
+ ssoAccount->setValue("crypto/keyNames", account->cryptoSignatureIds());
ssoAccount->setValue("emailaddress", account->fromAddress().address());
ssoAccount->setValue("fullName", account->fromAddress().name());
if (account->lastSynchronized().isValid()) {
--
2.7.4

5 changes: 5 additions & 0 deletions rpm/qmf-qt5.spec
Expand Up @@ -24,6 +24,7 @@ BuildRequires: qt5-qttools-qthelp-devel
BuildRequires: qt5-plugin-platform-minimal
BuildRequires: qt5-plugin-sqldriver-sqlite
BuildRequires: fdupes
BuildRequires: gpgme-devel
Requires: buteo-syncfw-qt5 >= 0.7.16

Patch1: 0001-Stop-_incomingDataTimer-when-imapprotocol-object-is-.patch
Expand All @@ -45,6 +46,7 @@ Patch16: 0016-Do-AUTHENTICATE-PLAIN-in-two-stages.patch
Patch17: 0017-Prevent-push-enabled-status-to-go-out-of-sync.patch
Patch18: 0018-Check-if-IDLE-connection-needs-to-be-established-aft.patch
Patch19: 0019-Revert-Fix-bundled-zlib-detection.patch
Patch20: 0020-Add-signature-settings-in-account.patch

%description
The Qt Messaging Framework, QMF, consists of a C++ library and daemon server
Expand Down Expand Up @@ -105,6 +107,7 @@ This package contains:
%package -n libqmfclient1-qt5
Summary: Qt Messaging Framework (QMF) client library
Group: System/Libraries
Requires: dirmngr
Requires(post): /sbin/ldconfig
Requires(postun): /sbin/ldconfig

Expand Down Expand Up @@ -161,6 +164,7 @@ This package contains the tests for Qt Messaging Framework (QMF).
%patch17 -p1
%patch18 -p1
%patch19 -p1
%patch20 -p1

%build

Expand Down Expand Up @@ -234,6 +238,7 @@ ln -sf ../messageserver5-accounts-check.service "$UNIT_DIR/messageserver5-accoun
%{_libdir}/libQmfClient.so.*
%{_libdir}/qt5/plugins/contentmanagers/libqmfstoragemanager.so
%{_libdir}/qt5/plugins/ssoauth/
%{_libdir}/qt5/plugins/crypto/

%if 0
%files tests
Expand Down
2 changes: 1 addition & 1 deletion upstream
Submodule upstream updated from 2e9876 to 03bdfa

0 comments on commit 731e3fd

Please sign in to comment.