Commit be4b27df authored by Sandro Knauß's avatar Sandro Knauß
Browse files

messagecore/autocrypt: use unique_ptr to keep private data.

parent 8b76f518
......@@ -4,7 +4,8 @@
*/
#include "autocryptrecipienttest.h"
#include <autocrypt/autocryptrecipient.h>
#include "autocrypt/autocryptrecipient.h"
#include "autocrypt/autocryptrecipient_p.h"
#include <MimeTreeParser/ObjectTreeParser>
#include <MimeTreeParser/SimpleObjectTreeSource>
......
......@@ -5,7 +5,7 @@
*/
#include "autocryptrecipient.h"
#include "messagecore_debug.h"
#include "autocryptrecipient_p.h"
#include<KMime/Headers>
......@@ -44,29 +44,6 @@ const KMime::Headers::Base * HeaderMixupNodeHelper::mailHeaderAsBase (const char
return nodeHelper->mailHeaderAsBase(header, message);
}
class AutocryptRecipientPrivate
{
public:
AutocryptRecipientPrivate();
QByteArray toJson(QJsonDocument::JsonFormat format) const;
void fromJson(const QByteArray &json);
public:
QByteArray addr;
QByteArray bad_user_agent;
QByteArray keydata;
QByteArray gossip_key;
QDateTime last_seen;
QDateTime autocrypt_timestamp;
QDateTime counting_since;
QDateTime gossip_timestamp;
int count_have_ach;
int count_no_ach;
bool prefer_encrypt;
bool changed;
};
AutocryptRecipientPrivate::AutocryptRecipientPrivate()
: count_have_ach(0)
, count_no_ach(0)
......@@ -148,11 +125,6 @@ AutocryptRecipient::AutocryptRecipient()
{
}
AutocryptRecipient::~AutocryptRecipient()
{
delete d_ptr;
}
void AutocryptRecipient::updateFromMessage(const HeaderMixupNodeHelper& mixup )
{
Q_D(AutocryptRecipient);
......
......@@ -14,11 +14,12 @@
#include <QJsonDocument>
class AutocryptRecipientPrivate;
class AutocryptRecipientTest;
namespace MessageCore {
class AutocryptRecipientPrivate;
class HeaderMixupNodeHelper
{
public:
......@@ -39,7 +40,6 @@ class AutocryptRecipient
{
public:
AutocryptRecipient();
~AutocryptRecipient();
void updateFromMessage(const HeaderMixupNodeHelper &mixup);
void updateFromGossip(const HeaderMixupNodeHelper& mixup, const KMime::Headers::Base* header);
......@@ -53,7 +53,7 @@ public:
GpgME::Key gossipKey() const;
private:
AutocryptRecipientPrivate *d_ptr;
std::unique_ptr<AutocryptRecipientPrivate> d_ptr;
Q_DECLARE_PRIVATE(AutocryptRecipient)
friend class AutocryptRecipientTest;
......
/*
SPDX-FileCopyrightText: 2020 Sandro Knauß <knauss@kde.org>
SPDX-License-Identifier: LGPL-2.0-or-later
*/
#ifndef AUTOCRYPTRECIPIENT_P_H
#define AUTOCRYPTRECIPIENT_P_H
#include <QJsonDocument>
namespace MessageCore {
class AutocryptRecipientPrivate
{
public:
AutocryptRecipientPrivate();
QByteArray toJson(QJsonDocument::JsonFormat format) const;
void fromJson(const QByteArray &json);
public:
QByteArray addr;
QByteArray bad_user_agent;
QByteArray keydata;
QByteArray gossip_key;
QDateTime last_seen;
QDateTime autocrypt_timestamp;
QDateTime counting_since;
QDateTime gossip_timestamp;
int count_have_ach;
int count_no_ach;
bool prefer_encrypt;
bool changed;
};
}
#endif
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment