aboutsummaryrefslogtreecommitdiff
path: root/lib/events/roomevent.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/events/roomevent.cpp')
-rw-r--r--lib/events/roomevent.cpp59
1 files changed, 29 insertions, 30 deletions
diff --git a/lib/events/roomevent.cpp b/lib/events/roomevent.cpp
index 3d03509f..221a3a61 100644
--- a/lib/events/roomevent.cpp
+++ b/lib/events/roomevent.cpp
@@ -1,26 +1,26 @@
/******************************************************************************
-* Copyright (C) 2018 Kitsune Ral <kitsune-ral@users.sf.net>
-*
-* This library is free software; you can redistribute it and/or
-* modify it under the terms of the GNU Lesser General Public
-* License as published by the Free Software Foundation; either
-* version 2.1 of the License, or (at your option) any later version.
-*
-* This library is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* 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
-*/
+ * Copyright (C) 2018 Kitsune Ral <kitsune-ral@users.sf.net>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * 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
+ */
#include "roomevent.h"
-#include "redactionevent.h"
#include "converters.h"
#include "logging.h"
+#include "redactionevent.h"
using namespace QMatrixClient;
@@ -30,15 +30,14 @@ using namespace QMatrixClient;
RoomEvent::RoomEvent(Type type, event_mtype_t matrixType,
const QJsonObject& contentJson)
: Event(type, matrixType, contentJson)
-{ }
+{
+}
-RoomEvent::RoomEvent(Type type, const QJsonObject& json)
- : Event(type, json)
+RoomEvent::RoomEvent(Type type, const QJsonObject& json) : Event(type, json)
{
const auto unsignedData = json[UnsignedKeyL].toObject();
const auto redaction = unsignedData[RedactedCauseKeyL];
- if (redaction.isObject())
- {
+ if (redaction.isObject()) {
_redactedBecause = makeEvent<RedactionEvent>(redaction.toObject());
return;
}
@@ -46,14 +45,12 @@ RoomEvent::RoomEvent(Type type, const QJsonObject& json)
RoomEvent::~RoomEvent() = default; // Let the smart pointer do its job
-QString RoomEvent::id() const
-{
- return fullJson()[EventIdKeyL].toString();
-}
+QString RoomEvent::id() const { return fullJson()[EventIdKeyL].toString(); }
QDateTime RoomEvent::timestamp() const
{
- return QMatrixClient::fromJson<QDateTime>(fullJson()["origin_server_ts"_ls]);
+ return QMatrixClient::fromJson<QDateTime>(
+ fullJson()["origin_server_ts"_ls]);
}
QString RoomEvent::roomId() const
@@ -68,7 +65,7 @@ QString RoomEvent::senderId() const
QString RoomEvent::redactionReason() const
{
- return isRedacted() ? _redactedBecause->reason() : QString{};
+ return isRedacted() ? _redactedBecause->reason() : QString {};
}
QString RoomEvent::transactionId() const
@@ -91,7 +88,8 @@ void RoomEvent::setTransactionId(const QString& txnId)
void RoomEvent::addId(const QString& newId)
{
- Q_ASSERT(id().isEmpty()); Q_ASSERT(!newId.isEmpty());
+ Q_ASSERT(id().isEmpty());
+ Q_ASSERT(!newId.isEmpty());
editJson().insert(EventIdKey, newId);
qCDebug(EVENTS) << "Event txnId -> id:" << transactionId() << "->" << id();
Q_ASSERT(id() == newId);
@@ -110,7 +108,8 @@ CallEventBase::CallEventBase(Type type, event_mtype_t matrixType,
const QJsonObject& contentJson)
: RoomEvent(type, matrixType,
makeCallContentJson(callId, version, contentJson))
-{ }
+{
+}
CallEventBase::CallEventBase(Event::Type type, const QJsonObject& json)
: RoomEvent(type, json)