diff options
author | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2019-01-13 18:21:51 +0900 |
---|---|---|
committer | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2019-01-13 18:21:51 +0900 |
commit | d76424cb6c16cdef29761f00592db05989532a20 (patch) | |
tree | 538c41f9a7200888dfdf27baa535be9439c51f4a /lib | |
parent | 3cb7982fda8c0049eff51a9ab65eb43667e2c4ce (diff) | |
parent | e2c0148960e6e2b4595599de94d7a867f13782a0 (diff) | |
download | libquotient-d76424cb6c16cdef29761f00592db05989532a20.tar.gz libquotient-d76424cb6c16cdef29761f00592db05989532a20.zip |
Merge branch 'kitsune-fake-state-events-immunity'
Diffstat (limited to 'lib')
-rw-r--r-- | lib/events/stateevent.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/events/stateevent.cpp b/lib/events/stateevent.cpp index c4151676..e96614d2 100644 --- a/lib/events/stateevent.cpp +++ b/lib/events/stateevent.cpp @@ -25,13 +25,15 @@ using namespace QMatrixClient; // but the event type is unknown. [[gnu::unused]] static auto stateEventTypeInitialised = RoomEvent::factory_t::addMethod( - [] (const QJsonObject& json, const QString& matrixType) + [] (const QJsonObject& json, const QString& matrixType) -> StateEventPtr { + if (!json.contains("state_key")) + return nullptr; + if (auto e = StateEventBase::factory_t::make(json, matrixType)) return e; - return json.contains("state_key") - ? makeEvent<StateEventBase>(unknownEventTypeId(), json) - : nullptr; + + return makeEvent<StateEventBase>(unknownEventTypeId(), json); }); bool StateEventBase::repeatsState() const |