diff options
author | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2016-09-21 16:52:50 +0900 |
---|---|---|
committer | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2016-09-21 16:52:50 +0900 |
commit | 50a92291b0650747c931259976a488c37504024a (patch) | |
tree | 5a88f810076a48ccaf287333fab4576c12e32913 | |
parent | 36beaf2b1bfaa27b47eaeca6b231d7209bf8dedc (diff) | |
download | libquotient-50a92291b0650747c931259976a488c37504024a.tar.gz libquotient-50a92291b0650747c931259976a488c37504024a.zip |
Room: don't emit signals if there are no message events received
-rw-r--r-- | room.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
@@ -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(); |