Skip to content

Commit 2b2265e

Browse files
committed
Use QSet for reactions
1 parent 9009b34 commit 2b2265e

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

src/xmpp/xmpp-im/types.cpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
#include <QList>
3030
#include <QMap>
3131

32+
#include <optional>
33+
3234
#define NS_XML "http://www.w3.org/XML/1998/namespace"
3335

3436
namespace XMPP {
@@ -1810,9 +1812,10 @@ bool Message::fromStanza(const Stanza &s, bool useTimeZoneOffset, int timeZoneOf
18101812
auto reactionTag = QStringLiteral("reaction");
18111813
auto reaction = reactionStanza.firstChildElement(reactionTag);
18121814
while (!reaction.isNull()) {
1813-
d->reactions.reactions.append(reaction.text().trimmed());
1815+
d->reactions.reactions.insert(reaction.text().trimmed());
18141816
reaction = reaction.nextSiblingElement(reactionTag);
18151817
}
1818+
d->reactions.reactions.squeeze();
18161819
}
18171820
}
18181821

src/xmpp/xmpp-im/xmpp_message.h

+3-4
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@
2929
#include "xmpp_url.h"
3030

3131
#include <QExplicitlySharedDataPointer>
32-
33-
#include <optional>
32+
#include <QSet>
3433

3534
class QDateTime;
3635
class QString;
@@ -69,8 +68,8 @@ class Message {
6968
};
7069

7170
struct Reactions {
72-
QString targetId;
73-
QStringList reactions;
71+
QString targetId;
72+
QSet<QString> reactions;
7473
};
7574

7675
Message();

0 commit comments

Comments
 (0)