Skip to content

Commit

Permalink
Use QSet for reactions
Browse files Browse the repository at this point in the history
  • Loading branch information
Ri0n committed Jun 23, 2024
1 parent 9009b34 commit 2b2265e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
5 changes: 4 additions & 1 deletion src/xmpp/xmpp-im/types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
#include <QList>
#include <QMap>

#include <optional>

#define NS_XML "http://www.w3.org/XML/1998/namespace"

namespace XMPP {
Expand Down Expand Up @@ -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();
}
}

Expand Down
7 changes: 3 additions & 4 deletions src/xmpp/xmpp-im/xmpp_message.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@
#include "xmpp_url.h"

#include <QExplicitlySharedDataPointer>

#include <optional>
#include <QSet>

class QDateTime;
class QString;
Expand Down Expand Up @@ -69,8 +68,8 @@ class Message {
};

struct Reactions {
QString targetId;
QStringList reactions;
QString targetId;
QSet<QString> reactions;
};

Message();
Expand Down

0 comments on commit 2b2265e

Please sign in to comment.