mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-22 13:48:09 +00:00
feat(MainDb): fetch chat rooms participants
This commit is contained in:
parent
140a277410
commit
a314ffd2c2
4 changed files with 23 additions and 5 deletions
|
|
@ -100,7 +100,8 @@ RemoteConference(core, me, nullptr) {
|
|||
ClientGroupChatRoom::ClientGroupChatRoom (
|
||||
const shared_ptr<Core> &core,
|
||||
const ChatRoomId &chatRoomId,
|
||||
const string &subject
|
||||
const string &subject,
|
||||
list<shared_ptr<Participant>> &&participants
|
||||
) : ChatRoom(*new ClientGroupChatRoomPrivate, core, chatRoomId),
|
||||
RemoteConference(core, chatRoomId.getLocalAddress(), nullptr) {
|
||||
L_D();
|
||||
|
|
@ -109,6 +110,7 @@ RemoteConference(core, chatRoomId.getLocalAddress(), nullptr) {
|
|||
dConference->focus = make_shared<Participant>(peerAddress);
|
||||
dConference->conferenceAddress = peerAddress;
|
||||
dConference->subject = subject;
|
||||
dConference->participants = move(participants);
|
||||
d->state = ChatRoom::State::Created;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -42,7 +42,8 @@ public:
|
|||
ClientGroupChatRoom (
|
||||
const std::shared_ptr<Core> &core,
|
||||
const ChatRoomId &chatRoomId,
|
||||
const std::string &subject
|
||||
const std::string &subject,
|
||||
std::list<std::shared_ptr<Participant>> &&participants
|
||||
);
|
||||
|
||||
std::shared_ptr<Core> getCore () const;
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ class Participant : public Object {
|
|||
friend class LocalConference;
|
||||
friend class LocalConferenceEventHandler;
|
||||
friend class LocalConferenceEventHandlerPrivate;
|
||||
friend class MainDb;
|
||||
friend class MediaSessionPrivate;
|
||||
friend class RemoteConference;
|
||||
friend class ServerGroupChatRoom;
|
||||
|
|
|
|||
|
|
@ -27,9 +27,9 @@
|
|||
#include "linphone/utils/utils.h"
|
||||
|
||||
#include "chat/chat-message/chat-message-p.h"
|
||||
#include "chat/chat-room/client-group-chat-room.h"
|
||||
#include "chat/chat-room/chat-room-p.h"
|
||||
#include "conference/participant.h"
|
||||
#include "chat/chat-room/client-group-chat-room.h"
|
||||
#include "conference/participant-p.h"
|
||||
#include "content/content-type.h"
|
||||
#include "content/content.h"
|
||||
#include "core/core-p.h"
|
||||
|
|
@ -1553,8 +1553,22 @@ MainDb::MainDb (const shared_ptr<Core> &core) : AbstractDb(*new MainDbPrivate),
|
|||
);
|
||||
chatRoom->setSubject(subject);
|
||||
} else if (capabilities & static_cast<int>(ChatRoom::Capabilities::Conference)) {
|
||||
list<shared_ptr<Participant>> participants;
|
||||
|
||||
chatRoom = make_shared<ClientGroupChatRoom>(core, chatRoomId, subject);
|
||||
string query = "SELECT sip_address.value, is_admin"
|
||||
" FROM sip_address, chat_room, chat_room_participant"
|
||||
" WHERE chat_room.id = :chatRoomId"
|
||||
" AND sip_address.id = chat_room_participant.participant_sip_address_id"
|
||||
" AND chat_room_participant.chat_room_id = chat_room.id";
|
||||
|
||||
soci::rowset<soci::row> rows = (session->prepare << query);
|
||||
for (const auto &row : rows) {
|
||||
shared_ptr<Participant> participant = make_shared<Participant>(IdentityAddress(row.get<string>(0)));
|
||||
participant->getPrivate()->setAdmin(!!row.get<int>(1));
|
||||
participants.push_back(participant);
|
||||
}
|
||||
|
||||
chatRoom = make_shared<ClientGroupChatRoom>(core, chatRoomId, subject, move(participants));
|
||||
}
|
||||
|
||||
if (!chatRoom)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue