From 52081fe91724e5f2a82c55f0e6230d8841dd859a Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Fri, 23 Nov 2018 15:53:16 +0900 Subject: Room: track more Changes --- lib/room.cpp | 9 ++++++--- lib/room.h | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/room.cpp b/lib/room.cpp index 22a0d585..2a1d6f66 100644 --- a/lib/room.cpp +++ b/lib/room.cpp @@ -382,6 +382,7 @@ void Room::setJoinState(JoinState state) d->joinState = state; qCDebug(MAIN) << "Room" << id() << "changed state: " << int(oldState) << "->" << int(state); + emit changed(Change::JoinStateChange); emit joinStateChanged(oldState, state); } @@ -1112,11 +1113,11 @@ void Room::updateData(SyncRoomData&& data, bool fromCache) d->prevBatch = data.timelinePrevBatch; setJoinState(data.joinState); + Changes roomChanges = Change::NoChange; QElapsedTimer et; et.start(); for (auto&& event: data.accountData) - processAccountDataEvent(move(event)); + roomChanges |= processAccountDataEvent(move(event)); - Changes roomChanges = Change::NoChange; if (!data.state.empty()) { et.restart(); @@ -1973,7 +1974,7 @@ void Room::processEphemeralEvent(EventPtr&& event) } } -void Room::processAccountDataEvent(EventPtr&& event) +Room::Changes Room::processAccountDataEvent(EventPtr&& event) { if (auto* evt = eventCast(event)) d->setTags(evt->tags()); @@ -2000,7 +2001,9 @@ void Room::processAccountDataEvent(EventPtr&& event) qCDebug(MAIN) << "Updated account data of type" << currentData->matrixType(); emit accountDataChanged(currentData->matrixType()); + return Change::AccountDataChange; } + return Change::NoChange; } QString Room::Private::roomNameFromMemberNames(const QList &userlist) const diff --git a/lib/room.h b/lib/room.h index 480de6fe..9d4561e5 100644 --- a/lib/room.h +++ b/lib/room.h @@ -460,7 +460,7 @@ namespace QMatrixClient /// Returns true if any of room names/aliases has changed virtual Changes processStateEvent(const RoomEvent& e); virtual void processEphemeralEvent(EventPtr&& event); - virtual void processAccountDataEvent(EventPtr&& event); + virtual Changes processAccountDataEvent(EventPtr&& event); virtual void onAddNewTimelineEvents(timeline_iter_t /*from*/) { } virtual void onAddHistoricalTimelineEvents(rev_iter_t /*from*/) { } virtual void onRedaction(const RoomEvent& /*prevEvent*/, -- cgit v1.2.3