Commit 25d8ff14 authored by Ghislain MARY's avatar Ghislain MARY

Improve loading of chat rooms.

parent a124bbef
......@@ -106,11 +106,9 @@ shared_ptr<AbstractChatRoom> CorePrivate::createClientGroupChatRoom (const strin
void CorePrivate::insertChatRoom (const shared_ptr<AbstractChatRoom> &chatRoom) {
L_ASSERT(chatRoom);
if (!chatRoomsById[chatRoom->getChatRoomId()]) {
chatRooms.push_back(chatRoom);
chatRoomsById[chatRoom->getChatRoomId()] = chatRoom;
}
L_ASSERT(!chatRoomsById[chatRoom->getChatRoomId()]);
chatRooms.push_back(chatRoom);
chatRoomsById[chatRoom->getChatRoomId()] = chatRoom;
}
void CorePrivate::insertChatRoomWithDb (const shared_ptr<AbstractChatRoom> &chatRoom) {
......@@ -119,6 +117,8 @@ void CorePrivate::insertChatRoomWithDb (const shared_ptr<AbstractChatRoom> &chat
}
void CorePrivate::loadChatRooms () {
chatRooms.clear();
chatRoomsById.clear();
for (auto &chatRoom : mainDb->getChatRooms())
insertChatRoom(chatRoom);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment