diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/room.cpp | 15 | ||||
-rw-r--r-- | lib/syncdata.h | 4 |
2 files changed, 9 insertions, 10 deletions
diff --git a/lib/room.cpp b/lib/room.cpp index 23e07cae..22ec1c82 100644 --- a/lib/room.cpp +++ b/lib/room.cpp @@ -1565,18 +1565,17 @@ QString Room::Private::doSendEvent(const RoomEvent* pEvent) std::bind(&Room::Private::onEventSendingFailure, this, txnId, call)); Room::connect(call, &BaseJob::success, q, [this, call, txnId] { - emit q->messageSent(txnId, call->eventId()); auto it = q->findPendingEvent(txnId); - if (it == unsyncedEvents.end()) { + if (it != unsyncedEvents.end()) { + if (it->deliveryStatus() != EventStatus::ReachedServer) { + it->setReachedServer(call->eventId()); + emit q->pendingEventChanged(int(it - unsyncedEvents.begin())); + } + } else qCDebug(EVENTS) << "Pending event for transaction" << txnId << "already merged"; - return; - } - if (it->deliveryStatus() != EventStatus::ReachedServer) { - it->setReachedServer(call->eventId()); - emit q->pendingEventChanged(int(it - unsyncedEvents.begin())); - } + emit q->messageSent(txnId, call->eventId()); }); } else onEventSendingFailure(txnId); diff --git a/lib/syncdata.h b/lib/syncdata.h index 752dd485..67d04557 100644 --- a/lib/syncdata.h +++ b/lib/syncdata.h @@ -41,9 +41,9 @@ struct RoomSummary { /// Merge the contents of another RoomSummary object into this one /// \return true, if the current object has changed; false otherwise bool merge(const RoomSummary& other); - - friend QDebug operator<<(QDebug dbg, const RoomSummary& rs); }; +QDebug operator<<(QDebug dbg, const RoomSummary& rs); + template <> struct JsonObjectConverter<RoomSummary> { |