From aacc4bcb4a487871daae6717f77605aaba444341 Mon Sep 17 00:00:00 2001 From: Marc Deop Date: Sat, 2 Mar 2019 12:26:57 +0100 Subject: style: apply .clang-format to all .cpp and .h files --- lib/events/roomevent.h | 148 ++++++++++++++++++++++++------------------------- 1 file changed, 74 insertions(+), 74 deletions(-) (limited to 'lib/events/roomevent.h') diff --git a/lib/events/roomevent.h b/lib/events/roomevent.h index ce96174e..746e9173 100644 --- a/lib/events/roomevent.h +++ b/lib/events/roomevent.h @@ -1,20 +1,20 @@ /****************************************************************************** -* Copyright (C) 2018 Kitsune Ral -* -* 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 + * + * 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 + */ #pragma once @@ -22,84 +22,84 @@ #include -namespace QMatrixClient -{ +namespace QMatrixClient { class RedactionEvent; /** This class corresponds to m.room.* events */ class RoomEvent : public Event { - Q_GADGET - Q_PROPERTY(QString id READ id) - Q_PROPERTY(QDateTime timestamp READ timestamp CONSTANT) - Q_PROPERTY(QString roomId READ roomId CONSTANT) - Q_PROPERTY(QString senderId READ senderId CONSTANT) - Q_PROPERTY(QString redactionReason READ redactionReason) - Q_PROPERTY(bool isRedacted READ isRedacted) - Q_PROPERTY(QString transactionId READ transactionId WRITE setTransactionId) + Q_GADGET + Q_PROPERTY(QString id READ id) + Q_PROPERTY(QDateTime timestamp READ timestamp CONSTANT) + Q_PROPERTY(QString roomId READ roomId CONSTANT) + Q_PROPERTY(QString senderId READ senderId CONSTANT) + Q_PROPERTY(QString redactionReason READ redactionReason) + Q_PROPERTY(bool isRedacted READ isRedacted) + Q_PROPERTY( + QString transactionId READ transactionId WRITE setTransactionId) public: - using factory_t = EventFactory; + using factory_t = EventFactory; - // RedactionEvent is an incomplete type here so we cannot inline - // constructors and destructors and we cannot use 'using'. - RoomEvent(Type type, event_mtype_t matrixType, - const QJsonObject& contentJson = {}); - RoomEvent(Type type, const QJsonObject& json); - ~RoomEvent() override; + // RedactionEvent is an incomplete type here so we cannot inline + // constructors and destructors and we cannot use 'using'. + RoomEvent(Type type, event_mtype_t matrixType, + const QJsonObject& contentJson = {}); + RoomEvent(Type type, const QJsonObject& json); + ~RoomEvent() override; - QString id() const; - QDateTime timestamp() const; - QString roomId() const; - QString senderId() const; - bool isRedacted() const { return bool(_redactedBecause); } - const event_ptr_tt& redactedBecause() const - { - return _redactedBecause; - } - QString redactionReason() const; - QString transactionId() const; - QString stateKey() const; + QString id() const; + QDateTime timestamp() const; + QString roomId() const; + QString senderId() const; + bool isRedacted() const { return bool(_redactedBecause); } + const event_ptr_tt& redactedBecause() const + { + return _redactedBecause; + } + QString redactionReason() const; + QString transactionId() const; + QString stateKey() const; - /** - * Sets the transaction id for locally created events. This should be - * done before the event is exposed to any code using the respective - * Q_PROPERTY. - * - * \param txnId - transaction id, normally obtained from - * Connection::generateTxnId() - */ - void setTransactionId(const QString& txnId); + /** + * Sets the transaction id for locally created events. This should be + * done before the event is exposed to any code using the respective + * Q_PROPERTY. + * + * \param txnId - transaction id, normally obtained from + * Connection::generateTxnId() + */ + void setTransactionId(const QString& txnId); - /** - * Sets event id for locally created events - * - * When a new event is created locally, it has no server id yet. - * This function allows to add the id once the confirmation from - * the server is received. There should be no id set previously - * in the event. It's the responsibility of the code calling addId() - * to notify clients that use Q_PROPERTY(id) about its change - */ - void addId(const QString& newId); + /** + * Sets event id for locally created events + * + * When a new event is created locally, it has no server id yet. + * This function allows to add the id once the confirmation from + * the server is received. There should be no id set previously + * in the event. It's the responsibility of the code calling addId() + * to notify clients that use Q_PROPERTY(id) about its change + */ + void addId(const QString& newId); private: - event_ptr_tt _redactedBecause; + event_ptr_tt _redactedBecause; }; using RoomEventPtr = event_ptr_tt; using RoomEvents = EventsArray; using RoomEventsRange = Range; - class CallEventBase: public RoomEvent + class CallEventBase : public RoomEvent { public: - CallEventBase(Type type, event_mtype_t matrixType, - const QString& callId, int version, - const QJsonObject& contentJson = {}); - CallEventBase(Type type, const QJsonObject& json); - ~CallEventBase() override = default; - bool isCallEvent() const override { return true; } + CallEventBase(Type type, event_mtype_t matrixType, + const QString& callId, int version, + const QJsonObject& contentJson = {}); + CallEventBase(Type type, const QJsonObject& json); + ~CallEventBase() override = default; + bool isCallEvent() const override { return true; } - QString callId() const { return content("call_id"_ls); } - int version() const { return content("version"_ls); } + QString callId() const { return content("call_id"_ls); } + int version() const { return content("version"_ls); } }; } // namespace QMatrixClient Q_DECLARE_METATYPE(QMatrixClient::RoomEvent*) -- cgit v1.2.3 From 36f63f398b8a36e0b276e78eceaf3c4123be6b13 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Mon, 8 Jul 2019 19:36:27 +0900 Subject: RoomEvent::setRoomId()/setSender() --- lib/events/roomevent.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'lib/events/roomevent.h') diff --git a/lib/events/roomevent.h b/lib/events/roomevent.h index ce96174e..e26a7135 100644 --- a/lib/events/roomevent.h +++ b/lib/events/roomevent.h @@ -60,6 +60,9 @@ namespace QMatrixClient QString transactionId() const; QString stateKey() const; + void setRoomId(const QString& roomId); + void setSender(const QString& senderId); + /** * Sets the transaction id for locally created events. This should be * done before the event is exposed to any code using the respective -- cgit v1.2.3 From b87097866f38b90f36fb216b7516a135227930a1 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Sat, 13 Jul 2019 22:43:47 +0900 Subject: Initial support for edited messages (receive only) --- lib/events/roomevent.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib/events/roomevent.h') diff --git a/lib/events/roomevent.h b/lib/events/roomevent.h index e26a7135..0e6f730d 100644 --- a/lib/events/roomevent.h +++ b/lib/events/roomevent.h @@ -51,6 +51,8 @@ namespace QMatrixClient QDateTime timestamp() const; QString roomId() const; QString senderId() const; + bool isReplaced() const; + QString replacedBy() const; bool isRedacted() const { return bool(_redactedBecause); } const event_ptr_tt& redactedBecause() const { -- cgit v1.2.3 From c05ade838f0fce81f2bbe80a3295618a8a26ff52 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Fri, 2 Aug 2019 19:59:40 +0900 Subject: Apply the new brace wrapping to source files --- lib/events/roomevent.h | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'lib/events/roomevent.h') diff --git a/lib/events/roomevent.h b/lib/events/roomevent.h index 8edb397c..155d4600 100644 --- a/lib/events/roomevent.h +++ b/lib/events/roomevent.h @@ -22,13 +22,11 @@ #include -namespace QMatrixClient -{ +namespace QMatrixClient { class RedactionEvent; /** This class corresponds to m.room.* events */ -class RoomEvent : public Event -{ +class RoomEvent : public Event { Q_GADGET Q_PROPERTY(QString id READ id) Q_PROPERTY(QDateTime timestamp READ timestamp CONSTANT) @@ -93,8 +91,7 @@ using RoomEventPtr = event_ptr_tt; using RoomEvents = EventsArray; using RoomEventsRange = Range; -class CallEventBase : public RoomEvent -{ +class CallEventBase : public RoomEvent { public: CallEventBase(Type type, event_mtype_t matrixType, const QString& callId, int version, const QJsonObject& contentJson = {}); -- cgit v1.2.3 From 27ca32a1e5a56e09b9cc1d94224d2831004dcf3d Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Sun, 7 Jul 2019 19:32:34 +0900 Subject: Namespace: QMatrixClient -> Quotient (with back comp alias) --- lib/events/roomevent.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'lib/events/roomevent.h') diff --git a/lib/events/roomevent.h b/lib/events/roomevent.h index 155d4600..f943bce4 100644 --- a/lib/events/roomevent.h +++ b/lib/events/roomevent.h @@ -22,7 +22,7 @@ #include -namespace QMatrixClient { +namespace Quotient { class RedactionEvent; /** This class corresponds to m.room.* events */ @@ -102,6 +102,6 @@ public: QString callId() const { return content("call_id"_ls); } int version() const { return content("version"_ls); } }; -} // namespace QMatrixClient -Q_DECLARE_METATYPE(QMatrixClient::RoomEvent*) -Q_DECLARE_METATYPE(const QMatrixClient::RoomEvent*) +} // namespace Quotient +Q_DECLARE_METATYPE(Quotient::RoomEvent*) +Q_DECLARE_METATYPE(const Quotient::RoomEvent*) -- cgit v1.2.3 From 608e252bae9cf8cf763e05363bfacf5e1760134f Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Mon, 9 Dec 2019 18:19:53 +0300 Subject: RoomEvent::timestamp() -> originTimestamp() The previous name is still available but deprecated. --- lib/events/roomevent.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'lib/events/roomevent.h') diff --git a/lib/events/roomevent.h b/lib/events/roomevent.h index f943bce4..621652cb 100644 --- a/lib/events/roomevent.h +++ b/lib/events/roomevent.h @@ -46,7 +46,10 @@ public: ~RoomEvent() override; QString id() const; - QDateTime timestamp() const; + QDateTime originTimestamp() const; + [[deprecated("Use originTimestamp()")]] QDateTime timestamp() const { + return originTimestamp(); + } QString roomId() const; QString senderId() const; bool isReplaced() const; -- cgit v1.2.3