From 76c42a9863b83229e6afaf4be32e9582e3d97d3f Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Sat, 14 Oct 2017 01:22:04 +0200 Subject: 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 --- events/roommemberevent.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'events/roommemberevent.cpp') 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; -- cgit v1.2.3