aboutsummaryrefslogtreecommitdiff
path: root/lib/events/event.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/events/event.cpp')
-rw-r--r--lib/events/event.cpp30
1 files changed, 12 insertions, 18 deletions
diff --git a/lib/events/event.cpp b/lib/events/event.cpp
index 6505d89a..718a6602 100644
--- a/lib/events/event.cpp
+++ b/lib/events/event.cpp
@@ -13,7 +13,7 @@
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "event.h"
@@ -31,23 +31,23 @@ event_type_t EventTypeRegistry::initializeTypeId(event_mtype_t matrixTypeId)
if (strncmp(matrixTypeId, "", 1) == 0)
qDebug(EVENTS) << "Initialized unknown event type with id" << id;
else
- qDebug(EVENTS) << "Initialized event type" << matrixTypeId
- << "with id" << id;
+ qDebug(EVENTS) << "Initialized event type" << matrixTypeId << "with id"
+ << id;
return id;
}
QString EventTypeRegistry::getMatrixType(event_type_t typeId)
{
- return typeId < get().eventTypes.size()
- ? get().eventTypes[typeId] : QString();
+ return typeId < get().eventTypes.size() ? get().eventTypes[typeId]
+ : QString();
}
Event::Event(Type type, const QJsonObject& json)
- : _type(type), _json(json)
+ : _type(type)
+ , _json(json)
{
- if (!json.contains(ContentKeyL) &&
- !json.value(UnsignedKeyL).toObject().contains(RedactedCauseKeyL))
- {
+ if (!json.contains(ContentKeyL)
+ && !json.value(UnsignedKeyL).toObject().contains(RedactedCauseKeyL)) {
qCWarning(EVENTS) << "Event without 'content' node";
qCWarning(EVENTS) << formatJson << json;
}
@@ -55,19 +55,13 @@ Event::Event(Type type, const QJsonObject& json)
Event::Event(Type type, event_mtype_t matrixType, const QJsonObject& contentJson)
: Event(type, basicEventJson(matrixType, contentJson))
-{ }
+{}
Event::~Event() = default;
-QString Event::matrixType() const
-{
- return fullJson()[TypeKeyL].toString();
-}
+QString Event::matrixType() const { return fullJson()[TypeKeyL].toString(); }
-QByteArray Event::originalJson() const
-{
- return QJsonDocument(_json).toJson();
-}
+QByteArray Event::originalJson() const { return QJsonDocument(_json).toJson(); }
const QJsonObject Event::contentJson() const
{