Skip to content

Commit

Permalink
MixSubscriptionUpdate: Do not use d-pointer
Browse files Browse the repository at this point in the history
  • Loading branch information
melvo committed Mar 24, 2024
1 parent eeedda5 commit 9ceadc4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 20 deletions.
24 changes: 8 additions & 16 deletions src/base/QXmppMixIq.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,6 @@ static const QMap<QXmppMixConfigItem::Node, QStringView> NODES = {
{ QXmppMixConfigItem::Node::Presence, ns_mix_node_presence },
};

class QXmppMixSubscriptionUpdateIqPrivate : public QSharedData
{
public:
QXmppMixConfigItem::Nodes additions;
QXmppMixConfigItem::Nodes removals;
};

///
/// \class QXmppMixSubscriptionUpdateIq
///
Expand All @@ -63,7 +56,6 @@ class QXmppMixSubscriptionUpdateIqPrivate : public QSharedData
/// Constructs a MIX subscription update IQ.
///
QXmppMixSubscriptionUpdateIq::QXmppMixSubscriptionUpdateIq()
: d(new QXmppMixSubscriptionUpdateIqPrivate)
{
}

Expand All @@ -76,7 +68,7 @@ QXMPP_PRIVATE_DEFINE_RULE_OF_SIX(QXmppMixSubscriptionUpdateIq)
///
QXmppMixConfigItem::Nodes QXmppMixSubscriptionUpdateIq::additions() const
{
return d->additions;
return m_additions;
}

///
Expand All @@ -86,7 +78,7 @@ QXmppMixConfigItem::Nodes QXmppMixSubscriptionUpdateIq::additions() const
///
void QXmppMixSubscriptionUpdateIq::setAdditions(QXmppMixConfigItem::Nodes additions)
{
d->additions = additions;
m_additions = additions;
}

///
Expand All @@ -96,7 +88,7 @@ void QXmppMixSubscriptionUpdateIq::setAdditions(QXmppMixConfigItem::Nodes additi
///
QXmppMixConfigItem::Nodes QXmppMixSubscriptionUpdateIq::removals() const
{
return d->removals;
return m_removals;
}

///
Expand All @@ -106,7 +98,7 @@ QXmppMixConfigItem::Nodes QXmppMixSubscriptionUpdateIq::removals() const
///
void QXmppMixSubscriptionUpdateIq::setRemovals(QXmppMixConfigItem::Nodes removals)
{
d->removals = removals;
m_removals = removals;
}

bool QXmppMixSubscriptionUpdateIq::isMixSubscriptionUpdateIq(const QDomElement &element)
Expand All @@ -129,23 +121,23 @@ void QXmppMixSubscriptionUpdateIq::parseElementFromChild(const QDomElement &elem
removals << node.attribute(QStringLiteral("node"));
}

d->additions = listToMixNodes(additions);
d->removals = listToMixNodes(removals);
m_additions = listToMixNodes(additions);
m_removals = listToMixNodes(removals);
}

void QXmppMixSubscriptionUpdateIq::toXmlElementFromChild(QXmlStreamWriter *writer) const
{
writer->writeStartElement(QSL65("update-subscription"));
writer->writeDefaultNamespace(toString65(ns_mix));

const auto additions = mixNodesToList(d->additions);
const auto additions = mixNodesToList(m_additions);
for (const auto &addition : additions) {
writer->writeStartElement(QSL65("subscribe"));
writer->writeAttribute(QSL65("node"), addition);
writer->writeEndElement();
}

const auto removals = mixNodesToList(d->removals);
const auto removals = mixNodesToList(m_removals);
for (const auto &removal : removals) {
writer->writeStartElement(QSL65("unsubscribe"));
writer->writeAttribute(QSL65("node"), removal);
Expand Down
6 changes: 2 additions & 4 deletions src/base/QXmppMixIq_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,8 @@
#include "QXmppMixConfigItem.h"
#include "QXmppMixInvitation.h"

#include <QSharedDataPointer>

class QXmppMixInvitationRequestIqPrivate;
class QXmppMixInvitationResponseIqPrivate;
class QXmppMixSubscriptionUpdateIqPrivate;

class QXMPP_EXPORT QXmppMixSubscriptionUpdateIq : public QXmppIq
{
Expand All @@ -37,7 +34,8 @@ class QXMPP_EXPORT QXmppMixSubscriptionUpdateIq : public QXmppIq
/// \endcond

private:
QSharedDataPointer<QXmppMixSubscriptionUpdateIqPrivate> d;
QXmppMixConfigItem::Nodes m_additions;
QXmppMixConfigItem::Nodes m_removals;
};

class QXMPP_EXPORT QXmppMixInvitationRequestIq : public QXmppIq
Expand Down

0 comments on commit 9ceadc4

Please sign in to comment.