Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
BC
public
liblinphone
Commits
310637f2
Commit
310637f2
authored
Nov 30, 2017
by
Ronan
Browse files
feat(core): add a find one to one chat room function
parent
71757bbc
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/core/core-chat-room.cpp
View file @
310637f2
...
...
@@ -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
(
...
...
src/core/core.h
View file @
310637f2
...
...
@@ -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
);
...
...
src/db/main-db.cpp
View file @
310637f2
...
...
@@ -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,"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment