Commit fe8930ce authored by Benjamin REIS's avatar Benjamin REIS
Browse files

notify fallbacked chat room creation

parent 554ad75c
...@@ -37,6 +37,7 @@ class EventLog; ...@@ -37,6 +37,7 @@ class EventLog;
class LINPHONE_PUBLIC AbstractChatRoom : public Object, public CoreAccessor, public ConferenceInterface { class LINPHONE_PUBLIC AbstractChatRoom : public Object, public CoreAccessor, public ConferenceInterface {
friend class ChatMessage; friend class ChatMessage;
friend class ChatMessagePrivate; friend class ChatMessagePrivate;
friend class ClientGroupToBasicChatRoomPrivate;
friend class CorePrivate; friend class CorePrivate;
friend class MainDb; friend class MainDb;
friend class ProxyChatRoomPrivate; friend class ProxyChatRoomPrivate;
......
...@@ -29,6 +29,7 @@ LINPHONE_BEGIN_NAMESPACE ...@@ -29,6 +29,7 @@ LINPHONE_BEGIN_NAMESPACE
class BasicChatRoomPrivate; class BasicChatRoomPrivate;
class LINPHONE_PUBLIC BasicChatRoom : public ChatRoom { class LINPHONE_PUBLIC BasicChatRoom : public ChatRoom {
friend class Core;
friend class CorePrivate; friend class CorePrivate;
public: public:
......
...@@ -68,7 +68,12 @@ public: ...@@ -68,7 +68,12 @@ public:
cgcr->getPrivate()->setChatRoomListener(nullptr); cgcr->getPrivate()->setChatRoomListener(nullptr);
Core::deleteChatRoom(q->getSharedFromThis()); Core::deleteChatRoom(q->getSharedFromThis());
LinphoneChatRoom *lcr = L_GET_C_BACK_PTR(q); 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; return;
} }
cgcr->getPrivate()->onCallSessionStateChanged(session, newState, message); cgcr->getPrivate()->onCallSessionStateChanged(session, newState, message);
......
...@@ -185,6 +185,20 @@ shared_ptr<AbstractChatRoom> Core::createClientGroupChatRoom (const string &subj ...@@ -185,6 +185,20 @@ shared_ptr<AbstractChatRoom> Core::createClientGroupChatRoom (const string &subj
return d->createClientGroupChatRoom(subject, true); 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) { shared_ptr<AbstractChatRoom> Core::getOrCreateBasicChatRoom (const ChatRoomId &chatRoomId, bool isRtt) {
L_D(); L_D();
......
...@@ -107,6 +107,7 @@ public: ...@@ -107,6 +107,7 @@ public:
const IdentityAddress &localAddress 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 ChatRoomId &chatRoomId, bool isRtt = false);
std::shared_ptr<AbstractChatRoom> getOrCreateBasicChatRoom (const IdentityAddress &peerAddress, 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