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
01759692
Commit
01759692
authored
Nov 28, 2019
by
Sylvain Berfini
🐮
Browse files
Added Core callback to notify when a chat room subject as changed
parent
fe0b8028
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
47 additions
and
0 deletions
+47
-0
coreapi/linphonecore.c
coreapi/linphonecore.c
+8
-0
coreapi/private_functions.h
coreapi/private_functions.h
+1
-0
coreapi/vtables.c
coreapi/vtables.c
+5
-0
include/linphone/callbacks.h
include/linphone/callbacks.h
+7
-0
include/linphone/core.h
include/linphone/core.h
+15
-0
src/chat/chat-room/client-group-chat-room.cpp
src/chat/chat-room/client-group-chat-room.cpp
+1
-0
tester/group_chat_tester.c
tester/group_chat_tester.c
+9
-0
tester/liblinphone_tester.h
tester/liblinphone_tester.h
+1
-0
No files found.
coreapi/linphonecore.c
View file @
01759692
...
...
@@ -483,6 +483,14 @@ void linphone_core_cbs_set_chat_room_state_changed (LinphoneCoreCbs *cbs, Linpho
cbs
->
vtable
->
chat_room_state_changed
=
cb
;
}
LinphoneCoreCbsChatRoomSubjectChangedCb
linphone_core_cbs_get_chat_room_subject_changed
(
LinphoneCoreCbs
*
cbs
)
{
return
cbs
->
vtable
->
chat_room_subject_changed
;
}
void
linphone_core_cbs_set_chat_room_subject_changed
(
LinphoneCoreCbs
*
cbs
,
LinphoneCoreCbsChatRoomSubjectChangedCb
cb
)
{
cbs
->
vtable
->
chat_room_subject_changed
=
cb
;
}
LinphoneCoreCbsQrcodeFoundCb
linphone_core_cbs_get_qrcode_found
(
LinphoneCoreCbs
*
cbs
)
{
return
cbs
->
vtable
->
qrcode_found
;
}
...
...
coreapi/private_functions.h
View file @
01759692
...
...
@@ -562,6 +562,7 @@ void linphone_core_notify_friend_list_removed(LinphoneCore *lc, LinphoneFriendLi
void
linphone_core_notify_call_created
(
LinphoneCore
*
lc
,
LinphoneCall
*
call
);
void
linphone_core_notify_version_update_check_result_received
(
LinphoneCore
*
lc
,
LinphoneVersionUpdateCheckResult
result
,
const
char
*
version
,
const
char
*
url
);
void
linphone_core_notify_chat_room_state_changed
(
LinphoneCore
*
lc
,
LinphoneChatRoom
*
cr
,
LinphoneChatRoomState
state
);
void
linphone_core_notify_chat_room_subject_changed
(
LinphoneCore
*
lc
,
LinphoneChatRoom
*
cr
);
void
linphone_core_notify_qrcode_found
(
LinphoneCore
*
lc
,
const
char
*
result
);
void
linphone_core_notify_ec_calibration_result
(
LinphoneCore
*
lc
,
LinphoneEcCalibratorStatus
status
,
int
delay_ms
);
void
linphone_core_notify_ec_calibration_audio_init
(
LinphoneCore
*
lc
);
...
...
coreapi/vtables.c
View file @
01759692
...
...
@@ -319,6 +319,11 @@ void linphone_core_notify_chat_room_state_changed (LinphoneCore *lc, LinphoneCha
cleanup_dead_vtable_refs
(
lc
);
}
void
linphone_core_notify_chat_room_subject_changed
(
LinphoneCore
*
lc
,
LinphoneChatRoom
*
cr
)
{
NOTIFY_IF_EXIST
(
chat_room_subject_changed
,
lc
,
cr
);
cleanup_dead_vtable_refs
(
lc
);
}
void
linphone_core_notify_qrcode_found
(
LinphoneCore
*
lc
,
const
char
*
result
)
{
NOTIFY_IF_EXIST
(
qrcode_found
,
lc
,
result
);
cleanup_dead_vtable_refs
(
lc
);
...
...
include/linphone/callbacks.h
View file @
01759692
...
...
@@ -420,6 +420,13 @@ typedef void (*LinphoneCoreCbsVersionUpdateCheckResultReceivedCb) (LinphoneCore
*/
typedef
void
(
*
LinphoneCoreCbsChatRoomStateChangedCb
)
(
LinphoneCore
*
lc
,
LinphoneChatRoom
*
cr
,
LinphoneChatRoomState
state
);
/**
* Callback prototype telling that a #LinphoneChatRoom subject has changed.
* @param[in] lc #LinphoneCore object
* @param[in] cr The #LinphoneChatRoom object for which the subject has changed
*/
typedef
void
(
*
LinphoneCoreCbsChatRoomSubjectChangedCb
)
(
LinphoneCore
*
lc
,
LinphoneChatRoom
*
cr
);
/**
* Callback prototype telling the result of decoded qrcode
* @param[in] lc LinphoneCore object
...
...
include/linphone/core.h
View file @
01759692
...
...
@@ -231,6 +231,7 @@ typedef struct _LinphoneCoreVTable{
LinphoneCoreCbsEcCalibrationAudioUninitCb
ec_calibration_audio_uninit
;
LinphoneCoreCbsMessageReceivedCb
message_sent
;
LinphoneCoreCbsChatRoomReadCb
chat_room_read
;
LinphoneCoreCbsChatRoomSubjectChangedCb
chat_room_subject_changed
;
void
*
user_data
;
/**<User data associated with the above callbacks */
}
LinphoneCoreVTable
;
...
...
@@ -763,6 +764,20 @@ LINPHONE_PUBLIC LinphoneCoreCbsChatRoomStateChangedCb linphone_core_cbs_get_chat
*/
LINPHONE_PUBLIC
void
linphone_core_cbs_set_chat_room_state_changed
(
LinphoneCoreCbs
*
cbs
,
LinphoneCoreCbsChatRoomStateChangedCb
cb
);
/**
* Get the chat room subject changed callback.
* @param[in] cbs #LinphoneCoreCbs object
* @return The current callback
*/
LINPHONE_PUBLIC
LinphoneCoreCbsChatRoomSubjectChangedCb
linphone_core_cbs_get_chat_room_subject_changed
(
LinphoneCoreCbs
*
cbs
);
/**
* Set the chat room subject changed callback.
* @param[in] cbs #LinphoneCoreCbs object
* @param[in] cb The callback to use
*/
LINPHONE_PUBLIC
void
linphone_core_cbs_set_chat_room_subject_changed
(
LinphoneCoreCbs
*
cbs
,
LinphoneCoreCbsChatRoomSubjectChangedCb
cb
);
/**
* Get the qrcode found callback.
* @param[in] cbs LinphoneCoreCbs object
...
...
src/chat/chat-room/client-group-chat-room.cpp
View file @
01759692
...
...
@@ -854,6 +854,7 @@ void ClientGroupChatRoom::onSubjectChanged (const shared_ptr<ConferenceSubjectEv
LinphoneChatRoom
*
cr
=
d
->
getCChatRoom
();
_linphone_chat_room_notify_subject_changed
(
cr
,
L_GET_C_BACK_PTR
(
event
));
linphone_core_notify_chat_room_subject_changed
(
linphone_chat_room_get_core
(
cr
),
cr
);
}
void
ClientGroupChatRoom
::
onParticipantDeviceAdded
(
const
shared_ptr
<
ConferenceParticipantDeviceEvent
>
&
event
,
bool
isFullState
)
{
...
...
tester/group_chat_tester.c
View file @
01759692
...
...
@@ -169,6 +169,11 @@ void core_chat_room_state_changed (LinphoneCore *core, LinphoneChatRoom *cr, Lin
}
}
void
core_chat_room_subject_changed
(
LinphoneCore
*
core
,
LinphoneChatRoom
*
cr
)
{
LinphoneCoreManager
*
manager
=
(
LinphoneCoreManager
*
)
linphone_core_get_user_data
(
core
);
manager
->
stat
.
number_of_core_chat_room_subject_changed
++
;
}
void
configure_core_for_conference
(
LinphoneCore
*
core
,
const
char
*
username
,
const
LinphoneAddress
*
factoryAddr
,
bool_t
server
)
{
const
char
*
identity
=
linphone_core_get_identity
(
core
);
const
char
*
new_username
;
...
...
@@ -295,6 +300,7 @@ bctbx_list_t * init_core_for_conference(bctbx_list_t *coreManagerList) {
LinphoneCoreCbs
*
cbs
=
linphone_factory_create_core_cbs
(
linphone_factory_get
());
linphone_core_cbs_set_chat_room_state_changed
(
cbs
,
core_chat_room_state_changed
);
linphone_core_cbs_set_chat_room_subject_changed
(
cbs
,
core_chat_room_subject_changed
);
bctbx_list_for_each2
(
coreManagerList
,
(
void
(
*
)(
void
*
,
void
*
))
configure_core_for_callbacks
,
(
void
*
)
cbs
);
linphone_core_cbs_unref
(
cbs
);
...
...
@@ -1370,6 +1376,9 @@ static void group_chat_room_change_subject (void) {
BC_ASSERT_TRUE
(
wait_for_list
(
coresList
,
&
marie
->
stat
.
number_of_subject_changed
,
initialMarieStats
.
number_of_subject_changed
+
1
,
3000
));
BC_ASSERT_TRUE
(
wait_for_list
(
coresList
,
&
pauline
->
stat
.
number_of_subject_changed
,
initialPaulineStats
.
number_of_subject_changed
+
1
,
3000
));
BC_ASSERT_TRUE
(
wait_for_list
(
coresList
,
&
laure
->
stat
.
number_of_subject_changed
,
initialLaureStats
.
number_of_subject_changed
+
1
,
3000
));
BC_ASSERT_TRUE
(
wait_for_list
(
coresList
,
&
marie
->
stat
.
number_of_core_chat_room_subject_changed
,
initialMarieStats
.
number_of_core_chat_room_subject_changed
+
1
,
3000
));
BC_ASSERT_TRUE
(
wait_for_list
(
coresList
,
&
pauline
->
stat
.
number_of_core_chat_room_subject_changed
,
initialPaulineStats
.
number_of_core_chat_room_subject_changed
+
1
,
3000
));
BC_ASSERT_TRUE
(
wait_for_list
(
coresList
,
&
laure
->
stat
.
number_of_core_chat_room_subject_changed
,
initialLaureStats
.
number_of_core_chat_room_subject_changed
+
1
,
3000
));
BC_ASSERT_STRING_EQUAL
(
linphone_chat_room_get_subject
(
marieCr
),
newSubject
);
BC_ASSERT_STRING_EQUAL
(
linphone_chat_room_get_subject
(
paulineCr
),
newSubject
);
BC_ASSERT_STRING_EQUAL
(
linphone_chat_room_get_subject
(
laureCr
),
newSubject
);
...
...
tester/liblinphone_tester.h
View file @
01759692
...
...
@@ -312,6 +312,7 @@ typedef struct _stats {
int
number_of_participant_admin_statuses_changed
;
int
number_of_participants_removed
;
int
number_of_subject_changed
;
int
number_of_core_chat_room_subject_changed
;
int
number_of_participant_devices_added
;
int
number_of_participant_devices_removed
;
...
...
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