diff options
Diffstat (limited to 'lib/room.cpp')
-rw-r--r-- | lib/room.cpp | 15 |
1 files changed, 7 insertions, 8 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); |