Commit 5c7fe8a9 authored by Ronan's avatar Ronan
Browse files

feat(MainDb): supports fetching of client group chat room

parent eeee4736
......@@ -84,10 +84,10 @@ void ClientGroupChatRoomPrivate::onChatMessageReceived (const shared_ptr<ChatMes
// =============================================================================
ClientGroupChatRoom::ClientGroupChatRoom (
const std::shared_ptr<Core> &core,
const std::string &factoryUri,
const shared_ptr<Core> &core,
const string &factoryUri,
const IdentityAddress &me,
const std::string &subject
const string &subject
) : ChatRoom(*new ClientGroupChatRoomPrivate, core, ChatRoomId(IdentityAddress(), me)),
RemoteConference(core, me, nullptr) {
L_D_T(RemoteConference, dConference);
......@@ -95,6 +95,21 @@ RemoteConference(core, me, nullptr) {
RemoteConference::setSubject(subject);
}
ClientGroupChatRoom::ClientGroupChatRoom (
const shared_ptr<Core> &core,
const ChatRoomId &chatRoomId,
const string &subject
) : ChatRoom(*new ClientGroupChatRoomPrivate, core, chatRoomId),
RemoteConference(core, chatRoomId.getLocalAddress(), nullptr) {
L_D();
L_D_T(RemoteConference, dConference);
const IdentityAddress &peerAddress = chatRoomId.getPeerAddress();
dConference->focus = make_shared<Participant>(peerAddress);
dConference->conferenceAddress = peerAddress;
dConference->subject = subject;
d->state = ChatRoom::State::Created;
}
shared_ptr<Core> ClientGroupChatRoom::getCore () const {
return ChatRoom::getCore();
}
......@@ -268,6 +283,7 @@ void ClientGroupChatRoom::onConferenceCreated (const IdentityAddress &addr) {
L_D();
L_D_T(RemoteConference, dConference);
dConference->conferenceAddress = addr;
dConference->focus = make_shared<Participant>(addr);
d->chatRoomId = ChatRoomId(addr, d->chatRoomId.getLocalAddress());
getCore()->getPrivate()->insertChatRoom(getSharedFromThis());
}
......@@ -432,7 +448,7 @@ void ClientGroupChatRoom::onParticipantDeviceRemoved (const shared_ptr<Conferenc
// -----------------------------------------------------------------------------
void ClientGroupChatRoom::onCallSessionSetReleased (const std::shared_ptr<const CallSession> &session) {
void ClientGroupChatRoom::onCallSessionSetReleased (const shared_ptr<const CallSession> &session) {
L_D_T(RemoteConference, dConference);
ParticipantPrivate *participantPrivate = dConference->focus->getPrivate();
......@@ -441,7 +457,7 @@ void ClientGroupChatRoom::onCallSessionSetReleased (const std::shared_ptr<const
}
void ClientGroupChatRoom::onCallSessionStateChanged (
const std::shared_ptr<const CallSession> &session,
const shared_ptr<const CallSession> &session,
LinphoneCallState state,
const string &message
) {
......
......@@ -39,6 +39,12 @@ public:
const std::string &subject
);
ClientGroupChatRoom (
const std::shared_ptr<Core> &core,
const ChatRoomId &chatRoomId,
const std::string &subject
);
std::shared_ptr<Core> getCore () const;
CapabilitiesMask getCapabilities () const override;
......
......@@ -34,17 +34,18 @@ class ConferencePrivate {
public:
IdentityAddress conferenceAddress;
std::list<std::shared_ptr<Participant>> participants;
std::string subject;
protected:
CallListener *callListener = nullptr;
Conference *mPublic = nullptr;
std::shared_ptr<Participant> activeParticipant;
std::shared_ptr<Participant> me;
std::string subject;
Conference *mPublic = nullptr;
private:
CallListener *callListener = nullptr;
std::shared_ptr<Participant> me;
L_DECLARE_PUBLIC(Conference);
};
......
......@@ -1398,23 +1398,16 @@ MainDb::MainDb (const shared_ptr<Core> &core) : AbstractDb(*new MainDbPrivate),
capabilities & static_cast<int>(ChatRoom::Capabilities::RealTimeText)
);
chatRoom->setSubject(subject);
ChatRoomPrivate *dChatRoom = chatRoom->getPrivate();
dChatRoom->creationTime = Utils::getTmAsTimeT(creationDate);
dChatRoom->lastUpdateTime = Utils::getTmAsTimeT(lastUpdateDate);
} else if (capabilities & static_cast<int>(ChatRoom::Capabilities::Conference)) {
// TODO: Fetch!
// chatRoom = make_shared<ClientGroupChatRoom>(
// getCore(),
// Address("sip:titi@sip.linphone.org"), // TODO: Fix me!!!
// chatRoomId,
// subject
// );
}
} else if (capabilities & static_cast<int>(ChatRoom::Capabilities::Conference))
chatRoom = make_shared<ClientGroupChatRoom>(core, chatRoomId, subject);
if (!chatRoom)
continue; // Not fetched.
ChatRoomPrivate *dChatRoom = chatRoom->getPrivate();
dChatRoom->creationTime = Utils::getTmAsTimeT(creationDate);
dChatRoom->lastUpdateTime = Utils::getTmAsTimeT(lastUpdateDate);
chatRooms.push_back(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