Skip to content

Commit

Permalink
MessagePrivate: Modernize by using default values instead of ctor
Browse files Browse the repository at this point in the history
  • Loading branch information
lnjX committed Mar 21, 2024
1 parent 2da1df5 commit 13b3414
Showing 1 changed file with 11 additions and 28 deletions.
39 changes: 11 additions & 28 deletions src/base/QXmppMessage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,12 @@ enum StampType {
class QXmppMessagePrivate : public QSharedData
{
public:
QXmppMessagePrivate();

QString body;
QString e2eeFallbackBody;
QString subject;
QString thread;
QString parentThread;
QXmppMessage::Type type;
QXmppMessage::Type type = QXmppMessage::Chat;

// XEP-0066: Out of Band Data
QVector<QXmppOutOfBandUrl> outOfBandUrls;
Expand All @@ -92,18 +90,18 @@ class QXmppMessagePrivate : public QSharedData
QString xhtml;

// XEP-0085: Chat State Notifications
QXmppMessage::State state;
QXmppMessage::State state = QXmppMessage::None;

// XEP-0091: Legacy Delayed Delivery | XEP-0203: Delayed Delivery
QDateTime stamp;
StampType stampType;
StampType stampType = DelayedDelivery;

// XEP-0184: Message Delivery Receipts
QString receiptId;
bool receiptRequested;
bool receiptRequested = false;

// XEP-0224: Attention
bool attentionRequested;
bool attentionRequested = false;

// XEP-0231: Bits of Binary
QXmppBitsOfBinaryDataList bitsOfBinaryData;
Expand All @@ -114,20 +112,20 @@ class QXmppMessagePrivate : public QSharedData
QString mucInvitationReason;

// XEP-0280: Message Carbons
bool privatemsg;
bool isCarbonForwarded;
bool privatemsg = false;
bool isCarbonForwarded = false;

// XEP-0308: Last Message Correction
QString replaceId;

// XEP-0333: Chat Markers
bool markable;
QXmppMessage::Marker marker;
bool markable = false;
QXmppMessage::Marker marker = QXmppMessage::NoMarker;
QString markedId;
QString markedThread;

// XEP-0334: Message Processing Hints
quint8 hints;
quint8 hints = 0;

// XEP-0353: Jingle Message Initiation
std::optional<QXmppJingleMessageInitiationElement> jingleMessageInitiationElement;
Expand All @@ -149,7 +147,7 @@ class QXmppMessagePrivate : public QSharedData
QString encryptionName;

// XEP-0382: Spoiler messages
bool isSpoiler;
bool isSpoiler = false;
QString spoilerHint;
#ifdef BUILD_OMEMO
// XEP-0384: OMEMO Encryption
Expand All @@ -174,21 +172,6 @@ class QXmppMessagePrivate : public QSharedData
std::optional<QXmppCallInviteElement> callInviteElement;
};

QXmppMessagePrivate::QXmppMessagePrivate()
: type(QXmppMessage::Chat),
state(QXmppMessage::None),
stampType(DelayedDelivery),
receiptRequested(false),
attentionRequested(false),
privatemsg(false),
isCarbonForwarded(false),
markable(false),
marker(QXmppMessage::NoMarker),
hints(0),
isSpoiler(false)
{
}

/// Constructs a QXmppMessage.
///
/// \param from
Expand Down

0 comments on commit 13b3414

Please sign in to comment.