From c94e7df8887a2836991b7132ee7ddf9132ad3acd Mon Sep 17 00:00:00 2001 From: Sergei Ilinykh Date: Fri, 28 Jun 2024 19:25:08 +0300 Subject: [PATCH] Add storage hint for reactions --- src/xmpp/xmpp-im/types.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/xmpp/xmpp-im/types.cpp b/src/xmpp/xmpp-im/types.cpp index b4d67ff3..497af45c 100644 --- a/src/xmpp/xmpp-im/types.cpp +++ b/src/xmpp/xmpp-im/types.cpp @@ -1449,6 +1449,7 @@ Stanza Message::toStanza(Stream *stream) const e.appendChild(s.createTextElement(reactionsNS, QStringLiteral("reaction"), reaction)); } s.appendChild(e); + s.appendChild(s.createElement(QStringLiteral("urn:xmpp:hints"), QStringLiteral("store"))); } return s; @@ -1804,13 +1805,13 @@ bool Message::fromStanza(const Stanza &s, bool useTimeZoneOffset, int timeZoneOf } // XEP-0444 message reactions - auto reactionStanza + auto reactions = childElementsByTagNameNS(root, "urn:xmpp:reactions:0", QStringLiteral("reactions")).item(0).toElement(); - if (!reactionStanza.isNull()) { - d->reactions.targetId = reactionStanza.attribute(QLatin1String("id")); + if (!reactions.isNull()) { + d->reactions.targetId = reactions.attribute(QLatin1String("id")); if (!d->reactions.targetId.isEmpty()) { auto reactionTag = QStringLiteral("reaction"); - auto reaction = reactionStanza.firstChildElement(reactionTag); + auto reaction = reactions.firstChildElement(reactionTag); while (!reaction.isNull()) { d->reactions.reactions.insert(reaction.text().trimmed()); reaction = reaction.nextSiblingElement(reactionTag);