@@ -752,6 +752,7 @@ class Message::Private : public QSharedData {
752
752
Message::StanzaId stanzaId; // XEP-0359
753
753
QList<Reference> references; // XEP-0385 and XEP-0372
754
754
Message::Reactions reactions; // XEP-0444
755
+ QString retraction; // XEP-0424
755
756
};
756
757
757
758
#define MessageD () (d ? d : (d = new Private))
@@ -1103,6 +1104,10 @@ void Message::setReactions(const XMPP::Message::Reactions &reactions) { MessageD
1103
1104
1104
1105
XMPP::Message::Reactions Message::reactions () const { return d ? d->reactions : Reactions {}; }
1105
1106
1107
+ void Message::setRetraction (const QString &retractedMessageId) { MessageD ()->retraction = retractedMessageId; }
1108
+
1109
+ QString Message::retraction () const { return d ? d->retraction : QString {}; }
1110
+
1106
1111
QString Message::invite () const { return d ? d->invite : QString (); }
1107
1112
1108
1113
void Message::setInvite (const QString &s) { MessageD ()->invite = s; }
@@ -1452,6 +1457,14 @@ Stanza Message::toStanza(Stream *stream) const
1452
1457
s.appendChild (s.createElement (QStringLiteral (" urn:xmpp:hints" ), QStringLiteral (" store" )));
1453
1458
}
1454
1459
1460
+ // XEP-0424
1461
+ if (!d->retraction .isEmpty ()) {
1462
+ auto e = s.createElement (" urn:xmpp:message-retract:1" , QStringLiteral (" retract" ));
1463
+ e.setAttribute (QLatin1String (" id" ), d->retraction );
1464
+ s.appendChild (e);
1465
+ s.appendChild (s.createElement (QStringLiteral (" urn:xmpp:hints" ), QStringLiteral (" store" )));
1466
+ }
1467
+
1455
1468
return s;
1456
1469
}
1457
1470
@@ -1820,6 +1833,11 @@ bool Message::fromStanza(const Stanza &s, bool useTimeZoneOffset, int timeZoneOf
1820
1833
}
1821
1834
}
1822
1835
1836
+ // XEP-0424 message retraction
1837
+ d->retraction = childElementsByTagNameNS (root, " urn:xmpp:message-retract:1" , QStringLiteral (" retract" ))
1838
+ .item (0 )
1839
+ .toElement ()
1840
+ .attribute (QLatin1String (" id" ));
1823
1841
return true ;
1824
1842
}
1825
1843
0 commit comments