feat(core): add findChatRooms impl

This commit is contained in:
Ronan Abhamon 2017-11-17 10:27:33 +01:00
parent b133c5899f
commit 46a194d5b3

View file

@ -170,8 +170,18 @@ shared_ptr<ChatRoom> Core::findChatRoom (const ChatRoomId &chatRoomId) const {
}
list<shared_ptr<ChatRoom>> Core::findChatRooms (const IdentityAddress &peerAddress) const {
// TODO: DEV GROUP CHAT.
return list<shared_ptr<ChatRoom>>();
L_D();
// TODO: Improve performance if necessary.
list<shared_ptr<ChatRoom>> output;
copy_if(
d->chatRooms.begin(), d->chatRooms.end(),
back_inserter(output), [&peerAddress](const shared_ptr<ChatRoom> &chatRoom) {
return chatRoom->getPeerAddress() == peerAddress;
}
);
return output;
}
shared_ptr<ChatRoom> Core::createClientGroupChatRoom (const string &subject) {