From 2b2265e6539dc8702e1d7a340f17136b6c99bf88 Mon Sep 17 00:00:00 2001 From: Sergei Ilinykh Date: Sun, 23 Jun 2024 16:14:48 +0300 Subject: [PATCH] Use QSet for reactions --- src/xmpp/xmpp-im/types.cpp | 5 ++++- src/xmpp/xmpp-im/xmpp_message.h | 7 +++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/xmpp/xmpp-im/types.cpp b/src/xmpp/xmpp-im/types.cpp index 86070907..b4d67ff3 100644 --- a/src/xmpp/xmpp-im/types.cpp +++ b/src/xmpp/xmpp-im/types.cpp @@ -29,6 +29,8 @@ #include #include +#include + #define NS_XML "http://www.w3.org/XML/1998/namespace" namespace XMPP { @@ -1810,9 +1812,10 @@ bool Message::fromStanza(const Stanza &s, bool useTimeZoneOffset, int timeZoneOf auto reactionTag = QStringLiteral("reaction"); auto reaction = reactionStanza.firstChildElement(reactionTag); while (!reaction.isNull()) { - d->reactions.reactions.append(reaction.text().trimmed()); + d->reactions.reactions.insert(reaction.text().trimmed()); reaction = reaction.nextSiblingElement(reactionTag); } + d->reactions.reactions.squeeze(); } } diff --git a/src/xmpp/xmpp-im/xmpp_message.h b/src/xmpp/xmpp-im/xmpp_message.h index d6a65824..61b13af1 100644 --- a/src/xmpp/xmpp-im/xmpp_message.h +++ b/src/xmpp/xmpp-im/xmpp_message.h @@ -29,8 +29,7 @@ #include "xmpp_url.h" #include - -#include +#include class QDateTime; class QString; @@ -69,8 +68,8 @@ class Message { }; struct Reactions { - QString targetId; - QStringList reactions; + QString targetId; + QSet reactions; }; Message();