Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
liblinphone
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
10
Issues
10
List
Board
Labels
Milestones
Merge Requests
22
Merge Requests
22
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
External Wiki
External Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
BC
public
liblinphone
Commits
5294d027
Commit
5294d027
authored
Dec 19, 2017
by
Ghislain MARY
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve fallback from client group to basic chat room test.
parent
6fd7ad1e
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
48 additions
and
15 deletions
+48
-15
client-group-chat-room-p.h
src/chat/chat-room/client-group-chat-room-p.h
+1
-1
client-group-chat-room.cpp
src/chat/chat-room/client-group-chat-room.cpp
+16
-0
client-group-to-basic-chat-room.cpp
src/chat/chat-room/client-group-to-basic-chat-room.cpp
+3
-3
call-session-p.h
src/conference/session/call-session-p.h
+2
-0
group_chat_tester.c
tester/group_chat_tester.c
+26
-11
No files found.
src/chat/chat-room/client-group-chat-room-p.h
View file @
5294d027
...
...
@@ -36,7 +36,7 @@ public:
void
notifyReceived
(
const
std
::
string
&
body
);
void
multipartNotifyReceived
(
const
std
::
string
&
body
);
void
setCallSessionListener
(
CallSessionListener
*
listener
)
{
callSessionListener
=
listener
;
}
void
setCallSessionListener
(
CallSessionListener
*
listener
)
;
void
setChatRoomListener
(
ChatRoomListener
*
listener
)
{
chatRoomListener
=
listener
;
}
// ChatRoomListener
...
...
src/chat/chat-room/client-group-chat-room.cpp
View file @
5294d027
...
...
@@ -83,6 +83,22 @@ void ClientGroupChatRoomPrivate::multipartNotifyReceived (const string &body) {
// -----------------------------------------------------------------------------
void
ClientGroupChatRoomPrivate
::
setCallSessionListener
(
CallSessionListener
*
listener
)
{
L_Q
();
L_Q_T
(
RemoteConference
,
qConference
);
callSessionListener
=
listener
;
shared_ptr
<
CallSession
>
session
=
qConference
->
getPrivate
()
->
focus
->
getPrivate
()
->
getSession
();
if
(
session
)
session
->
getPrivate
()
->
setCallSessionListener
(
listener
);
for
(
const
auto
&
participant
:
q
->
getParticipants
())
{
session
=
participant
->
getPrivate
()
->
getSession
();
if
(
session
)
session
->
getPrivate
()
->
setCallSessionListener
(
listener
);
}
}
// -----------------------------------------------------------------------------
void
ClientGroupChatRoomPrivate
::
onChatRoomInsertRequested
(
const
shared_ptr
<
AbstractChatRoom
>
&
chatRoom
)
{
L_Q
();
q
->
getCore
()
->
getPrivate
()
->
insertChatRoom
(
chatRoom
);
...
...
src/chat/chat-room/client-group-to-basic-chat-room.cpp
View file @
5294d027
...
...
@@ -62,9 +62,9 @@ public:
return
;
if
((
newState
==
LinphoneCallError
)
&&
(
cgcr
->
getState
()
==
ChatRoom
::
State
::
CreationPending
)
&&
(
invitedAddresses
.
size
()
==
1
))
{
cgcr
->
getPrivate
()
->
setCallSessionListener
(
cgcr
->
getPrivate
()
);
cgcr
->
getPrivate
()
->
setC
hatRoomListener
(
cgcr
->
getPrivate
()
);
cgcr
->
getPrivate
()
->
set
State
(
ChatRoom
::
State
::
CreationFailed
);
cgcr
->
getPrivate
()
->
onCallSessionStateChanged
(
session
,
newState
,
message
);
cgcr
->
getPrivate
()
->
setC
allSessionListener
(
nullptr
);
cgcr
->
getPrivate
()
->
set
ChatRoomListener
(
nullptr
);
Core
::
deleteChatRoom
(
q
->
getSharedFromThis
());
LinphoneChatRoom
*
lcr
=
L_GET_C_BACK_PTR
(
q
);
L_SET_CPP_PTR_FROM_C_OBJECT
(
lcr
,
cgcr
->
getCore
()
->
getOrCreateBasicChatRoom
(
invitedAddresses
.
front
()));
...
...
src/conference/session/call-session-p.h
View file @
5294d027
...
...
@@ -67,6 +67,8 @@ public:
void
updatedByRemote
();
virtual
void
updating
(
bool
isUpdate
);
void
setCallSessionListener
(
CallSessionListener
*
listener
)
{
this
->
listener
=
listener
;
}
protected
:
void
init
();
...
...
tester/group_chat_tester.c
View file @
5294d027
...
...
@@ -926,9 +926,9 @@ static void group_chat_room_come_back_after_disconnection (void) {
}
static
void
group_chat_room_create_room_with_disconnected_friends
(
void
)
{
LinphoneCoreManager
*
marie
=
linphone_core_manager_
new
(
"marie_rc"
);
LinphoneCoreManager
*
pauline
=
linphone_core_manager_
new
(
"pauline_rc"
);
LinphoneCoreManager
*
laure
=
linphone_core_manager_
new
(
"laure_tcp_rc"
);
LinphoneCoreManager
*
marie
=
linphone_core_manager_
create
(
"marie_rc"
);
LinphoneCoreManager
*
pauline
=
linphone_core_manager_
create
(
"pauline_rc"
);
LinphoneCoreManager
*
laure
=
linphone_core_manager_
create
(
"laure_tcp_rc"
);
bctbx_list_t
*
coresManagerList
=
NULL
;
bctbx_list_t
*
participantsAddresses
=
NULL
;
int
dummy
=
0
;
...
...
@@ -944,6 +944,7 @@ static void group_chat_room_create_room_with_disconnected_friends (void) {
linphone_core_set_network_reachable
(
laure
->
lc
,
FALSE
);
bctbx_list_t
*
coresList
=
init_core_for_conference
(
coresManagerList
);
start_core_for_conference
(
coresManagerList
);
wait_for_list
(
coresList
,
&
dummy
,
1
,
3000
);
...
...
@@ -1234,9 +1235,9 @@ static void group_chat_room_send_refer_to_all_devices (void) {
}
static
void
multiple_is_composing_notification
(
void
)
{
LinphoneCoreManager
*
marie
=
linphone_core_manager_
new
(
"marie_rc"
);
LinphoneCoreManager
*
pauline
=
linphone_core_manager_
new
(
"pauline_rc"
);
LinphoneCoreManager
*
laure
=
linphone_core_manager_
new
(
"laure_tcp_rc"
);
LinphoneCoreManager
*
marie
=
linphone_core_manager_
create
(
"marie_rc"
);
LinphoneCoreManager
*
pauline
=
linphone_core_manager_
create
(
"pauline_rc"
);
LinphoneCoreManager
*
laure
=
linphone_core_manager_
create
(
"laure_tcp_rc"
);
bctbx_list_t
*
coresManagerList
=
NULL
;
bctbx_list_t
*
participantsAddresses
=
NULL
;
const
bctbx_list_t
*
composing_addresses
=
NULL
;
...
...
@@ -1244,6 +1245,7 @@ static void multiple_is_composing_notification(void) {
coresManagerList
=
bctbx_list_append
(
coresManagerList
,
pauline
);
coresManagerList
=
bctbx_list_append
(
coresManagerList
,
laure
);
bctbx_list_t
*
coresList
=
init_core_for_conference
(
coresManagerList
);
start_core_for_conference
(
coresManagerList
);
participantsAddresses
=
bctbx_list_append
(
participantsAddresses
,
linphone_address_new
(
linphone_core_get_identity
(
pauline
->
lc
)));
participantsAddresses
=
bctbx_list_append
(
participantsAddresses
,
linphone_address_new
(
linphone_core_get_identity
(
laure
->
lc
)));
stats
initialMarieStats
=
marie
->
stat
;
...
...
@@ -1413,25 +1415,38 @@ static void group_chat_room_fallback_to_basic_chat_room (void) {
start_core_for_conference
(
coresManagerList
);
participantsAddresses
=
bctbx_list_append
(
participantsAddresses
,
linphone_address_new
(
linphone_core_get_identity
(
pauline
->
lc
)));
stats
initialMarieStats
=
marie
->
stat
;
stats
initialPaulineStats
=
pauline
->
stat
;
// Marie creates a new group chat room
LinphoneChatRoom
*
chatRoom
=
linphone_core_create_client_group_chat_room
(
marie
->
lc
,
"Fallback"
);
LinphoneChatRoom
*
marieCr
=
linphone_core_create_client_group_chat_room
(
marie
->
lc
,
"Fallback"
);
BC_ASSERT_TRUE
(
wait_for_list
(
coresList
,
&
marie
->
stat
.
number_of_LinphoneChatRoomStateInstantiated
,
initialMarieStats
.
number_of_LinphoneChatRoomStateInstantiated
+
1
,
100
));
// Add participants
linphone_chat_room_add_participants
(
chatRoom
,
participantsAddresses
);
linphone_chat_room_add_participants
(
marieCr
,
participantsAddresses
);
// Check that the group chat room creation fails and that a fallback to a basic chat room is done
BC_ASSERT_TRUE
(
wait_for_list
(
coresList
,
&
marie
->
stat
.
number_of_LinphoneChatRoomStateCreationPending
,
initialMarieStats
.
number_of_LinphoneChatRoomStateCreationPending
+
1
,
10000
));
BC_ASSERT_TRUE
(
wait_for_list
(
coresList
,
&
marie
->
stat
.
number_of_LinphoneChatRoomStateCreationFailed
,
initialMarieStats
.
number_of_LinphoneChatRoomStateCreationFailed
+
1
,
10000
));
BC_ASSERT_TRUE
(
wait_for_list
(
coresList
,
&
marie
->
stat
.
number_of_LinphoneChatRoomStateCreated
,
initialMarieStats
.
number_of_LinphoneChatRoomStateCreated
+
1
,
10000
));
BC_ASSERT_EQUAL
(
linphone_chat_room_get_nb_participants
(
chatRoom
),
1
,
int
,
"%d"
);
BC_ASSERT_TRUE
(
linphone_chat_room_get_capabilities
(
chatRoom
)
&
LinphoneChatRoomCapabilitiesBasic
);
BC_ASSERT_EQUAL
(
linphone_chat_room_get_nb_participants
(
marieCr
),
1
,
int
,
"%d"
);
BC_ASSERT_TRUE
(
linphone_chat_room_get_capabilities
(
marieCr
)
&
LinphoneChatRoomCapabilitiesBasic
);
bctbx_list_free_with_data
(
participantsAddresses
,
(
bctbx_list_free_func
)
linphone_address_unref
);
participantsAddresses
=
NULL
;
// Send a message and check that a basic chat room is create on Pauline's side
LinphoneChatMessage
*
msg
=
linphone_chat_room_create_message
(
marieCr
,
"Hey Pauline!"
);
linphone_chat_message_send
(
msg
);
BC_ASSERT_TRUE
(
wait_for_list
(
coresList
,
&
pauline
->
stat
.
number_of_LinphoneMessageReceived
,
initialPaulineStats
.
number_of_LinphoneMessageReceived
+
1
,
1000
));
BC_ASSERT_PTR_NOT_NULL
(
pauline
->
stat
.
last_received_chat_message
);
if
(
pauline
->
stat
.
last_received_chat_message
)
BC_ASSERT_STRING_EQUAL
(
linphone_chat_message_get_content_type
(
pauline
->
stat
.
last_received_chat_message
),
"text/plain"
);
LinphoneChatRoom
*
paulineCr
=
linphone_core_get_chat_room
(
pauline
->
lc
,
linphone_chat_room_get_local_address
(
marieCr
));
BC_ASSERT_PTR_NOT_NULL
(
paulineCr
);
if
(
paulineCr
)
BC_ASSERT_TRUE
(
linphone_chat_room_get_capabilities
(
paulineCr
)
&
LinphoneChatRoomCapabilitiesBasic
);
// Clean db from chat room
linphone_core_delete_chat_room
(
marie
->
lc
,
chatRoom
);
linphone_core_delete_chat_room
(
marie
->
lc
,
marieCr
);
wait_for_list
(
coresList
,
&
dummy
,
1
,
1000
);
bctbx_list_free
(
coresList
);
...
...
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