aboutsummaryrefslogtreecommitdiff
path: root/events/event.h
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2017-12-10 09:49:08 +0900
committerKitsune Ral <Kitsune-Ral@users.sf.net>2017-12-10 16:20:22 +0900
commit6ecdefd8463c0b393dc51535ddb4b4283b5891d8 (patch)
tree70cfe732adf08676246c4432b0f9076ad9392785 /events/event.h
parentc38366210643ef0956884531910d7ece3d6a4cac (diff)
downloadlibquotient-6ecdefd8463c0b393dc51535ddb4b4283b5891d8.tar.gz
libquotient-6ecdefd8463c0b393dc51535ddb4b4283b5891d8.zip
RedactionEvent and RoomEvent::redactedBecause()
A RoomEvent now has an optional pointer to a RedactionEvent that is non-null if the room event is redacted. transactionId and serverTimestamp are only filled if the event is not redacted. There's no way to construct a redacted event as of yet.
Diffstat (limited to 'events/event.h')
-rw-r--r--events/event.h18
1 files changed, 16 insertions, 2 deletions
diff --git a/events/event.h b/events/event.h
index 8681f4db..62d9c23b 100644
--- a/events/event.h
+++ b/events/event.h
@@ -104,6 +104,8 @@ namespace QMatrixClient
};
using Events = EventsBatch<Event>;
+ class RedactionEvent;
+
/** This class corresponds to m.room.* events */
class RoomEvent : public Event
{
@@ -112,15 +114,26 @@ namespace QMatrixClient
Q_PROPERTY(QDateTime timestamp READ timestamp CONSTANT)
Q_PROPERTY(QString roomId READ roomId CONSTANT)
Q_PROPERTY(QString senderId READ senderId CONSTANT)
- Q_PROPERTY(QString transactionId READ transactionId CONSTANT)
+ Q_PROPERTY(QString redactionReason READ redactionReason)
+ Q_PROPERTY(bool isRedacted READ isRedacted)
+ Q_PROPERTY(QString transactionId READ transactionId)
public:
- explicit RoomEvent(Type type) : Event(type) { }
+ // RedactionEvent is an incomplete type here so we cannot inline
+ // constructors and destructors
+ explicit RoomEvent(Type type);
RoomEvent(Type type, const QJsonObject& rep);
+ ~RoomEvent();
const QString& id() const { return _id; }
const QDateTime& timestamp() const { return _serverTimestamp; }
const QString& roomId() const { return _roomId; }
const QString& senderId() const { return _senderId; }
+ bool isRedacted() const { return redactedBecause(); }
+ RedactionEvent* redactedBecause() const
+ {
+ return _redactedBecause.data();
+ }
+ QString redactionReason() const;
const QString& transactionId() const { return _txnId; }
/**
@@ -152,6 +165,7 @@ namespace QMatrixClient
QDateTime _serverTimestamp;
QString _roomId;
QString _senderId;
+ QScopedPointer<RedactionEvent> _redactedBecause;
QString _txnId;
};
using RoomEvents = EventsBatch<RoomEvent>;