Store NeochatRoomMember objects in the room
Store NeochatRoomMember objects in the room so we don't duplicate them unnecessarily. This also adds a visible property for a room which is set true when shown by MessageEventModel and false when not, triggering the deletion of member objects. This mechanism will be used for other object types in the future.
This commit is contained in:
@@ -211,6 +211,9 @@ class NeoChatRoom : public Quotient::Room
|
||||
public:
|
||||
explicit NeoChatRoom(Quotient::Connection *connection, QString roomId, Quotient::JoinState joinState = {});
|
||||
|
||||
bool visible() const;
|
||||
void setVisible(bool visible);
|
||||
|
||||
[[nodiscard]] QDateTime lastActiveTime();
|
||||
|
||||
/**
|
||||
@@ -590,7 +593,11 @@ public:
|
||||
*/
|
||||
Quotient::FileTransferInfo cachedFileTransferInfo(const Quotient::RoomEvent *event) const;
|
||||
|
||||
NeochatRoomMember *qmlSafeMember(const QString &memberId);
|
||||
|
||||
private:
|
||||
bool m_visible = false;
|
||||
|
||||
QSet<const Quotient::RoomEvent *> highlights;
|
||||
|
||||
bool m_hasFileUploading = false;
|
||||
@@ -619,6 +626,8 @@ private:
|
||||
void cleanupExtraEventRange(Quotient::RoomEventsRange events);
|
||||
void cleanupExtraEvent(const QString &eventId);
|
||||
|
||||
std::unordered_map<QString, std::unique_ptr<NeochatRoomMember>> m_memberObjects;
|
||||
|
||||
private Q_SLOTS:
|
||||
void updatePushNotificationState(QString type);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user