aboutsummaryrefslogtreecommitdiff
path: root/events/roommemberevent.cpp
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2017-10-14 01:22:04 +0200
committerKitsune Ral <Kitsune-Ral@users.sf.net>2017-10-14 01:53:02 +0200
commit76c42a9863b83229e6afaf4be32e9582e3d97d3f (patch)
tree1aacf03ab8d9ae96e4f21f430d7e99ddf4b0bb10 /events/roommemberevent.cpp
parent2d3590dbdb23c82f1960327ffbd78e778231b9c8 (diff)
downloadlibquotient-76c42a9863b83229e6afaf4be32e9582e3d97d3f.tar.gz
libquotient-76c42a9863b83229e6afaf4be32e9582e3d97d3f.zip
Cleanup around Room (potentially breaks API compatibility, beware)
Notably: * API for SendEventJob and SetRoomStateJob has been altered to accept references, not pointers. * Methods on Room that invoke requests to the server, have lost const, because they may be reflecting the changed state on the fly, within themselves
Diffstat (limited to 'events/roommemberevent.cpp')
-rw-r--r--events/roommemberevent.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/events/roommemberevent.cpp b/events/roommemberevent.cpp
index 5973acc7..19f116d2 100644
--- a/events/roommemberevent.cpp
+++ b/events/roommemberevent.cpp
@@ -22,6 +22,9 @@
using namespace QMatrixClient;
+static const auto membershipStrings =
+ { "invite", "join", "knock", "leave", "ban" };
+
RoomMemberEvent::RoomMemberEvent(const QJsonObject& obj)
: RoomEvent(Type::RoomMember, obj), _userId(obj["state_key"].toString())
{
@@ -29,11 +32,10 @@ RoomMemberEvent::RoomMemberEvent(const QJsonObject& obj)
_displayName = contentObj["displayname"].toString();
_avatarUrl = contentObj["avatar_url"].toString();
QString membershipString = contentObj["membership"].toString();
- const auto supportedStrings = { "invite", "join", "knock", "leave", "ban" };
- for (auto it = supportedStrings.begin(); it != supportedStrings.end(); ++it)
+ for (auto it = membershipStrings.begin(); it != membershipStrings.end(); ++it)
if (membershipString == *it)
{
- _membership = MembershipType(it - supportedStrings.begin());
+ _membership = MembershipType(it - membershipStrings.begin());
return;
}
qCWarning(EVENTS) << "Unknown MembershipType: " << membershipString;