diff options
Diffstat (limited to 'lib/events/stateevent.h')
-rw-r--r-- | lib/events/stateevent.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/events/stateevent.h b/lib/events/stateevent.h index d82de7e1..dc017b11 100644 --- a/lib/events/stateevent.h +++ b/lib/events/stateevent.h @@ -38,6 +38,9 @@ namespace QMatrixClient { using StateEventPtr = event_ptr_tt<StateEventBase>; using StateEvents = EventsArray<StateEventBase>; + template <> + inline bool is<StateEventBase>(const Event& e) { return e.isStateEvent(); } + /** * A combination of event type and state key uniquely identifies a piece * of state in Matrix. @@ -88,6 +91,12 @@ namespace QMatrixClient { } const ContentT& content() const { return _content; } + template <typename VisitorT> + void editContent(VisitorT&& visitor) + { + visitor(_content); + editJson()[ContentKeyL] = _content.toJson(); + } [[deprecated("Use prevContent instead")]] const ContentT* prev_content() const { return prevContent(); } const ContentT* prevContent() const |