Commit fe8930ce authored by Benjamin REIS's avatar Benjamin REIS

notify fallbacked chat room creation

parent 554ad75c
......@@ -37,6 +37,7 @@ class EventLog;
class LINPHONE_PUBLIC AbstractChatRoom : public Object, public CoreAccessor, public ConferenceInterface {
friend class ChatMessage;
friend class ChatMessagePrivate;
friend class ClientGroupToBasicChatRoomPrivate;
friend class CorePrivate;
friend class MainDb;
friend class ProxyChatRoomPrivate;
......
......@@ -29,6 +29,7 @@ LINPHONE_BEGIN_NAMESPACE
class BasicChatRoomPrivate;
class LINPHONE_PUBLIC BasicChatRoom : public ChatRoom {
friend class Core;
friend class CorePrivate;
public:
......
......@@ -68,7 +68,12 @@ public:
cgcr->getPrivate()->setChatRoomListener(nullptr);
Core::deleteChatRoom(q->getSharedFromThis());
LinphoneChatRoom *lcr = L_GET_C_BACK_PTR(q);
L_SET_CPP_PTR_FROM_C_OBJECT(lcr, cgcr->getCore()->getOrCreateBasicChatRoom(invitedAddresses.front()));
shared_ptr<AbstractChatRoom> bcr = cgcr->getCore()->onlyGetOrCreateBasicChatRoom(invitedAddresses.front());
L_SET_CPP_PTR_FROM_C_OBJECT(lcr, bcr);
bcr->getPrivate()->setState(ChatRoom::State::Instantiated);
bcr->getPrivate()->setState(ChatRoom::State::Created);
cgcr->getCore()->getPrivate()->insertChatRoom(bcr);
cgcr->getCore()->getPrivate()->insertChatRoomWithDb(bcr);
return;
}
cgcr->getPrivate()->onCallSessionStateChanged(session, newState, message);
......
......@@ -185,6 +185,20 @@ shared_ptr<AbstractChatRoom> Core::createClientGroupChatRoom (const string &subj
return d->createClientGroupChatRoom(subject, true);
}
shared_ptr<AbstractChatRoom> Core::onlyGetOrCreateBasicChatRoom (const IdentityAddress &peerAddress, bool isRtt) {
list<shared_ptr<AbstractChatRoom>> chatRooms = findChatRooms(peerAddress);
if (!chatRooms.empty())
return chatRooms.front();
const ChatRoomId &chatRoomId = ChatRoomId(peerAddress, getDefaultLocalAddress(getSharedFromThis(), peerAddress));
shared_ptr<AbstractChatRoom> chatRoom;
BasicChatRoom *basicChatRoom = new BasicChatRoom(getSharedFromThis(), chatRoomId);
chatRoom.reset(basicChatRoom);
return chatRoom;
}
shared_ptr<AbstractChatRoom> Core::getOrCreateBasicChatRoom (const ChatRoomId &chatRoomId, bool isRtt) {
L_D();
......
......@@ -107,6 +107,7 @@ public:
const IdentityAddress &localAddress
);
std::shared_ptr<AbstractChatRoom> onlyGetOrCreateBasicChatRoom (const IdentityAddress &peerAddress, bool isRtt = false);
std::shared_ptr<AbstractChatRoom> getOrCreateBasicChatRoom (const ChatRoomId &chatRoomId, bool isRtt = false);
std::shared_ptr<AbstractChatRoom> getOrCreateBasicChatRoom (const IdentityAddress &peerAddress, bool isRtt = false);
......
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