Commit 71fd0d0a authored by Ghislain MARY's avatar Ghislain MARY

Add linphone_chat_room_set_current_callbacks() API.

parent ab721847
......@@ -299,7 +299,7 @@ LINPHONE_PUBLIC void linphone_chat_room_remove_callbacks(LinphoneChatRoom *cr, L
* @return The LinphoneChatRoomCbs that has called the last callback
*/
LINPHONE_PUBLIC LinphoneChatRoomCbs *linphone_chat_room_get_current_callbacks(const LinphoneChatRoom *cr);
/**
* Get the state of the chat room.
* @param[in] cr LinphoneChatRoom object
......
......@@ -56,12 +56,19 @@ LINPHONE_PUBLIC const bctbx_list_t *linphone_call_get_callbacks_list(const Linph
/**
* @brief Gets the list of listener in the chat room.
* @param[in] call #LinphoneChatRoom object.
* @param[in] cr #LinphoneChatRoom object.
* @return The list of #LinphoneChatRoomCbs.
* @donotwrap
*/
LINPHONE_PUBLIC const bctbx_list_t *linphone_chat_room_get_callbacks_list(const LinphoneChatRoom *cr);
/**
* Sets the current LinphoneChatRoomCbs.
* @param[in] cr LinphoneChatRoom object
* @param[in] cbs LinphoneChatRoomCbs object
*/
LINPHONE_PUBLIC void linphone_chat_room_set_current_callbacks(LinphoneChatRoom *cr, LinphoneChatRoomCbs *cbs);
/**
* Send a message to peer member of this chat room.
*
......
......@@ -419,19 +419,23 @@ LinphoneChatRoomCbs *linphone_chat_room_get_current_callbacks (const LinphoneCha
return cr->currentCbs;
}
void linphone_chat_room_set_current_callbacks(LinphoneChatRoom *cr, LinphoneChatRoomCbs *cbs) {
cr->currentCbs = cbs;
}
const bctbx_list_t *linphone_chat_room_get_callbacks_list(const LinphoneChatRoom *cr) {
return cr->callbacks;
}
#define NOTIFY_IF_EXIST(cbName, functionName, ...) \
bctbx_list_t *callbacks_copy = bctbx_list_copy(cr->callbacks); \
for (bctbx_list_t *it = callbacks_copy; it; it = bctbx_list_next(it)) { \
cr->currentCbs = reinterpret_cast<LinphoneChatRoomCbs *>(bctbx_list_get_data(it)); \
LinphoneChatRoomCbs ## cbName ## Cb cb = linphone_chat_room_cbs_get_ ## functionName (cr->currentCbs); \
bctbx_list_t *callbacksCopy = bctbx_list_copy(linphone_chat_room_get_callbacks_list(cr)); \
for (bctbx_list_t *it = callbacksCopy; it; it = bctbx_list_next(it)) { \
linphone_chat_room_set_current_callbacks(cr, reinterpret_cast<LinphoneChatRoomCbs *>(bctbx_list_get_data(it))); \
LinphoneChatRoomCbs ## cbName ## Cb cb = linphone_chat_room_cbs_get_ ## functionName (linphone_chat_room_get_current_callbacks(cr)); \
if (cb) \
cb(__VA_ARGS__); \
} \
bctbx_free(callbacks_copy);
bctbx_free(callbacksCopy);
void _linphone_chat_room_notify_is_composing_received(LinphoneChatRoom *cr, const LinphoneAddress *remoteAddr, bool_t isComposing) {
NOTIFY_IF_EXIST(IsComposingReceived, is_composing_received, cr, remoteAddr, isComposing)
......
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