Skip to content

Commit

Permalink
Add storage hint for reactions
Browse files Browse the repository at this point in the history
  • Loading branch information
Ri0n committed Jun 28, 2024
1 parent 2b2265e commit c94e7df
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/xmpp/xmpp-im/types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit c94e7df

Please sign in to comment.