Commit 181bfa2e authored by Ghislain MARY's avatar Ghislain MARY

Change the chat room instantiated callback to chat room state changed.

parent 05271e86
......@@ -434,12 +434,12 @@ void linphone_core_cbs_set_version_update_check_result_received(LinphoneCoreCbs
cbs->vtable->version_update_check_result_received = cb;
}
LinphoneCoreCbsChatRoomInstantiatedCb linphone_core_cbs_get_chat_room_instantiated (LinphoneCoreCbs *cbs) {
return cbs->vtable->chat_room_instantiated;
LinphoneCoreCbsChatRoomStateChangedCb linphone_core_cbs_get_chat_room_state_changed (LinphoneCoreCbs *cbs) {
return cbs->vtable->chat_room_state_changed;
}
void linphone_core_cbs_set_chat_room_instantiated (LinphoneCoreCbs *cbs, LinphoneCoreCbsChatRoomInstantiatedCb cb) {
cbs->vtable->chat_room_instantiated = cb;
void linphone_core_cbs_set_chat_room_state_changed (LinphoneCoreCbs *cbs, LinphoneCoreCbsChatRoomStateChangedCb cb) {
cbs->vtable->chat_room_state_changed = cb;
}
void linphone_core_cbs_set_ec_calibration_result(LinphoneCoreCbs *cbs, LinphoneCoreCbsEcCalibrationResultCb cb) {
......
......@@ -536,7 +536,7 @@ void linphone_core_notify_friend_list_created(LinphoneCore *lc, LinphoneFriendLi
void linphone_core_notify_friend_list_removed(LinphoneCore *lc, LinphoneFriendList *list);
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_instantiated (LinphoneCore *lc, LinphoneChatRoom *cr);
void linphone_core_notify_chat_room_state_changed (LinphoneCore *lc, LinphoneChatRoom *cr, LinphoneChatRoomState state);
void linphone_core_notify_ec_calibration_result(LinphoneCore *lc, LinphoneEcCalibratorStatus status, int delay_ms);
void linphone_core_notify_ec_calibration_audio_init(LinphoneCore *lc);
......
......@@ -288,8 +288,8 @@ void linphone_core_notify_version_update_check_result_received(LinphoneCore *lc,
cleanup_dead_vtable_refs(lc);
}
void linphone_core_notify_chat_room_instantiated (LinphoneCore *lc, LinphoneChatRoom *cr) {
NOTIFY_IF_EXIST(chat_room_instantiated, lc, cr);
void linphone_core_notify_chat_room_state_changed (LinphoneCore *lc, LinphoneChatRoom *cr, LinphoneChatRoomState state) {
NOTIFY_IF_EXIST(chat_room_state_changed, lc, cr, state);
cleanup_dead_vtable_refs(lc);
}
......
......@@ -399,11 +399,11 @@ typedef LinphoneCoreCbsFriendListRemovedCb LinphoneCoreFriendListRemovedCb;
typedef void (*LinphoneCoreCbsVersionUpdateCheckResultReceivedCb) (LinphoneCore *lc, LinphoneVersionUpdateCheckResult result, const char *version, const char *url);
/**
* Callback prototype telling that a LinphoneChatRoom object has been instantiated. This is useful to set the callbacks on the LinphoneChatRoom object.
* Callback prototype telling that a LinphoneChatRoom state has changed.
* @param[in] lc LinphoneCore object
* @param[in] cr The LinphoneChatRoom object that has been instantiated
* @param[in] cr The LinphoneChatRoom object for which the state has changed
*/
typedef void (*LinphoneCoreCbsChatRoomInstantiatedCb) (LinphoneCore *lc, LinphoneChatRoom *cr);
typedef void (*LinphoneCoreCbsChatRoomStateChangedCb) (LinphoneCore *lc, LinphoneChatRoom *cr, LinphoneChatRoomState state);
/**
* @}
......
......@@ -185,7 +185,7 @@ typedef struct _LinphoneCoreVTable{
LinphoneCoreFriendListRemovedCb friend_list_removed;
LinphoneCoreCbsCallCreatedCb call_created;
LinphoneCoreCbsVersionUpdateCheckResultReceivedCb version_update_check_result_received;
LinphoneCoreCbsChatRoomInstantiatedCb chat_room_instantiated;
LinphoneCoreCbsChatRoomStateChangedCb chat_room_state_changed;
LinphoneCoreCbsEcCalibrationResultCb ec_calibration_result;
LinphoneCoreCbsEcCalibrationAudioInitCb ec_calibration_audio_init;
LinphoneCoreCbsEcCalibrationAudioUninitCb ec_calibration_audio_uninit;
......@@ -666,18 +666,18 @@ LINPHONE_PUBLIC void linphone_core_cbs_set_version_update_check_result_received(
LINPHONE_PUBLIC LinphoneCoreCbsVersionUpdateCheckResultReceivedCb linphone_core_cbs_get_version_update_check_result_received(LinphoneCoreCbs *cbs);
/**
* Get the chat room instantiated callback.
* Get the chat room state changed callback.
* @param[in] cbs LinphoneCoreCbs object
* @return The current callback
*/
LINPHONE_PUBLIC LinphoneCoreCbsChatRoomInstantiatedCb linphone_core_cbs_get_chat_room_instantiated (LinphoneCoreCbs *cbs);
LINPHONE_PUBLIC LinphoneCoreCbsChatRoomStateChangedCb linphone_core_cbs_get_chat_room_state_changed (LinphoneCoreCbs *cbs);
/**
* Set the chat room instantiated callback.
* Set the chat room state changed callback.
* @param[in] cbs LinphoneCoreCbs object
* @param[in] cb The callback to use
*/
LINPHONE_PUBLIC void linphone_core_cbs_set_chat_room_instantiated (LinphoneCoreCbs *cbs, LinphoneCoreCbsChatRoomInstantiatedCb cb);
LINPHONE_PUBLIC void linphone_core_cbs_set_chat_room_state_changed (LinphoneCoreCbs *cbs, LinphoneCoreCbsChatRoomStateChangedCb cb);
/**
* @brief Sets a callback to call each time the echo-canceler calibration is completed.
......
......@@ -57,12 +57,8 @@ void ChatRoomPrivate::release () {
// -----------------------------------------------------------------------------
void ChatRoomPrivate::setState (ChatRoom::State newState) {
L_Q();
if (newState != state) {
state = newState;
if (state == ChatRoom::State::Created)
// TODO : Rename from instatiated to created.
linphone_core_notify_chat_room_instantiated(q->getCore()->getCCore(), L_GET_C_BACK_PTR(q));
notifyStateChanged();
}
}
......@@ -272,6 +268,7 @@ void ChatRoomPrivate::notifyIsComposingReceived (const Address &remoteAddr, bool
void ChatRoomPrivate::notifyStateChanged () {
L_Q();
linphone_core_notify_chat_room_state_changed(q->getCore()->getCCore(), L_GET_C_BACK_PTR(q), (LinphoneChatRoomState)state);
LinphoneChatRoom *cr = L_GET_C_BACK_PTR(q);
LinphoneChatRoomCbs *cbs = linphone_chat_room_get_callbacks(cr);
LinphoneChatRoomCbsStateChangedCb cb = linphone_chat_room_cbs_get_state_changed(cbs);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment