diff options
Diffstat (limited to 'room.cpp')
-rw-r--r-- | room.cpp | 34 |
1 files changed, 34 insertions, 0 deletions
@@ -95,6 +95,8 @@ class Room::Private QString firstDisplayedEventId; QString lastDisplayedEventId; QHash<const User*, QString> lastReadEventIds; + QHash<QString, TagRecord> tags; + QHash<QString, QJsonObject> accountData; QString prevBatch; QPointer<RoomMessagesJob> roomMessagesJob; @@ -552,6 +554,16 @@ void Room::resetHighlightCount() emit highlightCountChanged(this); } +QStringList Room::tagNames() const +{ + return d->tags.keys(); +} + +const QHash<QString, TagRecord>& Room::tags() const +{ + return d->tags; +} + const RoomMessageEvent* Room::Private::getEventWithFile(const QString& eventId) const { @@ -873,6 +885,15 @@ void Room::updateData(SyncRoomData&& data) << et.elapsed() << "ms"; } + if (!data.accountData.empty()) + { + et.restart(); + for (auto&& event: data.accountData) + processAccountDataEvent(move(event)); + qCDebug(PROFILER) << "*** Room::processAccountData():" + << et.elapsed() << "ms"; + } + if( data.highlightCount != d->highlightCount ) { d->highlightCount = data.highlightCount; @@ -1433,6 +1454,19 @@ void Room::processEphemeralEvent(EventPtr event) } } +void Room::processAccountDataEvent(EventPtr event) +{ + switch (event->type()) + { + case EventType::Tag: + d->tags = static_cast<TagEvent*>(event.get())->tags(); + emit tagsChanged(); + break; + default: + d->accountData[event->jsonType()] = event->contentJson(); + } +} + QString Room::Private::roomNameFromMemberNames(const QList<User *> &userlist) const { // This is part 3(i,ii,iii) in the room displayname algorithm described |