aboutsummaryrefslogtreecommitdiff
path: root/events/event.h
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2018-02-27 19:51:08 +0900
committerKitsune Ral <Kitsune-Ral@users.sf.net>2018-02-27 19:51:08 +0900
commit375bea5ee67a90c6419acf50c06c05ed0435c772 (patch)
tree76f0a1c830797fe1b17b3bea67ddaf7fb53cbd6a /events/event.h
parente80bfd2fc710d4780a2c22bde9d605a41bd4aaa4 (diff)
parentefeeca097a3c69991683615366f07625855ba2ac (diff)
downloadlibquotient-375bea5ee67a90c6419acf50c06c05ed0435c772.tar.gz
libquotient-375bea5ee67a90c6419acf50c06c05ed0435c772.zip
Merge branch 'master' into kitsune-gtad
Diffstat (limited to 'events/event.h')
-rw-r--r--events/event.h26
1 files changed, 13 insertions, 13 deletions
diff --git a/events/event.h b/events/event.h
index b5a4d94e..f0ca2d15 100644
--- a/events/event.h
+++ b/events/event.h
@@ -45,7 +45,7 @@ namespace QMatrixClient
enum class Type : quint16
{
Unknown = 0,
- Typing, Receipt,
+ Typing, Receipt, Tag, DirectChat,
RoomEventBase = 0x1000,
RoomMessage = RoomEventBase + 1,
RoomEncryptedMessage, Redaction,
@@ -63,6 +63,7 @@ namespace QMatrixClient
virtual ~Event();
Type type() const { return _type; }
+ QString jsonType() const;
bool isStateEvent() const
{
return (quint16(_type) & 0x1800) == 0x1800;
@@ -76,7 +77,6 @@ namespace QMatrixClient
// (and in most cases it will be a combination of other fields
// instead of "content" field).
- protected:
const QJsonObject contentJson() const;
private:
@@ -100,7 +100,7 @@ namespace QMatrixClient
{
auto e = _impl::doMakeEvent<EventT>(obj);
if (!e)
- e.reset(new EventT(EventType::Unknown, obj));
+ e = std::make_unique<EventT>(EventType::Unknown, obj);
return e;
}
@@ -167,10 +167,10 @@ namespace QMatrixClient
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; }
+ QString id() const { return _id; }
+ QDateTime timestamp() const;
+ QString roomId() const;
+ QString senderId() const;
bool isRedacted() const { return bool(_redactedBecause); }
const RedactionEvent* redactedBecause() const
{
@@ -202,9 +202,9 @@ namespace QMatrixClient
private:
QString _id;
- QString _roomId;
- QString _senderId;
- QDateTime _serverTimestamp;
+// QString _roomId;
+// QString _senderId;
+// QDateTime _serverTimestamp;
event_ptr_tt<RedactionEvent> _redactedBecause;
QString _txnId;
};
@@ -296,10 +296,10 @@ namespace QMatrixClient
QJsonObject toJson() const { return _content.toJson(); }
- ContentT content() const { return _content; }
+ const ContentT& content() const { return _content; }
/** @deprecated Use prevContent instead */
- ContentT* prev_content() const { return prevContent(); }
- ContentT* prevContent() const
+ const ContentT* prev_content() const { return prevContent(); }
+ const ContentT* prevContent() const
{ return _prev ? &_prev->content : nullptr; }
QString prevSenderId() const { return _prev ? _prev->senderId : ""; }