Commit 57f63826 authored by Ronan's avatar Ronan

feat(MainDb): create server group chat room from database

parent 04168f9b
......@@ -78,8 +78,17 @@ void ServerGroupChatRoomPrivate::onChatMessageReceived(const shared_ptr<ChatMess
// =============================================================================
ServerGroupChatRoom::ServerGroupChatRoom (const shared_ptr<Core> &core, SalCallOp *op) :
ChatRoom(*new ServerGroupChatRoomPrivate, core, ChatRoomId(IdentityAddress(op->get_to()), IdentityAddress(op->get_to()))),
LocalConference(core, IdentityAddress(op->get_to()), nullptr) {}
ChatRoom(*new ServerGroupChatRoomPrivate, core, ChatRoomId(IdentityAddress(op->get_to()), IdentityAddress(op->get_to()))),
LocalConference(core, IdentityAddress(op->get_to()), nullptr) {}
ServerGroupChatRoom::ServerGroupChatRoom (
const shared_ptr<Core> &core,
const IdentityAddress &peerAddress,
const string &subject,
list<shared_ptr<Participant>> &&participants,
unsigned int lastNotifyId
) : ChatRoom(*new ServerGroupChatRoomPrivate, core, ChatRoomId(peerAddress, peerAddress)),
LocalConference(core, peerAddress, nullptr) {}
int ServerGroupChatRoom::getCapabilities () const {
return 0;
......
......@@ -39,6 +39,15 @@ public:
// TODO: Make me private!
ServerGroupChatRoom (const std::shared_ptr<Core> &core, SalCallOp *op);
// TODO: Same idea.
ServerGroupChatRoom (
const std::shared_ptr<Core> &core,
const IdentityAddress &peerAddress,
const std::string &subject,
std::list<std::shared_ptr<Participant>> &&participants,
unsigned int lastNotifyId
);
CapabilitiesMask getCapabilities () const override;
bool hasBeenLeft () const override;
......
......@@ -29,6 +29,7 @@
#include "chat/chat-message/chat-message-p.h"
#include "chat/chat-room/chat-room-p.h"
#include "chat/chat-room/client-group-chat-room.h"
#include "chat/chat-room/server-group-chat-room.h"
#include "conference/participant-p.h"
#include "content/content-type.h"
#include "content/content.h"
......@@ -1873,15 +1874,24 @@ MainDb::MainDb (const shared_ptr<Core> &core) : AbstractDb(*new MainDbPrivate),
continue;
}
chatRoom = make_shared<ClientGroupChatRoom>(
core,
chatRoomId.getPeerAddress(),
me,
subject,
move(participants),
lastNotifyId,
!!row.get<int>(8, 0)
);
if (!linphone_core_conference_server_enabled(core->getCCore()))
chatRoom = make_shared<ClientGroupChatRoom>(
core,
chatRoomId.getPeerAddress(),
me,
subject,
move(participants),
lastNotifyId,
!!row.get<int>(8, 0)
);
else
chatRoom = make_shared<ServerGroupChatRoom>(
core,
chatRoomId.getPeerAddress(),
subject,
move(participants),
lastNotifyId
);
}
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