Commit dc265f23 authored by Ghislain MARY's avatar Ghislain MARY
Browse files

Merge branch 'dev_refactor_cpp' into dev_group_chat

parents cdee1e04 885611ff
......@@ -215,4 +215,10 @@ void ServerGroupChatRoom::leave () {}
void ServerGroupChatRoom::onFirstNotifyReceived (const IdentityAddress &addr) {}
// -----------------------------------------------------------------------------
ostream &operator<< (ostream &stream, const ServerGroupChatRoom *chatRoom) {
return stream << "ServerGroupChatRoom [" << chatRoom << "]";
}
LINPHONE_END_NAMESPACE
......@@ -93,6 +93,8 @@ private:
L_DISABLE_COPY(ServerGroupChatRoom);
};
std::ostream &operator<< (std::ostream &stream, const ServerGroupChatRoom *chatRoom);
LINPHONE_END_NAMESPACE
#endif // ifndef _L_SERVER_GROUP_CHAT_ROOM_H_
......@@ -47,4 +47,18 @@ void ParticipantDevice::setConferenceSubscribeEvent (LinphoneEvent *ev) {
mConferenceSubscribeEvent = linphone_event_ref(ev);
}
ostream &operator<< (ostream &stream, ParticipantDevice::State state) {
switch (state) {
case ParticipantDevice::State::Joining:
return stream << "Joining";
case ParticipantDevice::State::Present:
return stream << "Present";
case ParticipantDevice::State::Leaving:
return stream << "Leaving";
case ParticipantDevice::State::Left:
return stream << "Left";
}
return stream;
}
LINPHONE_END_NAMESPACE
......@@ -72,6 +72,8 @@ private:
L_DISABLE_COPY(ParticipantDevice);
};
std::ostream &operator<< (std::ostream &stream, ParticipantDevice::State state);
LINPHONE_END_NAMESPACE
#endif // ifndef _L_PARTICIPANT_DEVICE_H_
......@@ -106,12 +106,14 @@ shared_ptr<AbstractChatRoom> CorePrivate::createClientGroupChatRoom (const strin
void CorePrivate::insertChatRoom (const shared_ptr<AbstractChatRoom> &chatRoom) {
L_ASSERT(chatRoom);
L_ASSERT(!chatRoomsById[chatRoom->getChatRoomId()]
|| (chatRoomsById[chatRoom->getChatRoomId()] == chatRoom)
);
if (!chatRoomsById[chatRoom->getChatRoomId()]) {
const ChatRoomId &chatRoomId = chatRoom->getChatRoomId();
auto it = chatRoomsById.find(chatRoomId);
// Chat room not exist or yes but with the same pointer!
L_ASSERT(it == chatRoomsById.end() || it->second == chatRoom);
if (it == chatRoomsById.end()) {
chatRooms.push_back(chatRoom);
chatRoomsById[chatRoom->getChatRoomId()] = chatRoom;
chatRoomsById[chatRoomId] = chatRoom;
}
}
......
This diff is collapsed.
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