diff options
author | Hubert Chathi <uhoreg@debian.org> | 2019-01-14 11:21:45 -0500 |
---|---|---|
committer | Hubert Chathi <uhoreg@debian.org> | 2019-01-14 11:21:45 -0500 |
commit | d488348d41b1abecd858a2625099dc94a8b05eac (patch) | |
tree | 8736c10809e5fac1dd7527e2562e948f09d109ae /lib | |
parent | 34da172eadf142cb13825086ab10e5627fff2668 (diff) | |
parent | 863848b2158e3278ae65d25de0b189a6008c60d1 (diff) | |
download | libquotient-d488348d41b1abecd858a2625099dc94a8b05eac.tar.gz libquotient-d488348d41b1abecd858a2625099dc94a8b05eac.zip |
Merge branch 'upstream' (v0.4.2.1)
Diffstat (limited to 'lib')
-rw-r--r-- | lib/events/stateevent.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/events/stateevent.cpp b/lib/events/stateevent.cpp index fd5d2642..877d0fae 100644 --- a/lib/events/stateevent.cpp +++ b/lib/events/stateevent.cpp @@ -21,7 +21,17 @@ using namespace QMatrixClient; [[gnu::unused]] static auto stateEventTypeInitialised = - RoomEvent::factory_t::chainFactory<StateEventBase>(); + RoomEvent::factory_t::addMethod( + [] (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 nullptr; + }); bool StateEventBase::repeatsState() const { |