diff options
Diffstat (limited to 'lib/events/event.h')
-rw-r--r-- | lib/events/event.h | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/lib/events/event.h b/lib/events/event.h index 9ba4b85a..cd23a818 100644 --- a/lib/events/event.h +++ b/lib/events/event.h @@ -18,11 +18,9 @@ #pragma once -#include "util.h" +#include "converters.h" #include "logging.h" -#include <QtCore/QJsonObject> - #ifndef DISABLE_EVENTTYPE #define USE_EVENTTYPE 1 #endif @@ -247,7 +245,20 @@ namespace QMatrixClient const QJsonObject contentJson() const; const QJsonObject unsignedJson() const; + template <typename T> + T content(const QString& key) const + { + return fromJson<T>(contentJson()[key]); + } + + template <typename T> + T content(const QLatin1String& key) const + { + return fromJson<T>(contentJson()[key]); + } + virtual bool isStateEvent() const { return false; } + virtual bool isCallEvent() const { return false; } protected: QJsonObject& editJson() { return _json; } |