aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2016-09-21 16:52:50 +0900
committerKitsune Ral <Kitsune-Ral@users.sf.net>2016-09-21 16:52:50 +0900
commit50a92291b0650747c931259976a488c37504024a (patch)
tree5a88f810076a48ccaf287333fab4576c12e32913
parent36beaf2b1bfaa27b47eaeca6b231d7209bf8dedc (diff)
downloadlibquotient-50a92291b0650747c931259976a488c37504024a.tar.gz
libquotient-50a92291b0650747c931259976a488c37504024a.zip
Room: don't emit signals if there are no message events received
-rw-r--r--room.cpp13
1 files 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();