mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-05-06 21:33:08 +00:00
feat(core): add a find one to one chat room function
This commit is contained in:
parent
71757bbce7
commit
310637f275
3 changed files with 23 additions and 1 deletions
|
|
@ -23,6 +23,7 @@
|
|||
#include "chat/chat-room/basic-chat-room.h"
|
||||
#include "chat/chat-room/chat-room-p.h"
|
||||
#include "chat/chat-room/real-time-text-chat-room.h"
|
||||
#include "conference/participant.h"
|
||||
#include "core-p.h"
|
||||
#include "logger/logger.h"
|
||||
|
||||
|
|
@ -127,6 +128,22 @@ list<shared_ptr<ChatRoom>> Core::findChatRooms (const IdentityAddress &peerAddre
|
|||
return output;
|
||||
}
|
||||
|
||||
shared_ptr<ChatRoom> Core::findOneToOneChatRoom (
|
||||
const IdentityAddress &localAddress,
|
||||
const IdentityAddress &participantAddress
|
||||
) {
|
||||
L_D();
|
||||
for (const auto &chatRoom : d->chatRooms) {
|
||||
if (
|
||||
chatRoom->getNbParticipants() == 1 &&
|
||||
chatRoom->getLocalAddress() == localAddress &&
|
||||
participantAddress == chatRoom->getParticipants().front()->getAddress()
|
||||
)
|
||||
return chatRoom;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
shared_ptr<ChatRoom> Core::createClientGroupChatRoom (const string &subject) {
|
||||
L_D();
|
||||
return L_GET_CPP_PTR_FROM_C_OBJECT(
|
||||
|
|
|
|||
|
|
@ -70,6 +70,11 @@ public:
|
|||
std::shared_ptr<ChatRoom> findChatRoom (const ChatRoomId &chatRoomId) const;
|
||||
std::list<std::shared_ptr<ChatRoom>> findChatRooms (const IdentityAddress &peerAddress) const;
|
||||
|
||||
std::shared_ptr<ChatRoom> findOneToOneChatRoom (
|
||||
const IdentityAddress &localAddress,
|
||||
const IdentityAddress &participantAddress
|
||||
);
|
||||
|
||||
std::shared_ptr<ChatRoom> createClientGroupChatRoom (const std::string &subject);
|
||||
std::shared_ptr<ChatRoom> createClientGroupChatRoom (const std::string &subject, const IdentityAddress &localAddress);
|
||||
|
||||
|
|
|
|||
|
|
@ -897,7 +897,7 @@ MainDb::MainDb (const shared_ptr<Core> &core) : AbstractDb(*new MainDbPrivate),
|
|||
// Chatroom subject.
|
||||
" subject VARCHAR(255),"
|
||||
|
||||
" last_notify_id INT UNSIGNED,"
|
||||
" last_notify_id INT UNSIGNED DEFAULT 0,"
|
||||
|
||||
" flags INT UNSIGNED DEFAULT 0,"
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue