diff options
author | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2017-07-15 13:07:53 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-15 13:07:53 +0900 |
commit | 3dfb74af71fe0cceaeb14d1ef0ade846f3a659f9 (patch) | |
tree | 40482bd167f1e086541ad71cdf634324b40383c6 /events/event.cpp | |
parent | 47c2015beb75693c7181fb7359a4aa166e926fe7 (diff) | |
parent | 749def2b983d2338272c0891d15de20df22e2eea (diff) | |
download | libquotient-3dfb74af71fe0cceaeb14d1ef0ade846f3a659f9.tar.gz libquotient-3dfb74af71fe0cceaeb14d1ef0ade846f3a659f9.zip |
Merge pull request #72 from QMatrixClient/kitsune-send-events
Events creation and sending
Diffstat (limited to 'events/event.cpp')
-rw-r--r-- | events/event.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/events/event.cpp b/events/event.cpp index bd7e1b03..653396bd 100644 --- a/events/event.cpp +++ b/events/event.cpp @@ -95,6 +95,7 @@ RoomEvent::RoomEvent(Type type, const QJsonObject& rep) , _serverTimestamp(toTimestamp(rep["origin_server_ts"])) , _roomId(rep["room_id"].toString()) , _senderId(rep["sender"].toString()) + , _txnId(rep["unsigned"].toObject().value("transactionId").toString()) { if (_id.isEmpty()) { @@ -103,14 +104,22 @@ RoomEvent::RoomEvent(Type type, const QJsonObject& rep) } if (!rep.contains("origin_server_ts")) { - qCWarning(EVENTS) << "Event: can't find server timestamp in a room event"; + qCWarning(EVENTS) << "Can't find server timestamp in a room event"; qCWarning(EVENTS) << formatJson << rep; } if (_senderId.isEmpty()) { - qCWarning(EVENTS) << "user_id not found in a room event"; + qCWarning(EVENTS) << "Can't find sender in a room event"; qCWarning(EVENTS) << formatJson << rep; } + if (!_txnId.isEmpty()) + qCDebug(EVENTS) << "Event transactionId:" << _txnId; +} + +void RoomEvent::addId(const QString& id) +{ + Q_ASSERT(_id.isEmpty()); Q_ASSERT(!id.isEmpty()); + _id = id; } RoomEvent* RoomEvent::fromJson(const QJsonObject& obj) |