From 50a92291b0650747c931259976a488c37504024a Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Wed, 21 Sep 2016 16:52:50 +0900 Subject: Room: don't emit signals if there are no message events received --- room.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/room.cpp b/room.cpp index e08b45e8..b5e6a906 100644 --- a/room.cpp +++ b/room.cpp @@ -337,12 +337,9 @@ void Room::updateData(const SyncRoomData& data) processStateEvents(data.state); - if (!data.timeline.empty()) - { - // State changes can arrive in a timeline event; so check those. - processStateEvents(data.timeline); - addNewMessageEvents(data.timeline); - } + // State changes can arrive in a timeline event; so check those. + processStateEvents(data.timeline); + addNewMessageEvents(data.timeline); for( Event* ephemeralEvent: data.ephemeral ) { @@ -389,6 +386,8 @@ Connection* Room::connection() const void Room::addNewMessageEvents(const Events& events) { + if (events.empty()) + return; emit aboutToAddNewMessages(events); doAddNewMessageEvents(events); emit addedMessages(); @@ -402,6 +401,8 @@ void Room::doAddNewMessageEvents(const Events& events) void Room::addHistoricalMessageEvents(const Events& events) { + if (events.empty()) + return; emit aboutToAddHistoricalMessages(events); doAddHistoricalMessageEvents(events); emit addedMessages(); -- cgit v1.2.3