Commit 05271e86 authored by Ghislain MARY's avatar Ghislain MARY
Browse files

Change the state of ClientGroupChatRoom and ServerGroupChatRoom outside of their constructors.

parent a57290db
......@@ -103,11 +103,9 @@ ClientGroupChatRoom::ClientGroupChatRoom (
shared_ptr<Participant> &me,
const string &subject,
list<shared_ptr<Participant>> &&participants,
unsigned int lastNotifyId,
bool hasBeenLeft
unsigned int lastNotifyId
) : ChatRoom(*new ClientGroupChatRoomPrivate, core, ChatRoomId(peerAddress, me->getAddress())),
RemoteConference(core, me->getAddress(), nullptr) {
L_D();
L_D_T(RemoteConference, dConference);
dConference->focus = make_shared<Participant>(peerAddress);
......@@ -115,8 +113,6 @@ RemoteConference(core, me->getAddress(), nullptr) {
dConference->subject = subject;
dConference->participants = move(participants);
d->state = hasBeenLeft ? ChatRoom::State::Terminated : ChatRoom::State::Created;
getMe()->getPrivate()->setAdmin(me->isAdmin());
dConference->eventHandler->setLastNotify(lastNotifyId);
......
......@@ -45,8 +45,7 @@ public:
std::shared_ptr<Participant> &me,
const std::string &subject,
std::list<std::shared_ptr<Participant>> &&participants,
unsigned int lastNotifyId,
bool hasBeenLeft
unsigned int lastNotifyId
);
std::shared_ptr<Core> getCore () const;
......
......@@ -1906,17 +1906,22 @@ MainDb::MainDb (const shared_ptr<Core> &core) : AbstractDb(*new MainDbPrivate),
continue;
}
if (!linphone_core_conference_server_enabled(core->getCCore()))
if (!linphone_core_conference_server_enabled(core->getCCore())) {
bool hasBeenLeft = !!row.get<int>(8, 0);
chatRoom = make_shared<ClientGroupChatRoom>(
core,
chatRoomId.getPeerAddress(),
me,
subject,
move(participants),
lastNotifyId,
!!row.get<int>(8, 0)
lastNotifyId
);
chatRoom->getPrivate()->setState(LinphonePrivate::ChatRoom::State::Instantiated);
chatRoom->getPrivate()->setState(hasBeenLeft
? ChatRoom::State::Terminated
: ChatRoom::State::Created
);
else
} else {
chatRoom = make_shared<ServerGroupChatRoom>(
core,
chatRoomId.getPeerAddress(),
......@@ -1924,6 +1929,9 @@ MainDb::MainDb (const shared_ptr<Core> &core) : AbstractDb(*new MainDbPrivate),
move(participants),
lastNotifyId
);
chatRoom->getPrivate()->setState(LinphonePrivate::ChatRoom::State::Instantiated);
chatRoom->getPrivate()->setState(LinphonePrivate::ChatRoom::State::Created);
}
}
if (!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