From beb18f5f5db79d927c42f5d7d1201899d295a25e Mon Sep 17 00:00:00 2001 From: Andrea Gianarda <andrea.gianarda@belledonne-communications.com> Date: Thu, 13 Feb 2025 08:12:33 +0100 Subject: [PATCH] Add conference and chatroom identifier. This is a simple way for applications to index a chatroom or conference provided by the SDK. Applications can also retrieve a chatroom or conference object by providing its identifier --- coreapi/chat.c | 7 + coreapi/linphonecore.c | 7 + include/linphone/api/c-chat-room.h | 10 +- include/linphone/api/c-conference.h | 8 + include/linphone/core.h | 20 + src/c-wrapper/api/c-chat-room.cpp | 705 ++++++++++--------- src/c-wrapper/api/c-conference.cpp | 10 +- src/chat/chat-room/abstract-chat-room.h | 1 + src/chat/chat-room/basic-chat-room.cpp | 7 + src/chat/chat-room/basic-chat-room.h | 1 + src/chat/chat-room/chat-room.cpp | 8 + src/chat/chat-room/chat-room.h | 1 + src/conference/conference-context.cpp | 2 +- src/conference/conference-id.cpp | 22 + src/conference/conference-id.h | 6 + src/conference/conference.cpp | 7 + src/conference/conference.h | 1 + src/core/core-chat-room.cpp | 8 + src/core/core-p.h | 1 + src/core/core.cpp | 8 + src/core/core.h | 1 + tester/local-chat-tester-functions.cpp | 22 + tester/local-conference-tester-functions.cpp | 13 + 23 files changed, 529 insertions(+), 347 deletions(-) diff --git a/coreapi/chat.c b/coreapi/chat.c index 9316e02fc4..e74a1dac1d 100644 --- a/coreapi/chat.c +++ b/coreapi/chat.c @@ -191,6 +191,13 @@ LinphoneChatRoom *linphone_core_search_chat_room_2(const LinphoneCore *lc, return NULL; } +LinphoneChatRoom *linphone_core_search_chat_room_by_identifier(const LinphoneCore *lc, const char *identifier) { + shared_ptr<LinphonePrivate::AbstractChatRoom> room = + L_GET_PRIVATE_FROM_C_OBJECT(lc)->searchChatRoom(L_C_TO_STRING(identifier)); + if (room) return room->toC(); + return NULL; +} + LinphoneChatRoomParams *linphone_core_create_default_chat_room_params(LinphoneCore *lc) { auto params = linphone_chat_room_params_new_and_init(lc); return params; diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 7193353bfd..420a1e99e7 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -9519,6 +9519,13 @@ LinphoneConference *linphone_core_search_conference_2(const LinphoneCore *lc, co return c_conference; } +LinphoneConference *linphone_core_search_conference_by_identifier(const LinphoneCore *lc, const char *identifier) { + shared_ptr<LinphonePrivate::Conference> conference = + L_GET_CPP_PTR_FROM_C_OBJECT(lc)->searchConference(L_C_TO_STRING(identifier)); + if (conference) return conference->toC(); + return NULL; +} + LinphoneConferenceParams *linphone_core_create_conference_params_2(LinphoneCore *lc, LinphoneConference *conference) { CoreLogContextualizer logContextualizer(lc); if (!conference) return linphone_conference_params_new(lc); diff --git a/include/linphone/api/c-chat-room.h b/include/linphone/api/c-chat-room.h index 22b1071392..ec674b2033 100644 --- a/include/linphone/api/c-chat-room.h +++ b/include/linphone/api/c-chat-room.h @@ -133,6 +133,14 @@ LINPHONE_PUBLIC const LinphoneAddress *linphone_chat_room_get_peer_address(Linph */ LINPHONE_PUBLIC const LinphoneAddress *linphone_chat_room_get_local_address(LinphoneChatRoom *chat_room); +/** + * Returns the chat room identifier + * @warning This method returns a NULL pointer if the ChatRoom is in the Instantiated state + * @param chat_room The #LinphoneChatRoom object. @notnil + * @return the conference identifier. @maybenil + */ +LINPHONE_PUBLIC const char *linphone_chat_room_get_identifier(const LinphoneChatRoom *chat_room); + /** * Used to receive a chat message when using async mechanism with IM enchat_roomyption engine * @param chat_room #LinphoneChatRoom object @notnil @@ -317,7 +325,7 @@ LINPHONE_PUBLIC bctbx_list_t *linphone_chat_room_get_history_range_near(Linphone * @param filters The #LinphoneChatRoomHistoryFilterMask mask to filter the results with #LinphoneChatRoomHistoryFilter * @return A list of \bctbx_list{LinphoneEventLog} between the two provided events, if any. @tobefreed */ -LINPHONE_PUBLIC bctbx_list_t *linphone_chat_room_get_history_range_between(LinphoneChatRoom *cr, +LINPHONE_PUBLIC bctbx_list_t *linphone_chat_room_get_history_range_between(LinphoneChatRoom *chat_room, LinphoneEventLog *first_event, LinphoneEventLog *last_event, LinphoneChatRoomHistoryFilterMask filters); diff --git a/include/linphone/api/c-conference.h b/include/linphone/api/c-conference.h index 6cce256257..f0197556ad 100644 --- a/include/linphone/api/c-conference.h +++ b/include/linphone/api/c-conference.h @@ -192,6 +192,14 @@ LINPHONE_PUBLIC LinphoneStatus linphone_conference_add_participant(LinphoneConfe LINPHONE_PUBLIC LinphoneStatus linphone_conference_add_participant_2(LinphoneConference *conference, const LinphoneAddress *uri); +/** + * Returns the conference identifier + * @warning This method returns a NULL pointer if the Conference is in the Instantiated state + * @param conference The #LinphoneConference object. @notnil + * @return the conference identifier. @maybenil + */ +LINPHONE_PUBLIC const char *linphone_conference_get_identifier(const LinphoneConference *conference); + /** * Update parameters of the conference. * This is typically used enable or disable the video stream in the conference. diff --git a/include/linphone/core.h b/include/linphone/core.h index c891d50dc7..b977c58fc9 100644 --- a/include/linphone/core.h +++ b/include/linphone/core.h @@ -4968,6 +4968,16 @@ LINPHONE_PUBLIC LinphoneConference *linphone_core_search_conference(const Linpho LINPHONE_PUBLIC LinphoneConference *linphone_core_search_conference_2(const LinphoneCore *core, const LinphoneAddress *conferenceAddr); +/** + * Find a conference by its identifier. + * + * @param core A #LinphoneCore object @notnil + * @param identifier The conference identifier @notnil + * @return A matching conference or NULL if none matches. @maybenil + */ +LINPHONE_PUBLIC LinphoneConference *linphone_core_search_conference_by_identifier(const LinphoneCore *core, + const char *identifier); + /** * Adds a participant to the conference. If no conference is going on * a new internal conference context is created and the participant is @@ -6267,6 +6277,16 @@ LINPHONE_PUBLIC LinphoneChatRoom *linphone_core_search_chat_room_2(const Linphon const LinphoneAddress *remoteAddr, const bctbx_list_t *participants); +/** + * Find a chat room by its identifier. + * + * @param core A #LinphoneCore object @notnil + * @param identifier The chat room identifier @notnil + * @return A matching chat room or NULL if none matches. @maybenil + */ +LINPHONE_PUBLIC LinphoneChatRoom *linphone_core_search_chat_room_by_identifier(const LinphoneCore *core, + const char *identifier); + /** * Removes a chatroom including all message history from the LinphoneCore. * @param core A #LinphoneCore object @notnil diff --git a/src/c-wrapper/api/c-chat-room.cpp b/src/c-wrapper/api/c-chat-room.cpp index a2889119d5..ce37eedb65 100644 --- a/src/c-wrapper/api/c-chat-room.cpp +++ b/src/c-wrapper/api/c-chat-room.cpp @@ -64,31 +64,31 @@ void linphone_chat_room_allow_cpim(LinphoneChatRoom *room) { // Public functions. // ============================================================================= -const LinphoneChatRoomParams *linphone_chat_room_get_current_params(const LinphoneChatRoom *cr) { - return AbstractChatRoom::toCpp(cr)->getCurrentParams()->toC(); +const LinphoneChatRoomParams *linphone_chat_room_get_current_params(const LinphoneChatRoom *chat_room) { + return AbstractChatRoom::toCpp(chat_room)->getCurrentParams()->toC(); } // Deprecated -void linphone_chat_room_send_message(LinphoneChatRoom *cr, const char *msg) { - ChatRoomLogContextualizer logContextualizer(cr); - AbstractChatRoom::toCpp(cr)->createChatMessage(msg)->send(); +void linphone_chat_room_send_message(LinphoneChatRoom *chat_room, const char *msg) { + ChatRoomLogContextualizer logContextualizer(chat_room); + AbstractChatRoom::toCpp(chat_room)->createChatMessage(msg)->send(); } -bool_t linphone_chat_room_is_remote_composing(const LinphoneChatRoom *cr) { - ChatRoomLogContextualizer logContextualizer(cr); - return AbstractChatRoom::toCpp(cr)->isRemoteComposing(); +bool_t linphone_chat_room_is_remote_composing(const LinphoneChatRoom *chat_room) { + ChatRoomLogContextualizer logContextualizer(chat_room); + return AbstractChatRoom::toCpp(chat_room)->isRemoteComposing(); } -LinphoneCore *linphone_chat_room_get_lc(const LinphoneChatRoom *cr) { - return linphone_chat_room_get_core(cr); +LinphoneCore *linphone_chat_room_get_lc(const LinphoneChatRoom *chat_room) { + return linphone_chat_room_get_core(chat_room); } -LinphoneCore *linphone_chat_room_get_core(const LinphoneChatRoom *cr) { - return AbstractChatRoom::toCpp(cr)->getCore()->getCCore(); +LinphoneCore *linphone_chat_room_get_core(const LinphoneChatRoom *chat_room) { + return AbstractChatRoom::toCpp(chat_room)->getCore()->getCCore(); } -const LinphoneAddress *linphone_chat_room_get_peer_address(LinphoneChatRoom *cr) { - const auto &address = AbstractChatRoom::toCpp(cr)->getPeerAddress(); +const LinphoneAddress *linphone_chat_room_get_peer_address(LinphoneChatRoom *chat_room) { + const auto &address = AbstractChatRoom::toCpp(chat_room)->getPeerAddress(); if (address) { return address->toC(); } else { @@ -96,8 +96,8 @@ const LinphoneAddress *linphone_chat_room_get_peer_address(LinphoneChatRoom *cr) } } -const LinphoneAddress *linphone_chat_room_get_local_address(LinphoneChatRoom *cr) { - const auto &address = AbstractChatRoom::toCpp(cr)->getLocalAddress(); +const LinphoneAddress *linphone_chat_room_get_local_address(LinphoneChatRoom *chat_room) { + const auto &address = AbstractChatRoom::toCpp(chat_room)->getLocalAddress(); if (address) { return address->toC(); } else { @@ -105,81 +105,91 @@ const LinphoneAddress *linphone_chat_room_get_local_address(LinphoneChatRoom *cr } } -LinphoneChatMessage *linphone_chat_room_create_empty_message(LinphoneChatRoom *cr) { - ChatRoomLogContextualizer logContextualizer(cr); - shared_ptr<ChatMessage> cppPtr = AbstractChatRoom::toCpp(cr)->createChatMessage(); +const char *linphone_chat_room_get_identifier(const LinphoneChatRoom *chat_room) { + const auto &identifier = AbstractChatRoom::toCpp(chat_room)->getIdentifier(); + if (identifier) { + return L_STRING_TO_C(identifier.value()); + } + return NULL; +} + +LinphoneChatMessage *linphone_chat_room_create_empty_message(LinphoneChatRoom *chat_room) { + ChatRoomLogContextualizer logContextualizer(chat_room); + shared_ptr<ChatMessage> cppPtr = AbstractChatRoom::toCpp(chat_room)->createChatMessage(); LinphoneChatMessage *object = L_INIT(ChatMessage); L_SET_CPP_PTR_FROM_C_OBJECT(object, cppPtr); return object; } -LinphoneChatMessage *linphone_chat_room_create_message_from_utf8(LinphoneChatRoom *cr, const char *message) { - ChatRoomLogContextualizer logContextualizer(cr); - shared_ptr<ChatMessage> cppPtr = AbstractChatRoom::toCpp(cr)->createChatMessageFromUtf8(L_C_TO_STRING(message)); +LinphoneChatMessage *linphone_chat_room_create_message_from_utf8(LinphoneChatRoom *chat_room, const char *message) { + ChatRoomLogContextualizer logContextualizer(chat_room); + shared_ptr<ChatMessage> cppPtr = + AbstractChatRoom::toCpp(chat_room)->createChatMessageFromUtf8(L_C_TO_STRING(message)); LinphoneChatMessage *object = L_INIT(ChatMessage); L_SET_CPP_PTR_FROM_C_OBJECT(object, cppPtr); return object; } // Deprecated -LinphoneChatMessage *linphone_chat_room_create_message(LinphoneChatRoom *cr, const char *message) { - ChatRoomLogContextualizer logContextualizer(cr); - shared_ptr<ChatMessage> cppPtr = AbstractChatRoom::toCpp(cr)->createChatMessage(L_C_TO_STRING(message)); +LinphoneChatMessage *linphone_chat_room_create_message(LinphoneChatRoom *chat_room, const char *message) { + ChatRoomLogContextualizer logContextualizer(chat_room); + shared_ptr<ChatMessage> cppPtr = AbstractChatRoom::toCpp(chat_room)->createChatMessage(L_C_TO_STRING(message)); LinphoneChatMessage *object = L_INIT(ChatMessage); L_SET_CPP_PTR_FROM_C_OBJECT(object, cppPtr); return object; } -LinphoneChatMessage *linphone_chat_room_create_file_transfer_message(LinphoneChatRoom *cr, +LinphoneChatMessage *linphone_chat_room_create_file_transfer_message(LinphoneChatRoom *chat_room, LinphoneContent *initial_content) { - ChatRoomLogContextualizer logContextualizer(cr); - LinphoneChatMessage *msg = linphone_chat_room_create_empty_message(cr); + ChatRoomLogContextualizer logContextualizer(chat_room); + LinphoneChatMessage *msg = linphone_chat_room_create_empty_message(chat_room); linphone_chat_message_add_file_content(msg, initial_content); return msg; } // Deprecated -LinphoneChatMessage *linphone_chat_room_create_message_2(LinphoneChatRoom *cr, +LinphoneChatMessage *linphone_chat_room_create_message_2(LinphoneChatRoom *chat_room, const char *message, const char *external_body_url, LinphoneChatMessageState state, time_t time, BCTBX_UNUSED(bool_t is_read), BCTBX_UNUSED(bool_t is_incoming)) { - ChatRoomLogContextualizer logContextualizer(cr); - LinphoneChatMessage *msg = linphone_chat_room_create_message(cr, message); + ChatRoomLogContextualizer logContextualizer(chat_room); + LinphoneChatMessage *msg = linphone_chat_room_create_message(chat_room, message); linphone_chat_message_set_external_body_url(msg, external_body_url ? ms_strdup(external_body_url) : NULL); ChatMessagePrivate *dMsg = L_GET_PRIVATE_FROM_C_OBJECT(msg); dMsg->setTime(time); - dMsg->setParticipantState(AbstractChatRoom::toCpp(cr)->getMe()->getAddress(), + dMsg->setParticipantState(AbstractChatRoom::toCpp(chat_room)->getMe()->getAddress(), static_cast<ChatMessage::State>(state), ::ms_time(NULL)); return msg; } -LinphoneChatMessage *linphone_chat_room_create_forward_message(LinphoneChatRoom *cr, LinphoneChatMessage *msg) { - ChatRoomLogContextualizer logContextualizer(cr); +LinphoneChatMessage *linphone_chat_room_create_forward_message(LinphoneChatRoom *chat_room, LinphoneChatMessage *msg) { + ChatRoomLogContextualizer logContextualizer(chat_room); shared_ptr<ChatMessage> cppPtr = - AbstractChatRoom::toCpp(cr)->createForwardMessage(L_GET_CPP_PTR_FROM_C_OBJECT(msg)); + AbstractChatRoom::toCpp(chat_room)->createForwardMessage(L_GET_CPP_PTR_FROM_C_OBJECT(msg)); LinphoneChatMessage *object = L_INIT(ChatMessage); L_SET_CPP_PTR_FROM_C_OBJECT(object, cppPtr); return object; } -LinphoneChatMessage *linphone_chat_room_create_reply_message(LinphoneChatRoom *cr, LinphoneChatMessage *msg) { - ChatRoomLogContextualizer logContextualizer(cr); - shared_ptr<ChatMessage> cppPtr = AbstractChatRoom::toCpp(cr)->createReplyMessage(L_GET_CPP_PTR_FROM_C_OBJECT(msg)); +LinphoneChatMessage *linphone_chat_room_create_reply_message(LinphoneChatRoom *chat_room, LinphoneChatMessage *msg) { + ChatRoomLogContextualizer logContextualizer(chat_room); + shared_ptr<ChatMessage> cppPtr = + AbstractChatRoom::toCpp(chat_room)->createReplyMessage(L_GET_CPP_PTR_FROM_C_OBJECT(msg)); LinphoneChatMessage *object = L_INIT(ChatMessage); L_SET_CPP_PTR_FROM_C_OBJECT(object, cppPtr); return object; } -LinphoneChatMessage *linphone_chat_room_create_voice_recording_message(LinphoneChatRoom *cr, +LinphoneChatMessage *linphone_chat_room_create_voice_recording_message(LinphoneChatRoom *chat_room, LinphoneRecorder *recorder) { - ChatRoomLogContextualizer logContextualizer(cr); - LinphoneChatMessage *chat_message = linphone_chat_room_create_empty_message(cr); + ChatRoomLogContextualizer logContextualizer(chat_room); + LinphoneChatMessage *chat_message = linphone_chat_room_create_empty_message(chat_room); LinphoneContent *c_content = linphone_recorder_create_content(recorder); if (c_content != nullptr) { @@ -190,211 +200,214 @@ LinphoneChatMessage *linphone_chat_room_create_voice_recording_message(LinphoneC return chat_message; } -void linphone_chat_room_send_chat_message_2(BCTBX_UNUSED(LinphoneChatRoom *cr), LinphoneChatMessage *msg) { +void linphone_chat_room_send_chat_message_2(BCTBX_UNUSED(LinphoneChatRoom *chat_room), LinphoneChatMessage *msg) { linphone_chat_message_ref(msg); L_GET_CPP_PTR_FROM_C_OBJECT(msg)->send(); } -void linphone_chat_room_send_chat_message(BCTBX_UNUSED(LinphoneChatRoom *cr), LinphoneChatMessage *msg) { +void linphone_chat_room_send_chat_message(BCTBX_UNUSED(LinphoneChatRoom *chat_room), LinphoneChatMessage *msg) { L_GET_CPP_PTR_FROM_C_OBJECT(msg)->send(); } -void linphone_chat_room_receive_chat_message(BCTBX_UNUSED(LinphoneChatRoom *cr), LinphoneChatMessage *msg) { +void linphone_chat_room_receive_chat_message(BCTBX_UNUSED(LinphoneChatRoom *chat_room), LinphoneChatMessage *msg) { L_GET_PRIVATE_FROM_C_OBJECT(msg)->receive(); } -uint32_t linphone_chat_room_get_char(LinphoneChatRoom *cr) { - ChatRoomLogContextualizer logContextualizer(cr); - return AbstractChatRoom::toCpp(cr)->getChar(); +uint32_t linphone_chat_room_get_char(LinphoneChatRoom *chat_room) { + ChatRoomLogContextualizer logContextualizer(chat_room); + return AbstractChatRoom::toCpp(chat_room)->getChar(); } -void linphone_chat_room_compose(LinphoneChatRoom *cr) { - ChatRoomLogContextualizer logContextualizer(cr); - AbstractChatRoom::toCpp(cr)->compose(); +void linphone_chat_room_compose(LinphoneChatRoom *chat_room) { + ChatRoomLogContextualizer logContextualizer(chat_room); + AbstractChatRoom::toCpp(chat_room)->compose(); } -LinphoneCall *linphone_chat_room_get_call(const LinphoneChatRoom *cr) { - ChatRoomLogContextualizer logContextualizer(cr); - shared_ptr<Call> call = AbstractChatRoom::toCpp(cr)->getCall(); +LinphoneCall *linphone_chat_room_get_call(const LinphoneChatRoom *chat_room) { + ChatRoomLogContextualizer logContextualizer(chat_room); + shared_ptr<Call> call = AbstractChatRoom::toCpp(chat_room)->getCall(); if (call) return call->toC(); return nullptr; } -void linphone_chat_room_set_call(LinphoneChatRoom *cr, LinphoneCall *call) { - AbstractChatRoom::toCpp(cr)->setCallId(linphone_call_log_get_call_id(linphone_call_get_call_log(call))); +void linphone_chat_room_set_call(LinphoneChatRoom *chat_room, LinphoneCall *call) { + AbstractChatRoom::toCpp(chat_room)->setCallId(linphone_call_log_get_call_id(linphone_call_get_call_log(call))); } -void linphone_chat_room_mark_as_read(LinphoneChatRoom *cr) { - ChatRoomLogContextualizer logContextualizer(cr); - AbstractChatRoom::toCpp(cr)->markAsRead(); +void linphone_chat_room_mark_as_read(LinphoneChatRoom *chat_room) { + ChatRoomLogContextualizer logContextualizer(chat_room); + AbstractChatRoom::toCpp(chat_room)->markAsRead(); } -void linphone_chat_room_set_ephemeral_mode(LinphoneChatRoom *cr, LinphoneChatRoomEphemeralMode mode) { - ChatRoomLogContextualizer logContextualizer(cr); - AbstractChatRoom::toCpp(cr)->setEphemeralMode(static_cast<AbstractChatRoom::EphemeralMode>(mode), true); +void linphone_chat_room_set_ephemeral_mode(LinphoneChatRoom *chat_room, LinphoneChatRoomEphemeralMode mode) { + ChatRoomLogContextualizer logContextualizer(chat_room); + AbstractChatRoom::toCpp(chat_room)->setEphemeralMode(static_cast<AbstractChatRoom::EphemeralMode>(mode), true); } -LinphoneChatRoomEphemeralMode linphone_chat_room_get_ephemeral_mode(const LinphoneChatRoom *cr) { - ChatRoomLogContextualizer logContextualizer(cr); - return static_cast<LinphoneChatRoomEphemeralMode>(AbstractChatRoom::toCpp(cr)->getEphemeralMode()); +LinphoneChatRoomEphemeralMode linphone_chat_room_get_ephemeral_mode(const LinphoneChatRoom *chat_room) { + ChatRoomLogContextualizer logContextualizer(chat_room); + return static_cast<LinphoneChatRoomEphemeralMode>(AbstractChatRoom::toCpp(chat_room)->getEphemeralMode()); } -void linphone_chat_room_enable_ephemeral(LinphoneChatRoom *cr, bool_t ephem) { - ChatRoomLogContextualizer logContextualizer(cr); - AbstractChatRoom::toCpp(cr)->enableEphemeral(!!ephem, true); +void linphone_chat_room_enable_ephemeral(LinphoneChatRoom *chat_room, bool_t ephem) { + ChatRoomLogContextualizer logContextualizer(chat_room); + AbstractChatRoom::toCpp(chat_room)->enableEphemeral(!!ephem, true); } -bool_t linphone_chat_room_ephemeral_enabled(const LinphoneChatRoom *cr) { - ChatRoomLogContextualizer logContextualizer(cr); - return (bool_t)AbstractChatRoom::toCpp(cr)->ephemeralEnabled(); +bool_t linphone_chat_room_ephemeral_enabled(const LinphoneChatRoom *chat_room) { + ChatRoomLogContextualizer logContextualizer(chat_room); + return (bool_t)AbstractChatRoom::toCpp(chat_room)->ephemeralEnabled(); } -void linphone_chat_room_set_ephemeral_lifetime(LinphoneChatRoom *cr, long time) { - ChatRoomLogContextualizer logContextualizer(cr); - AbstractChatRoom::toCpp(cr)->setEphemeralLifetime(time, true); +void linphone_chat_room_set_ephemeral_lifetime(LinphoneChatRoom *chat_room, long time) { + ChatRoomLogContextualizer logContextualizer(chat_room); + AbstractChatRoom::toCpp(chat_room)->setEphemeralLifetime(time, true); } -long linphone_chat_room_get_ephemeral_lifetime(const LinphoneChatRoom *cr) { - ChatRoomLogContextualizer logContextualizer(cr); - return AbstractChatRoom::toCpp(cr)->getEphemeralLifetime(); +long linphone_chat_room_get_ephemeral_lifetime(const LinphoneChatRoom *chat_room) { + ChatRoomLogContextualizer logContextualizer(chat_room); + return AbstractChatRoom::toCpp(chat_room)->getEphemeralLifetime(); } -bool_t linphone_chat_room_ephemeral_supported_by_all_participants(const LinphoneChatRoom *cr) { - ChatRoomLogContextualizer logContextualizer(cr); - return (bool_t)AbstractChatRoom::toCpp(cr)->ephemeralSupportedByAllParticipants(); +bool_t linphone_chat_room_ephemeral_supported_by_all_participants(const LinphoneChatRoom *chat_room) { + ChatRoomLogContextualizer logContextualizer(chat_room); + return (bool_t)AbstractChatRoom::toCpp(chat_room)->ephemeralSupportedByAllParticipants(); } -int linphone_chat_room_get_unread_messages_count(LinphoneChatRoom *cr) { - ChatRoomLogContextualizer logContextualizer(cr); - return AbstractChatRoom::toCpp(cr)->getUnreadChatMessageCount(); +int linphone_chat_room_get_unread_messages_count(LinphoneChatRoom *chat_room) { + ChatRoomLogContextualizer logContextualizer(chat_room); + return AbstractChatRoom::toCpp(chat_room)->getUnreadChatMessageCount(); } -int linphone_chat_room_get_history_size(LinphoneChatRoom *cr) { - ChatRoomLogContextualizer logContextualizer(cr); - return AbstractChatRoom::toCpp(cr)->getChatMessageCount(); +int linphone_chat_room_get_history_size(LinphoneChatRoom *chat_room) { + ChatRoomLogContextualizer logContextualizer(chat_room); + return AbstractChatRoom::toCpp(chat_room)->getChatMessageCount(); } -int linphone_chat_room_get_history_size_2(LinphoneChatRoom *cr, LinphoneChatRoomHistoryFilterMask filters) { - ChatRoomLogContextualizer logContextualizer(cr); - return AbstractChatRoom::toCpp(cr)->getHistorySize(filters); +int linphone_chat_room_get_history_size_2(LinphoneChatRoom *chat_room, LinphoneChatRoomHistoryFilterMask filters) { + ChatRoomLogContextualizer logContextualizer(chat_room); + return AbstractChatRoom::toCpp(chat_room)->getHistorySize(filters); } -bool_t linphone_chat_room_is_empty(LinphoneChatRoom *cr) { - ChatRoomLogContextualizer logContextualizer(cr); - return (bool_t)AbstractChatRoom::toCpp(cr)->isEmpty(); +bool_t linphone_chat_room_is_empty(LinphoneChatRoom *chat_room) { + ChatRoomLogContextualizer logContextualizer(chat_room); + return (bool_t)AbstractChatRoom::toCpp(chat_room)->isEmpty(); } -void linphone_chat_room_delete_message(LinphoneChatRoom *cr, LinphoneChatMessage *msg) { - ChatRoomLogContextualizer logContextualizer(cr); - AbstractChatRoom::toCpp(cr)->deleteMessageFromHistory(L_GET_CPP_PTR_FROM_C_OBJECT(msg)); +void linphone_chat_room_delete_message(LinphoneChatRoom *chat_room, LinphoneChatMessage *msg) { + ChatRoomLogContextualizer logContextualizer(chat_room); + AbstractChatRoom::toCpp(chat_room)->deleteMessageFromHistory(L_GET_CPP_PTR_FROM_C_OBJECT(msg)); } -void linphone_chat_room_delete_history(LinphoneChatRoom *cr) { - ChatRoomLogContextualizer logContextualizer(cr); - AbstractChatRoom::toCpp(cr)->deleteHistory(); +void linphone_chat_room_delete_history(LinphoneChatRoom *chat_room) { + ChatRoomLogContextualizer logContextualizer(chat_room); + AbstractChatRoom::toCpp(chat_room)->deleteHistory(); } -bctbx_list_t *linphone_chat_room_get_media_contents(LinphoneChatRoom *cr) { - LinphonePrivate::ChatRoomLogContextualizer logContextualizer(cr); - list<shared_ptr<LinphonePrivate::Content>> contents = AbstractChatRoom::toCpp(cr)->getMediaContents(); +bctbx_list_t *linphone_chat_room_get_media_contents(LinphoneChatRoom *chat_room) { + LinphonePrivate::ChatRoomLogContextualizer logContextualizer(chat_room); + list<shared_ptr<LinphonePrivate::Content>> contents = AbstractChatRoom::toCpp(chat_room)->getMediaContents(); return LinphonePrivate::Content::getCListFromCppList(contents, true); } -bctbx_list_t *linphone_chat_room_get_document_contents(LinphoneChatRoom *cr) { - LinphonePrivate::ChatRoomLogContextualizer logContextualizer(cr); - list<shared_ptr<LinphonePrivate::Content>> contents = AbstractChatRoom::toCpp(cr)->getDocumentContents(); +bctbx_list_t *linphone_chat_room_get_document_contents(LinphoneChatRoom *chat_room) { + LinphonePrivate::ChatRoomLogContextualizer logContextualizer(chat_room); + list<shared_ptr<LinphonePrivate::Content>> contents = AbstractChatRoom::toCpp(chat_room)->getDocumentContents(); return LinphonePrivate::Content::getCListFromCppList(contents, true); } -bctbx_list_t *linphone_chat_room_get_history_range(LinphoneChatRoom *cr, int startm, int endm) { - ChatRoomLogContextualizer logContextualizer(cr); +bctbx_list_t *linphone_chat_room_get_history_range(LinphoneChatRoom *chat_room, int startm, int endm) { + ChatRoomLogContextualizer logContextualizer(chat_room); list<shared_ptr<ChatMessage>> chatMessages; - for (auto &event : AbstractChatRoom::toCpp(cr)->getMessageHistoryRange(startm, endm)) + for (auto &event : AbstractChatRoom::toCpp(chat_room)->getMessageHistoryRange(startm, endm)) chatMessages.push_back(static_pointer_cast<ConferenceChatMessageEvent>(event)->getChatMessage()); return L_GET_RESOLVED_C_LIST_FROM_CPP_LIST(chatMessages); } -bctbx_list_t *linphone_chat_room_get_history_range_2(LinphoneChatRoom *cr, +bctbx_list_t *linphone_chat_room_get_history_range_2(LinphoneChatRoom *chat_room, int startm, int endm, LinphoneChatRoomHistoryFilterMask filters) { - ChatRoomLogContextualizer logContextualizer(cr); - return L_GET_RESOLVED_C_LIST_FROM_CPP_LIST(AbstractChatRoom::toCpp(cr)->getHistoryRange(startm, endm, filters)); + ChatRoomLogContextualizer logContextualizer(chat_room); + return L_GET_RESOLVED_C_LIST_FROM_CPP_LIST( + AbstractChatRoom::toCpp(chat_room)->getHistoryRange(startm, endm, filters)); } -bctbx_list_t *linphone_chat_room_get_history(LinphoneChatRoom *cr, int nb_message) { - ChatRoomLogContextualizer logContextualizer(cr); - return linphone_chat_room_get_history_range(cr, 0, nb_message); +bctbx_list_t *linphone_chat_room_get_history(LinphoneChatRoom *chat_room, int nb_message) { + ChatRoomLogContextualizer logContextualizer(chat_room); + return linphone_chat_room_get_history_range(chat_room, 0, nb_message); } -bctbx_list_t * -linphone_chat_room_get_history_2(LinphoneChatRoom *cr, int nb_message, LinphoneChatRoomHistoryFilterMask filters) { - ChatRoomLogContextualizer logContextualizer(cr); - return linphone_chat_room_get_history_range_2(cr, 0, nb_message, filters); +bctbx_list_t *linphone_chat_room_get_history_2(LinphoneChatRoom *chat_room, + int nb_message, + LinphoneChatRoomHistoryFilterMask filters) { + ChatRoomLogContextualizer logContextualizer(chat_room); + return linphone_chat_room_get_history_range_2(chat_room, 0, nb_message, filters); } -bctbx_list_t *linphone_chat_room_get_history_range_near(LinphoneChatRoom *cr, +bctbx_list_t *linphone_chat_room_get_history_range_near(LinphoneChatRoom *chat_room, unsigned int before, unsigned int after, LinphoneEventLog *event, LinphoneChatRoomHistoryFilterMask filters) { - ChatRoomLogContextualizer logContextualizer(cr); - return L_GET_RESOLVED_C_LIST_FROM_CPP_LIST(AbstractChatRoom::toCpp(cr)->getHistoryRangeNear( + ChatRoomLogContextualizer logContextualizer(chat_room); + return L_GET_RESOLVED_C_LIST_FROM_CPP_LIST(AbstractChatRoom::toCpp(chat_room)->getHistoryRangeNear( before, after, event ? L_GET_CPP_PTR_FROM_C_OBJECT(event) : nullptr, filters)); } -bctbx_list_t *linphone_chat_room_get_history_range_between(LinphoneChatRoom *cr, +bctbx_list_t *linphone_chat_room_get_history_range_between(LinphoneChatRoom *chat_room, LinphoneEventLog *first_event, LinphoneEventLog *last_event, LinphoneChatRoomHistoryFilterMask filters) { - ChatRoomLogContextualizer logContextualizer(cr); - return L_GET_RESOLVED_C_LIST_FROM_CPP_LIST(AbstractChatRoom::toCpp(cr)->getHistoryRangeBetween( + ChatRoomLogContextualizer logContextualizer(chat_room); + return L_GET_RESOLVED_C_LIST_FROM_CPP_LIST(AbstractChatRoom::toCpp(chat_room)->getHistoryRangeBetween( first_event ? L_GET_CPP_PTR_FROM_C_OBJECT(first_event) : nullptr, last_event ? L_GET_CPP_PTR_FROM_C_OBJECT(last_event) : nullptr, filters)); } -bctbx_list_t *linphone_chat_room_get_unread_history(LinphoneChatRoom *cr) { - ChatRoomLogContextualizer logContextualizer(cr); - return L_GET_RESOLVED_C_LIST_FROM_CPP_LIST(AbstractChatRoom::toCpp(cr)->getUnreadChatMessages()); +bctbx_list_t *linphone_chat_room_get_unread_history(LinphoneChatRoom *chat_room) { + ChatRoomLogContextualizer logContextualizer(chat_room); + return L_GET_RESOLVED_C_LIST_FROM_CPP_LIST(AbstractChatRoom::toCpp(chat_room)->getUnreadChatMessages()); } -bctbx_list_t *linphone_chat_room_get_history_range_message_events(LinphoneChatRoom *cr, int startm, int endm) { - ChatRoomLogContextualizer logContextualizer(cr); - return L_GET_RESOLVED_C_LIST_FROM_CPP_LIST(AbstractChatRoom::toCpp(cr)->getMessageHistoryRange(startm, endm)); +bctbx_list_t *linphone_chat_room_get_history_range_message_events(LinphoneChatRoom *chat_room, int startm, int endm) { + ChatRoomLogContextualizer logContextualizer(chat_room); + return L_GET_RESOLVED_C_LIST_FROM_CPP_LIST( + AbstractChatRoom::toCpp(chat_room)->getMessageHistoryRange(startm, endm)); } -bctbx_list_t *linphone_chat_room_get_history_message_events(LinphoneChatRoom *cr, int nb_events) { - ChatRoomLogContextualizer logContextualizer(cr); - return L_GET_RESOLVED_C_LIST_FROM_CPP_LIST(AbstractChatRoom::toCpp(cr)->getMessageHistory(nb_events)); +bctbx_list_t *linphone_chat_room_get_history_message_events(LinphoneChatRoom *chat_room, int nb_events) { + ChatRoomLogContextualizer logContextualizer(chat_room); + return L_GET_RESOLVED_C_LIST_FROM_CPP_LIST(AbstractChatRoom::toCpp(chat_room)->getMessageHistory(nb_events)); } -bctbx_list_t *linphone_chat_room_get_history_events(LinphoneChatRoom *cr, int nb_events) { - ChatRoomLogContextualizer logContextualizer(cr); - return L_GET_RESOLVED_C_LIST_FROM_CPP_LIST(AbstractChatRoom::toCpp(cr)->getHistory(nb_events)); +bctbx_list_t *linphone_chat_room_get_history_events(LinphoneChatRoom *chat_room, int nb_events) { + ChatRoomLogContextualizer logContextualizer(chat_room); + return L_GET_RESOLVED_C_LIST_FROM_CPP_LIST(AbstractChatRoom::toCpp(chat_room)->getHistory(nb_events)); } -bctbx_list_t *linphone_chat_room_get_history_range_events(LinphoneChatRoom *cr, int begin, int end) { - ChatRoomLogContextualizer logContextualizer(cr); - return L_GET_RESOLVED_C_LIST_FROM_CPP_LIST(AbstractChatRoom::toCpp(cr)->getHistoryRange(begin, end)); +bctbx_list_t *linphone_chat_room_get_history_range_events(LinphoneChatRoom *chat_room, int begin, int end) { + ChatRoomLogContextualizer logContextualizer(chat_room); + return L_GET_RESOLVED_C_LIST_FROM_CPP_LIST(AbstractChatRoom::toCpp(chat_room)->getHistoryRange(begin, end)); } -int linphone_chat_room_get_history_events_size(LinphoneChatRoom *cr) { - ChatRoomLogContextualizer logContextualizer(cr); - return AbstractChatRoom::toCpp(cr)->getHistorySize(); +int linphone_chat_room_get_history_events_size(LinphoneChatRoom *chat_room) { + ChatRoomLogContextualizer logContextualizer(chat_room); + return AbstractChatRoom::toCpp(chat_room)->getHistorySize(); } -LinphoneChatMessage *linphone_chat_room_get_last_message_in_history(LinphoneChatRoom *cr) { - ChatRoomLogContextualizer logContextualizer(cr); - shared_ptr<ChatMessage> cppPtr = AbstractChatRoom::toCpp(cr)->getLastChatMessageInHistory(); +LinphoneChatMessage *linphone_chat_room_get_last_message_in_history(LinphoneChatRoom *chat_room) { + ChatRoomLogContextualizer logContextualizer(chat_room); + shared_ptr<ChatMessage> cppPtr = AbstractChatRoom::toCpp(chat_room)->getLastChatMessageInHistory(); if (!cppPtr) return nullptr; return linphone_chat_message_ref(L_GET_C_BACK_PTR(cppPtr)); } -LinphoneChatMessage *linphone_chat_room_find_message(LinphoneChatRoom *cr, const char *message_id) { - ChatRoomLogContextualizer logContextualizer(cr); - shared_ptr<ChatMessage> cppPtr = AbstractChatRoom::toCpp(cr)->findChatMessage(message_id); +LinphoneChatMessage *linphone_chat_room_find_message(LinphoneChatRoom *chat_room, const char *message_id) { + ChatRoomLogContextualizer logContextualizer(chat_room); + shared_ptr<ChatMessage> cppPtr = AbstractChatRoom::toCpp(chat_room)->findChatMessage(message_id); if (!cppPtr) return nullptr; return linphone_chat_message_ref(L_GET_C_BACK_PTR(cppPtr)); @@ -408,92 +421,92 @@ LinphoneEventLog *linphone_chat_room_find_event_log(LinphoneChatRoom *chat_room, return linphone_event_log_ref(L_GET_C_BACK_PTR(cppPtr)); } -LinphoneEventLog *linphone_chat_room_search_chat_message_by_text(LinphoneChatRoom *cr, +LinphoneEventLog *linphone_chat_room_search_chat_message_by_text(LinphoneChatRoom *chat_room, const char *text, const LinphoneEventLog *from, LinphoneSearchDirection direction) { - ChatRoomLogContextualizer logContextualizer(cr); - shared_ptr<EventLog> cppPtr = AbstractChatRoom::toCpp(cr)->searchChatMessageByText( + ChatRoomLogContextualizer logContextualizer(chat_room); + shared_ptr<EventLog> cppPtr = AbstractChatRoom::toCpp(chat_room)->searchChatMessageByText( L_C_TO_STRING(text), from ? L_GET_CPP_PTR_FROM_C_OBJECT(from) : nullptr, direction); if (!cppPtr) return nullptr; return linphone_event_log_ref(L_GET_C_BACK_PTR(cppPtr)); } -LinphoneChatRoomState linphone_chat_room_get_state(const LinphoneChatRoom *cr) { - ChatRoomLogContextualizer logContextualizer(cr); +LinphoneChatRoomState linphone_chat_room_get_state(const LinphoneChatRoom *chat_room) { + ChatRoomLogContextualizer logContextualizer(chat_room); return linphone_conference_state_to_chat_room_state( - static_cast<LinphoneConferenceState>(AbstractChatRoom::toCpp(cr)->getState())); + static_cast<LinphoneConferenceState>(AbstractChatRoom::toCpp(chat_room)->getState())); } -bool_t linphone_chat_room_has_been_left(const LinphoneChatRoom *cr) { - ChatRoomLogContextualizer logContextualizer(cr); - return (bool_t)AbstractChatRoom::toCpp(cr)->hasBeenLeft(); +bool_t linphone_chat_room_has_been_left(const LinphoneChatRoom *chat_room) { + ChatRoomLogContextualizer logContextualizer(chat_room); + return (bool_t)AbstractChatRoom::toCpp(chat_room)->hasBeenLeft(); } -bool_t linphone_chat_room_is_read_only(const LinphoneChatRoom *cr) { - ChatRoomLogContextualizer logContextualizer(cr); - return (bool_t)AbstractChatRoom::toCpp(cr)->isReadOnly(); +bool_t linphone_chat_room_is_read_only(const LinphoneChatRoom *chat_room) { + ChatRoomLogContextualizer logContextualizer(chat_room); + return (bool_t)AbstractChatRoom::toCpp(chat_room)->isReadOnly(); } -time_t linphone_chat_room_get_creation_time(const LinphoneChatRoom *cr) { - ChatRoomLogContextualizer logContextualizer(cr); - return AbstractChatRoom::toCpp(cr)->getCreationTime(); +time_t linphone_chat_room_get_creation_time(const LinphoneChatRoom *chat_room) { + ChatRoomLogContextualizer logContextualizer(chat_room); + return AbstractChatRoom::toCpp(chat_room)->getCreationTime(); } -time_t linphone_chat_room_get_last_update_time(const LinphoneChatRoom *cr) { - ChatRoomLogContextualizer logContextualizer(cr); - return AbstractChatRoom::toCpp(cr)->getLastUpdateTime(); +time_t linphone_chat_room_get_last_update_time(const LinphoneChatRoom *chat_room) { + ChatRoomLogContextualizer logContextualizer(chat_room); + return AbstractChatRoom::toCpp(chat_room)->getLastUpdateTime(); } -void linphone_chat_room_add_participant(LinphoneChatRoom *cr, LinphoneAddress *addr) { - ChatRoomLogContextualizer logContextualizer(cr); - if (linphone_chat_room_can_handle_participants(cr)) { - AbstractChatRoom::toCpp(cr)->getConference()->addParticipant(Address::toCpp(addr)->getSharedFromThis()); +void linphone_chat_room_add_participant(LinphoneChatRoom *chat_room, LinphoneAddress *addr) { + ChatRoomLogContextualizer logContextualizer(chat_room); + if (linphone_chat_room_can_handle_participants(chat_room)) { + AbstractChatRoom::toCpp(chat_room)->getConference()->addParticipant(Address::toCpp(addr)->getSharedFromThis()); } } -bool_t linphone_chat_room_add_participants(LinphoneChatRoom *cr, const bctbx_list_t *addresses) { - LinphonePrivate::ChatRoomLogContextualizer logContextualizer(cr); - if (linphone_chat_room_can_handle_participants(cr)) { +bool_t linphone_chat_room_add_participants(LinphoneChatRoom *chat_room, const bctbx_list_t *addresses) { + LinphonePrivate::ChatRoomLogContextualizer logContextualizer(chat_room); + if (linphone_chat_room_can_handle_participants(chat_room)) { std::list<std::shared_ptr<const LinphonePrivate::Address>> addressList; for (const bctbx_list_t *elem = addresses; elem != NULL; elem = elem->next) { const LinphoneAddress *data = static_cast<const LinphoneAddress *>(bctbx_list_get_data(elem)); addressList.push_back(LinphonePrivate::Address::toCpp(data)->getSharedFromThis()); } - return AbstractChatRoom::toCpp(cr)->getConference()->addParticipants(addressList); + return AbstractChatRoom::toCpp(chat_room)->getConference()->addParticipants(addressList); } return FALSE; } -LinphoneParticipant *linphone_chat_room_find_participant(const LinphoneChatRoom *cr, LinphoneAddress *addr) { - ChatRoomLogContextualizer logContextualizer(cr); +LinphoneParticipant *linphone_chat_room_find_participant(const LinphoneChatRoom *chat_room, LinphoneAddress *addr) { + ChatRoomLogContextualizer logContextualizer(chat_room); std::shared_ptr<Participant> participant = - AbstractChatRoom::toCpp(cr)->findParticipant(Address::toCpp(addr)->getSharedFromThis()); + AbstractChatRoom::toCpp(chat_room)->findParticipant(Address::toCpp(addr)->getSharedFromThis()); if (participant) { return participant->toC(); } return NULL; } -bool_t linphone_chat_room_can_handle_participants(const LinphoneChatRoom *cr) { - ChatRoomLogContextualizer logContextualizer(cr); - return AbstractChatRoom::toCpp(cr)->canHandleParticipants(); +bool_t linphone_chat_room_can_handle_participants(const LinphoneChatRoom *chat_room) { + ChatRoomLogContextualizer logContextualizer(chat_room); + return AbstractChatRoom::toCpp(chat_room)->canHandleParticipants(); } -LinphoneChatRoomCapabilitiesMask linphone_chat_room_get_capabilities(const LinphoneChatRoom *cr) { - ChatRoomLogContextualizer logContextualizer(cr); - return AbstractChatRoom::toCpp(cr)->getCapabilities(); +LinphoneChatRoomCapabilitiesMask linphone_chat_room_get_capabilities(const LinphoneChatRoom *chat_room) { + ChatRoomLogContextualizer logContextualizer(chat_room); + return AbstractChatRoom::toCpp(chat_room)->getCapabilities(); } -bool_t linphone_chat_room_has_capability(const LinphoneChatRoom *cr, int mask) { - ChatRoomLogContextualizer logContextualizer(cr); - return static_cast<bool_t>(AbstractChatRoom::toCpp(cr)->getCapabilities() & mask); +bool_t linphone_chat_room_has_capability(const LinphoneChatRoom *chat_room, int mask) { + ChatRoomLogContextualizer logContextualizer(chat_room); + return static_cast<bool_t>(AbstractChatRoom::toCpp(chat_room)->getCapabilities() & mask); } -const LinphoneAddress *linphone_chat_room_get_conference_address(const LinphoneChatRoom *cr) { - ChatRoomLogContextualizer logContextualizer(cr); - std::shared_ptr<Conference> conference = AbstractChatRoom::toCpp(cr)->getConference(); +const LinphoneAddress *linphone_chat_room_get_conference_address(const LinphoneChatRoom *chat_room) { + ChatRoomLogContextualizer logContextualizer(chat_room); + std::shared_ptr<Conference> conference = AbstractChatRoom::toCpp(chat_room)->getConference(); if (conference) { const auto &confAddress = conference->getConferenceAddress(); if (confAddress && confAddress->isValid()) { @@ -503,77 +516,77 @@ const LinphoneAddress *linphone_chat_room_get_conference_address(const LinphoneC return NULL; } -LinphoneParticipant *linphone_chat_room_get_me(const LinphoneChatRoom *cr) { - ChatRoomLogContextualizer logContextualizer(cr); - std::shared_ptr<Participant> me = AbstractChatRoom::toCpp(cr)->getMe(); +LinphoneParticipant *linphone_chat_room_get_me(const LinphoneChatRoom *chat_room) { + ChatRoomLogContextualizer logContextualizer(chat_room); + std::shared_ptr<Participant> me = AbstractChatRoom::toCpp(chat_room)->getMe(); if (me) { return me->toC(); } return NULL; } -int linphone_chat_room_get_nb_participants(const LinphoneChatRoom *cr) { - ChatRoomLogContextualizer logContextualizer(cr); - if (linphone_chat_room_can_handle_participants(cr)) { - return AbstractChatRoom::toCpp(cr)->getConference()->getParticipantCount(); +int linphone_chat_room_get_nb_participants(const LinphoneChatRoom *chat_room) { + ChatRoomLogContextualizer logContextualizer(chat_room); + if (linphone_chat_room_can_handle_participants(chat_room)) { + return AbstractChatRoom::toCpp(chat_room)->getConference()->getParticipantCount(); } return -1; } -bctbx_list_t *linphone_chat_room_get_participants(const LinphoneChatRoom *cr) { - ChatRoomLogContextualizer logContextualizer(cr); - return Participant::getCListFromCppList(AbstractChatRoom::toCpp(cr)->getParticipants()); +bctbx_list_t *linphone_chat_room_get_participants(const LinphoneChatRoom *chat_room) { + ChatRoomLogContextualizer logContextualizer(chat_room); + return Participant::getCListFromCppList(AbstractChatRoom::toCpp(chat_room)->getParticipants()); } -const char *linphone_chat_room_get_subject(const LinphoneChatRoom *cr) { - ChatRoomLogContextualizer logContextualizer(cr); - return L_STRING_TO_C(AbstractChatRoom::toCpp(cr)->getSubject()); +const char *linphone_chat_room_get_subject(const LinphoneChatRoom *chat_room) { + ChatRoomLogContextualizer logContextualizer(chat_room); + return L_STRING_TO_C(AbstractChatRoom::toCpp(chat_room)->getSubject()); } -const char *linphone_chat_room_get_subject_utf8(const LinphoneChatRoom *cr) { - ChatRoomLogContextualizer logContextualizer(cr); - return L_STRING_TO_C(AbstractChatRoom::toCpp(cr)->getSubjectUtf8()); +const char *linphone_chat_room_get_subject_utf8(const LinphoneChatRoom *chat_room) { + ChatRoomLogContextualizer logContextualizer(chat_room); + return L_STRING_TO_C(AbstractChatRoom::toCpp(chat_room)->getSubjectUtf8()); } -LinphoneChatRoomSecurityLevel linphone_chat_room_get_security_level(LinphoneChatRoom *cr) { - ChatRoomLogContextualizer logContextualizer(cr); - return (LinphoneChatRoomSecurityLevel)AbstractChatRoom::toCpp(cr)->getSecurityLevel(); +LinphoneChatRoomSecurityLevel linphone_chat_room_get_security_level(LinphoneChatRoom *chat_room) { + ChatRoomLogContextualizer logContextualizer(chat_room); + return (LinphoneChatRoomSecurityLevel)AbstractChatRoom::toCpp(chat_room)->getSecurityLevel(); } -void linphone_chat_room_leave(LinphoneChatRoom *cr) { - ChatRoomLogContextualizer logContextualizer(cr); - AbstractChatRoom::toCpp(cr)->getConference()->leave(); +void linphone_chat_room_leave(LinphoneChatRoom *chat_room) { + ChatRoomLogContextualizer logContextualizer(chat_room); + AbstractChatRoom::toCpp(chat_room)->getConference()->leave(); } -void linphone_chat_room_remove_participant(LinphoneChatRoom *cr, LinphoneParticipant *participant) { - ChatRoomLogContextualizer logContextualizer(cr); - if (linphone_chat_room_can_handle_participants(cr)) { - AbstractChatRoom::toCpp(cr)->getConference()->removeParticipant( +void linphone_chat_room_remove_participant(LinphoneChatRoom *chat_room, LinphoneParticipant *participant) { + ChatRoomLogContextualizer logContextualizer(chat_room); + if (linphone_chat_room_can_handle_participants(chat_room)) { + AbstractChatRoom::toCpp(chat_room)->getConference()->removeParticipant( Participant::toCpp(participant)->getSharedFromThis()); } } -void linphone_chat_room_remove_participants(LinphoneChatRoom *cr, const bctbx_list_t *participants) { - ChatRoomLogContextualizer logContextualizer(cr); - if (linphone_chat_room_can_handle_participants(cr)) { - AbstractChatRoom::toCpp(cr)->getConference()->removeParticipants( +void linphone_chat_room_remove_participants(LinphoneChatRoom *chat_room, const bctbx_list_t *participants) { + ChatRoomLogContextualizer logContextualizer(chat_room); + if (linphone_chat_room_can_handle_participants(chat_room)) { + AbstractChatRoom::toCpp(chat_room)->getConference()->removeParticipants( Participant::getCppListFromCList(participants)); } } -void linphone_chat_room_set_participant_admin_status(LinphoneChatRoom *cr, +void linphone_chat_room_set_participant_admin_status(LinphoneChatRoom *chat_room, LinphoneParticipant *participant, bool_t isAdmin) { - ChatRoomLogContextualizer logContextualizer(cr); - if (linphone_chat_room_can_handle_participants(cr)) { + ChatRoomLogContextualizer logContextualizer(chat_room); + if (linphone_chat_room_can_handle_participants(chat_room)) { shared_ptr<Participant> p = Participant::toCpp(participant)->getSharedFromThis(); - AbstractChatRoom::toCpp(cr)->getConference()->setParticipantAdminStatus(p, !!isAdmin); + AbstractChatRoom::toCpp(chat_room)->getConference()->setParticipantAdminStatus(p, !!isAdmin); } } -void linphone_chat_room_set_subject(LinphoneChatRoom *cr, const char *subject) { - ChatRoomLogContextualizer logContextualizer(cr); - AbstractChatRoom::toCpp(cr)->setSubject(L_C_TO_STRING(subject)); +void linphone_chat_room_set_subject(LinphoneChatRoom *chat_room, const char *subject) { + ChatRoomLogContextualizer logContextualizer(chat_room); + AbstractChatRoom::toCpp(chat_room)->setSubject(L_C_TO_STRING(subject)); } void linphone_chat_room_set_subject_utf8(LinphoneChatRoom *chat_room, const char *subject) { @@ -581,9 +594,9 @@ void linphone_chat_room_set_subject_utf8(LinphoneChatRoom *chat_room, const char AbstractChatRoom::toCpp(chat_room)->setUtf8Subject(L_C_TO_STRING(subject)); } -const bctbx_list_t *linphone_chat_room_get_composing_addresses(LinphoneChatRoom *cr) { - ChatRoomLogContextualizer logContextualizer(cr); - return AbstractChatRoom::toCpp(cr)->getComposingCAddresses(); +const bctbx_list_t *linphone_chat_room_get_composing_addresses(LinphoneChatRoom *chat_room) { + ChatRoomLogContextualizer logContextualizer(chat_room); + return AbstractChatRoom::toCpp(chat_room)->getComposingCAddresses(); } bool_t linphone_chat_room_get_muted(const LinphoneChatRoom *chat_room) { @@ -606,10 +619,10 @@ const LinphoneConferenceInfo *linphone_chat_room_get_conference_info(LinphoneCha #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wunused-parameter" #endif // _MSC_VER -void linphone_chat_room_set_conference_address(LinphoneChatRoom *cr, LinphoneAddress *confAddr) { +void linphone_chat_room_set_conference_address(LinphoneChatRoom *chat_room, LinphoneAddress *confAddr) { #ifdef HAVE_ADVANCED_IM shared_ptr<ServerChatRoom> sgcr = - dynamic_pointer_cast<ServerChatRoom>(AbstractChatRoom::toCpp(cr)->getSharedFromThis()); + dynamic_pointer_cast<ServerChatRoom>(AbstractChatRoom::toCpp(chat_room)->getSharedFromThis()); if (sgcr) { std::shared_ptr<Address> idAddr = Address::toCpp(confAddr)->getSharedFromThis(); sgcr->getConference()->setConferenceAddress(idAddr); @@ -626,14 +639,14 @@ void linphone_chat_room_set_conference_address(LinphoneChatRoom *cr, LinphoneAdd #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wunused-parameter" #endif // _MSC_VER -void linphone_chat_room_set_participant_devices(LinphoneChatRoom *cr, +void linphone_chat_room_set_participant_devices(LinphoneChatRoom *chat_room, LinphoneAddress *partAddr, const bctbx_list_t *deviceIdentities) { #ifdef HAVE_ADVANCED_IM list<shared_ptr<ParticipantDeviceIdentity>> lDevicesIdentities = ParticipantDeviceIdentity::getCppListFromCList(deviceIdentities); shared_ptr<ServerChatRoom> sgcr = - dynamic_pointer_cast<ServerChatRoom>(AbstractChatRoom::toCpp(cr)->getSharedFromThis()); + dynamic_pointer_cast<ServerChatRoom>(AbstractChatRoom::toCpp(chat_room)->getSharedFromThis()); if (sgcr) dynamic_pointer_cast<ServerConference>(sgcr->getConference()) ->setParticipantDevices(Address::toCpp(partAddr)->getSharedFromThis(), lDevicesIdentities); @@ -649,11 +662,11 @@ void linphone_chat_room_set_participant_devices(LinphoneChatRoom *cr, #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wunused-parameter" #endif // _MSC_VER -void linphone_chat_room_notify_participant_device_registration(LinphoneChatRoom *cr, +void linphone_chat_room_notify_participant_device_registration(LinphoneChatRoom *chat_room, const LinphoneAddress *participant_device) { #ifdef HAVE_ADVANCED_IM shared_ptr<ServerChatRoom> sgcr = - dynamic_pointer_cast<ServerChatRoom>(AbstractChatRoom::toCpp(cr)->getSharedFromThis()); + dynamic_pointer_cast<ServerChatRoom>(AbstractChatRoom::toCpp(chat_room)->getSharedFromThis()); if (sgcr) { sgcr->notifyParticipantDeviceRegistration( LinphonePrivate::Address::toCpp(participant_device)->getSharedFromThis()); @@ -670,225 +683,229 @@ void linphone_chat_room_notify_participant_device_registration(LinphoneChatRoom // Callbacks // ============================================================================= -void linphone_chat_room_add_callbacks(LinphoneChatRoom *cr, LinphoneChatRoomCbs *cbs) { - AbstractChatRoom::toCpp(cr)->addCallbacks(ChatRoomCbs::toCpp(cbs)->getSharedFromThis()); +void linphone_chat_room_add_callbacks(LinphoneChatRoom *chat_room, LinphoneChatRoomCbs *cbs) { + AbstractChatRoom::toCpp(chat_room)->addCallbacks(ChatRoomCbs::toCpp(cbs)->getSharedFromThis()); } -void linphone_chat_room_remove_callbacks(LinphoneChatRoom *cr, LinphoneChatRoomCbs *cbs) { - AbstractChatRoom::toCpp(cr)->removeCallbacks(ChatRoomCbs::toCpp(cbs)->getSharedFromThis()); +void linphone_chat_room_remove_callbacks(LinphoneChatRoom *chat_room, LinphoneChatRoomCbs *cbs) { + AbstractChatRoom::toCpp(chat_room)->removeCallbacks(ChatRoomCbs::toCpp(cbs)->getSharedFromThis()); } -void linphone_chat_room_set_current_callbacks(LinphoneChatRoom *cr, LinphoneChatRoomCbs *cbs) { - AbstractChatRoom::toCpp(cr)->setCurrentCallbacks(cbs ? ChatRoomCbs::toCpp(cbs)->getSharedFromThis() : nullptr); +void linphone_chat_room_set_current_callbacks(LinphoneChatRoom *chat_room, LinphoneChatRoomCbs *cbs) { + AbstractChatRoom::toCpp(chat_room)->setCurrentCallbacks(cbs ? ChatRoomCbs::toCpp(cbs)->getSharedFromThis() + : nullptr); } -LinphoneChatRoomCbs *linphone_chat_room_get_current_callbacks(const LinphoneChatRoom *cr) { - return AbstractChatRoom::toCpp(cr)->getCurrentCallbacks()->toC(); +LinphoneChatRoomCbs *linphone_chat_room_get_current_callbacks(const LinphoneChatRoom *chat_room) { + return AbstractChatRoom::toCpp(chat_room)->getCurrentCallbacks()->toC(); } -const bctbx_list_t *linphone_chat_room_get_callbacks_list(const LinphoneChatRoom *cr) { - return AbstractChatRoom::toCpp(cr)->getCCallbacksList(); +const bctbx_list_t *linphone_chat_room_get_callbacks_list(const LinphoneChatRoom *chat_room) { + return AbstractChatRoom::toCpp(chat_room)->getCCallbacksList(); } -void _linphone_chat_room_notify_is_composing_received(LinphoneChatRoom *cr, +void _linphone_chat_room_notify_is_composing_received(LinphoneChatRoom *chat_room, const LinphoneAddress *remoteAddr, bool_t isComposing) { - LINPHONE_HYBRID_OBJECT_INVOKE_CBS(ChatRoom, AbstractChatRoom::toCpp(cr), + LINPHONE_HYBRID_OBJECT_INVOKE_CBS(ChatRoom, AbstractChatRoom::toCpp(chat_room), linphone_chat_room_cbs_get_is_composing_received, remoteAddr, isComposing); } -void linphone_chat_room_notify_session_state_changed(LinphoneChatRoom *cr, +void linphone_chat_room_notify_session_state_changed(LinphoneChatRoom *chat_room, LinphoneCallState cstate, const char *message) { - LINPHONE_HYBRID_OBJECT_INVOKE_CBS(ChatRoom, AbstractChatRoom::toCpp(cr), + LINPHONE_HYBRID_OBJECT_INVOKE_CBS(ChatRoom, AbstractChatRoom::toCpp(chat_room), linphone_chat_room_cbs_get_session_state_changed, cstate, message); } -void _linphone_chat_room_notify_message_received(LinphoneChatRoom *cr, LinphoneChatMessage *msg) { - LINPHONE_HYBRID_OBJECT_INVOKE_CBS(ChatRoom, AbstractChatRoom::toCpp(cr), +void _linphone_chat_room_notify_message_received(LinphoneChatRoom *chat_room, LinphoneChatMessage *msg) { + LINPHONE_HYBRID_OBJECT_INVOKE_CBS(ChatRoom, AbstractChatRoom::toCpp(chat_room), linphone_chat_room_cbs_get_message_received, msg); } -void _linphone_chat_room_notify_messages_received(LinphoneChatRoom *cr, const bctbx_list_t *chat_messages) { - LINPHONE_HYBRID_OBJECT_INVOKE_CBS(ChatRoom, AbstractChatRoom::toCpp(cr), +void _linphone_chat_room_notify_messages_received(LinphoneChatRoom *chat_room, const bctbx_list_t *chat_messages) { + LINPHONE_HYBRID_OBJECT_INVOKE_CBS(ChatRoom, AbstractChatRoom::toCpp(chat_room), linphone_chat_room_cbs_get_messages_received, chat_messages); } -void _linphone_chat_room_notify_new_event(LinphoneChatRoom *cr, const LinphoneEventLog *event_log) { - LINPHONE_HYBRID_OBJECT_INVOKE_CBS(ChatRoom, AbstractChatRoom::toCpp(cr), linphone_chat_room_cbs_get_new_event, - event_log); +void _linphone_chat_room_notify_new_event(LinphoneChatRoom *chat_room, const LinphoneEventLog *event_log) { + LINPHONE_HYBRID_OBJECT_INVOKE_CBS(ChatRoom, AbstractChatRoom::toCpp(chat_room), + linphone_chat_room_cbs_get_new_event, event_log); } -void _linphone_chat_room_notify_new_events(LinphoneChatRoom *cr, const bctbx_list_t *event_logs) { - LINPHONE_HYBRID_OBJECT_INVOKE_CBS(ChatRoom, AbstractChatRoom::toCpp(cr), linphone_chat_room_cbs_get_new_events, - event_logs); +void _linphone_chat_room_notify_new_events(LinphoneChatRoom *chat_room, const bctbx_list_t *event_logs) { + LINPHONE_HYBRID_OBJECT_INVOKE_CBS(ChatRoom, AbstractChatRoom::toCpp(chat_room), + linphone_chat_room_cbs_get_new_events, event_logs); } -void _linphone_chat_room_notify_participant_added(LinphoneChatRoom *cr, const LinphoneEventLog *event_log) { - _linphone_chat_room_notify_new_event(cr, event_log); - LINPHONE_HYBRID_OBJECT_INVOKE_CBS(ChatRoom, AbstractChatRoom::toCpp(cr), +void _linphone_chat_room_notify_participant_added(LinphoneChatRoom *chat_room, const LinphoneEventLog *event_log) { + _linphone_chat_room_notify_new_event(chat_room, event_log); + LINPHONE_HYBRID_OBJECT_INVOKE_CBS(ChatRoom, AbstractChatRoom::toCpp(chat_room), linphone_chat_room_cbs_get_participant_added, event_log); } -void _linphone_chat_room_notify_participant_removed(LinphoneChatRoom *cr, const LinphoneEventLog *event_log) { - _linphone_chat_room_notify_new_event(cr, event_log); - LINPHONE_HYBRID_OBJECT_INVOKE_CBS(ChatRoom, AbstractChatRoom::toCpp(cr), +void _linphone_chat_room_notify_participant_removed(LinphoneChatRoom *chat_room, const LinphoneEventLog *event_log) { + _linphone_chat_room_notify_new_event(chat_room, event_log); + LINPHONE_HYBRID_OBJECT_INVOKE_CBS(ChatRoom, AbstractChatRoom::toCpp(chat_room), linphone_chat_room_cbs_get_participant_removed, event_log); } -void _linphone_chat_room_notify_participant_device_added(LinphoneChatRoom *cr, const LinphoneEventLog *event_log) { - _linphone_chat_room_notify_new_event(cr, event_log); - LINPHONE_HYBRID_OBJECT_INVOKE_CBS(ChatRoom, AbstractChatRoom::toCpp(cr), +void _linphone_chat_room_notify_participant_device_added(LinphoneChatRoom *chat_room, + const LinphoneEventLog *event_log) { + _linphone_chat_room_notify_new_event(chat_room, event_log); + LINPHONE_HYBRID_OBJECT_INVOKE_CBS(ChatRoom, AbstractChatRoom::toCpp(chat_room), linphone_chat_room_cbs_get_participant_device_added, event_log); } -void _linphone_chat_room_notify_participant_device_removed(LinphoneChatRoom *cr, const LinphoneEventLog *event_log) { - _linphone_chat_room_notify_new_event(cr, event_log); - LINPHONE_HYBRID_OBJECT_INVOKE_CBS(ChatRoom, AbstractChatRoom::toCpp(cr), +void _linphone_chat_room_notify_participant_device_removed(LinphoneChatRoom *chat_room, + const LinphoneEventLog *event_log) { + _linphone_chat_room_notify_new_event(chat_room, event_log); + LINPHONE_HYBRID_OBJECT_INVOKE_CBS(ChatRoom, AbstractChatRoom::toCpp(chat_room), linphone_chat_room_cbs_get_participant_device_removed, event_log); } -void _linphone_chat_room_notify_participant_device_state_changed(LinphoneChatRoom *cr, +void _linphone_chat_room_notify_participant_device_state_changed(LinphoneChatRoom *chat_room, const LinphoneEventLog *event_log, const LinphoneParticipantDeviceState state) { - _linphone_chat_room_notify_new_event(cr, event_log); - LINPHONE_HYBRID_OBJECT_INVOKE_CBS(ChatRoom, AbstractChatRoom::toCpp(cr), + _linphone_chat_room_notify_new_event(chat_room, event_log); + LINPHONE_HYBRID_OBJECT_INVOKE_CBS(ChatRoom, AbstractChatRoom::toCpp(chat_room), linphone_chat_room_cbs_get_participant_device_state_changed, event_log, state); } -void _linphone_chat_room_notify_participant_device_media_availability_changed(LinphoneChatRoom *cr, +void _linphone_chat_room_notify_participant_device_media_availability_changed(LinphoneChatRoom *chat_room, const LinphoneEventLog *event_log) { - _linphone_chat_room_notify_new_event(cr, event_log); - LINPHONE_HYBRID_OBJECT_INVOKE_CBS(ChatRoom, AbstractChatRoom::toCpp(cr), + _linphone_chat_room_notify_new_event(chat_room, event_log); + LINPHONE_HYBRID_OBJECT_INVOKE_CBS(ChatRoom, AbstractChatRoom::toCpp(chat_room), linphone_chat_room_cbs_get_participant_device_media_availability_changed, event_log); } -void _linphone_chat_room_notify_participant_admin_status_changed(LinphoneChatRoom *cr, +void _linphone_chat_room_notify_participant_admin_status_changed(LinphoneChatRoom *chat_room, const LinphoneEventLog *event_log) { - _linphone_chat_room_notify_new_event(cr, event_log); - LINPHONE_HYBRID_OBJECT_INVOKE_CBS(ChatRoom, AbstractChatRoom::toCpp(cr), + _linphone_chat_room_notify_new_event(chat_room, event_log); + LINPHONE_HYBRID_OBJECT_INVOKE_CBS(ChatRoom, AbstractChatRoom::toCpp(chat_room), linphone_chat_room_cbs_get_participant_admin_status_changed, event_log); } -void _linphone_chat_room_notify_state_changed(LinphoneChatRoom *cr, LinphoneChatRoomState newState) { - LINPHONE_HYBRID_OBJECT_INVOKE_CBS(ChatRoom, AbstractChatRoom::toCpp(cr), linphone_chat_room_cbs_get_state_changed, - newState); +void _linphone_chat_room_notify_state_changed(LinphoneChatRoom *chat_room, LinphoneChatRoomState newState) { + LINPHONE_HYBRID_OBJECT_INVOKE_CBS(ChatRoom, AbstractChatRoom::toCpp(chat_room), + linphone_chat_room_cbs_get_state_changed, newState); } -void _linphone_chat_room_notify_security_event(LinphoneChatRoom *cr, const LinphoneEventLog *event_log) { - _linphone_chat_room_notify_new_event(cr, event_log); - LINPHONE_HYBRID_OBJECT_INVOKE_CBS(ChatRoom, AbstractChatRoom::toCpp(cr), linphone_chat_room_cbs_get_security_event, - event_log); +void _linphone_chat_room_notify_security_event(LinphoneChatRoom *chat_room, const LinphoneEventLog *event_log) { + _linphone_chat_room_notify_new_event(chat_room, event_log); + LINPHONE_HYBRID_OBJECT_INVOKE_CBS(ChatRoom, AbstractChatRoom::toCpp(chat_room), + linphone_chat_room_cbs_get_security_event, event_log); } -void _linphone_chat_room_notify_subject_changed(LinphoneChatRoom *cr, const LinphoneEventLog *event_log) { - _linphone_chat_room_notify_new_event(cr, event_log); - LINPHONE_HYBRID_OBJECT_INVOKE_CBS(ChatRoom, AbstractChatRoom::toCpp(cr), linphone_chat_room_cbs_get_subject_changed, - event_log); +void _linphone_chat_room_notify_subject_changed(LinphoneChatRoom *chat_room, const LinphoneEventLog *event_log) { + _linphone_chat_room_notify_new_event(chat_room, event_log); + LINPHONE_HYBRID_OBJECT_INVOKE_CBS(ChatRoom, AbstractChatRoom::toCpp(chat_room), + linphone_chat_room_cbs_get_subject_changed, event_log); } -void _linphone_chat_room_notify_conference_joined(LinphoneChatRoom *cr, const LinphoneEventLog *event_log) { - _linphone_chat_room_notify_new_event(cr, event_log); - LINPHONE_HYBRID_OBJECT_INVOKE_CBS(ChatRoom, AbstractChatRoom::toCpp(cr), +void _linphone_chat_room_notify_conference_joined(LinphoneChatRoom *chat_room, const LinphoneEventLog *event_log) { + _linphone_chat_room_notify_new_event(chat_room, event_log); + LINPHONE_HYBRID_OBJECT_INVOKE_CBS(ChatRoom, AbstractChatRoom::toCpp(chat_room), linphone_chat_room_cbs_get_conference_joined, event_log); } -void _linphone_chat_room_notify_conference_left(LinphoneChatRoom *cr, const LinphoneEventLog *event_log) { - _linphone_chat_room_notify_new_event(cr, event_log); - LINPHONE_HYBRID_OBJECT_INVOKE_CBS(ChatRoom, AbstractChatRoom::toCpp(cr), linphone_chat_room_cbs_get_conference_left, - event_log); +void _linphone_chat_room_notify_conference_left(LinphoneChatRoom *chat_room, const LinphoneEventLog *event_log) { + _linphone_chat_room_notify_new_event(chat_room, event_log); + LINPHONE_HYBRID_OBJECT_INVOKE_CBS(ChatRoom, AbstractChatRoom::toCpp(chat_room), + linphone_chat_room_cbs_get_conference_left, event_log); } -void _linphone_chat_room_notify_ephemeral_event(LinphoneChatRoom *cr, const LinphoneEventLog *event_log) { - _linphone_chat_room_notify_new_event(cr, event_log); - LINPHONE_HYBRID_OBJECT_INVOKE_CBS(ChatRoom, AbstractChatRoom::toCpp(cr), linphone_chat_room_cbs_get_ephemeral_event, - event_log); +void _linphone_chat_room_notify_ephemeral_event(LinphoneChatRoom *chat_room, const LinphoneEventLog *event_log) { + _linphone_chat_room_notify_new_event(chat_room, event_log); + LINPHONE_HYBRID_OBJECT_INVOKE_CBS(ChatRoom, AbstractChatRoom::toCpp(chat_room), + linphone_chat_room_cbs_get_ephemeral_event, event_log); } -void _linphone_chat_room_notify_ephemeral_message_timer_started(LinphoneChatRoom *cr, +void _linphone_chat_room_notify_ephemeral_message_timer_started(LinphoneChatRoom *chat_room, const LinphoneEventLog *event_log) { - _linphone_chat_room_notify_new_event(cr, event_log); - LINPHONE_HYBRID_OBJECT_INVOKE_CBS(ChatRoom, AbstractChatRoom::toCpp(cr), + _linphone_chat_room_notify_new_event(chat_room, event_log); + LINPHONE_HYBRID_OBJECT_INVOKE_CBS(ChatRoom, AbstractChatRoom::toCpp(chat_room), linphone_chat_room_cbs_get_ephemeral_message_timer_started, event_log); } -void _linphone_chat_room_notify_ephemeral_message_deleted(LinphoneChatRoom *cr, const LinphoneEventLog *event_log) { - _linphone_chat_room_notify_new_event(cr, event_log); - LINPHONE_HYBRID_OBJECT_INVOKE_CBS(ChatRoom, AbstractChatRoom::toCpp(cr), +void _linphone_chat_room_notify_ephemeral_message_deleted(LinphoneChatRoom *chat_room, + const LinphoneEventLog *event_log) { + _linphone_chat_room_notify_new_event(chat_room, event_log); + LINPHONE_HYBRID_OBJECT_INVOKE_CBS(ChatRoom, AbstractChatRoom::toCpp(chat_room), linphone_chat_room_cbs_get_ephemeral_message_deleted, event_log); } -void _linphone_chat_room_notify_undecryptable_message_received(LinphoneChatRoom *cr, LinphoneChatMessage *msg) { - LINPHONE_HYBRID_OBJECT_INVOKE_CBS(ChatRoom, AbstractChatRoom::toCpp(cr), +void _linphone_chat_room_notify_undecryptable_message_received(LinphoneChatRoom *chat_room, LinphoneChatMessage *msg) { + LINPHONE_HYBRID_OBJECT_INVOKE_CBS(ChatRoom, AbstractChatRoom::toCpp(chat_room), linphone_chat_room_cbs_get_undecryptable_message_received, msg); } -void _linphone_chat_room_notify_chat_message_received(LinphoneChatRoom *cr, const LinphoneEventLog *event_log) { - _linphone_chat_room_notify_new_event(cr, event_log); - LINPHONE_HYBRID_OBJECT_INVOKE_CBS(ChatRoom, AbstractChatRoom::toCpp(cr), +void _linphone_chat_room_notify_chat_message_received(LinphoneChatRoom *chat_room, const LinphoneEventLog *event_log) { + _linphone_chat_room_notify_new_event(chat_room, event_log); + LINPHONE_HYBRID_OBJECT_INVOKE_CBS(ChatRoom, AbstractChatRoom::toCpp(chat_room), linphone_chat_room_cbs_get_chat_message_received, event_log); } -void _linphone_chat_room_notify_chat_messages_received(LinphoneChatRoom *cr, const bctbx_list_t *event_logs) { - _linphone_chat_room_notify_new_events(cr, event_logs); - LINPHONE_HYBRID_OBJECT_INVOKE_CBS(ChatRoom, AbstractChatRoom::toCpp(cr), +void _linphone_chat_room_notify_chat_messages_received(LinphoneChatRoom *chat_room, const bctbx_list_t *event_logs) { + _linphone_chat_room_notify_new_events(chat_room, event_logs); + LINPHONE_HYBRID_OBJECT_INVOKE_CBS(ChatRoom, AbstractChatRoom::toCpp(chat_room), linphone_chat_room_cbs_get_chat_messages_received, event_logs); } -void _linphone_chat_room_notify_chat_message_sending(LinphoneChatRoom *cr, const LinphoneEventLog *event_log) { - _linphone_chat_room_notify_new_event(cr, event_log); - LINPHONE_HYBRID_OBJECT_INVOKE_CBS(ChatRoom, AbstractChatRoom::toCpp(cr), +void _linphone_chat_room_notify_chat_message_sending(LinphoneChatRoom *chat_room, const LinphoneEventLog *event_log) { + _linphone_chat_room_notify_new_event(chat_room, event_log); + LINPHONE_HYBRID_OBJECT_INVOKE_CBS(ChatRoom, AbstractChatRoom::toCpp(chat_room), linphone_chat_room_cbs_get_chat_message_sending, event_log); } -void _linphone_chat_room_notify_chat_message_sent(LinphoneChatRoom *cr, const LinphoneEventLog *event_log) { - _linphone_chat_room_notify_new_event(cr, event_log); - LINPHONE_HYBRID_OBJECT_INVOKE_CBS(ChatRoom, AbstractChatRoom::toCpp(cr), +void _linphone_chat_room_notify_chat_message_sent(LinphoneChatRoom *chat_room, const LinphoneEventLog *event_log) { + _linphone_chat_room_notify_new_event(chat_room, event_log); + LINPHONE_HYBRID_OBJECT_INVOKE_CBS(ChatRoom, AbstractChatRoom::toCpp(chat_room), linphone_chat_room_cbs_get_chat_message_sent, event_log); } -void _linphone_chat_room_notify_conference_address_generation(LinphoneChatRoom *cr) { - LINPHONE_HYBRID_OBJECT_INVOKE_CBS_NO_ARG(ChatRoom, AbstractChatRoom::toCpp(cr), +void _linphone_chat_room_notify_conference_address_generation(LinphoneChatRoom *chat_room) { + LINPHONE_HYBRID_OBJECT_INVOKE_CBS_NO_ARG(ChatRoom, AbstractChatRoom::toCpp(chat_room), linphone_chat_room_cbs_get_conference_address_generation); } void _linphone_chat_room_notify_participant_registration_subscription_requested( - LinphoneChatRoom *cr, const LinphoneAddress *participantAddr) { - LINPHONE_HYBRID_OBJECT_INVOKE_CBS(ChatRoom, AbstractChatRoom::toCpp(cr), + LinphoneChatRoom *chat_room, const LinphoneAddress *participantAddr) { + LINPHONE_HYBRID_OBJECT_INVOKE_CBS(ChatRoom, AbstractChatRoom::toCpp(chat_room), linphone_chat_room_cbs_get_participant_registration_subscription_requested, participantAddr); } void _linphone_chat_room_notify_participant_registration_unsubscription_requested( - LinphoneChatRoom *cr, const LinphoneAddress *participantAddr) { - LINPHONE_HYBRID_OBJECT_INVOKE_CBS(ChatRoom, AbstractChatRoom::toCpp(cr), + LinphoneChatRoom *chat_room, const LinphoneAddress *participantAddr) { + LINPHONE_HYBRID_OBJECT_INVOKE_CBS(ChatRoom, AbstractChatRoom::toCpp(chat_room), linphone_chat_room_cbs_get_participant_registration_unsubscription_requested, participantAddr); } -void _linphone_chat_room_notify_chat_message_should_be_stored(LinphoneChatRoom *cr, LinphoneChatMessage *msg) { - LINPHONE_HYBRID_OBJECT_INVOKE_CBS(ChatRoom, AbstractChatRoom::toCpp(cr), +void _linphone_chat_room_notify_chat_message_should_be_stored(LinphoneChatRoom *chat_room, LinphoneChatMessage *msg) { + LINPHONE_HYBRID_OBJECT_INVOKE_CBS(ChatRoom, AbstractChatRoom::toCpp(chat_room), linphone_chat_room_cbs_get_chat_message_should_be_stored, msg); } -void _linphone_chat_room_notify_chat_message_participant_imdn_state_changed(LinphoneChatRoom *cr, +void _linphone_chat_room_notify_chat_message_participant_imdn_state_changed(LinphoneChatRoom *chat_room, LinphoneChatMessage *msg, const LinphoneParticipantImdnState *state) { - LINPHONE_HYBRID_OBJECT_INVOKE_CBS(ChatRoom, AbstractChatRoom::toCpp(cr), + LINPHONE_HYBRID_OBJECT_INVOKE_CBS(ChatRoom, AbstractChatRoom::toCpp(chat_room), linphone_chat_room_cbs_get_chat_message_participant_imdn_state_changed, msg, state); } -void _linphone_chat_room_notify_chat_room_read(LinphoneChatRoom *cr) { - LINPHONE_HYBRID_OBJECT_INVOKE_CBS_NO_ARG(ChatRoom, AbstractChatRoom::toCpp(cr), +void _linphone_chat_room_notify_chat_room_read(LinphoneChatRoom *chat_room) { + LINPHONE_HYBRID_OBJECT_INVOKE_CBS_NO_ARG(ChatRoom, AbstractChatRoom::toCpp(chat_room), linphone_chat_room_cbs_get_chat_room_read); } -void _linphone_chat_room_notify_new_reaction_received(LinphoneChatRoom *cr, +void _linphone_chat_room_notify_new_reaction_received(LinphoneChatRoom *chat_room, LinphoneChatMessage *message, const LinphoneChatMessageReaction *reaction) { - LINPHONE_HYBRID_OBJECT_INVOKE_CBS(ChatRoom, AbstractChatRoom::toCpp(cr), + LINPHONE_HYBRID_OBJECT_INVOKE_CBS(ChatRoom, AbstractChatRoom::toCpp(chat_room), linphone_chat_room_cbs_get_new_message_reaction, message, reaction); } @@ -896,22 +913,22 @@ void _linphone_chat_room_notify_new_reaction_received(LinphoneChatRoom *cr, // Reference and user data handling functions. // ============================================================================= -LinphoneChatRoom *linphone_chat_room_ref(LinphoneChatRoom *cr) { - belle_sip_object_ref(cr); - return cr; +LinphoneChatRoom *linphone_chat_room_ref(LinphoneChatRoom *chat_room) { + belle_sip_object_ref(chat_room); + return chat_room; } -void linphone_chat_room_unref(LinphoneChatRoom *cr) { - ChatRoomLogContextualizer logContextualizer(cr); - belle_sip_object_unref(cr); +void linphone_chat_room_unref(LinphoneChatRoom *chat_room) { + ChatRoomLogContextualizer logContextualizer(chat_room); + belle_sip_object_unref(chat_room); } -void *linphone_chat_room_get_user_data(const LinphoneChatRoom *cr) { - return AbstractChatRoom::toCpp(cr)->getUserData(); +void *linphone_chat_room_get_user_data(const LinphoneChatRoom *chat_room) { + return AbstractChatRoom::toCpp(chat_room)->getUserData(); } -void linphone_chat_room_set_user_data(LinphoneChatRoom *cr, void *ud) { - AbstractChatRoom::toCpp(cr)->setUserData(ud); +void linphone_chat_room_set_user_data(LinphoneChatRoom *chat_room, void *ud) { + AbstractChatRoom::toCpp(chat_room)->setUserData(ud); } // ============================================================================= diff --git a/src/c-wrapper/api/c-conference.cpp b/src/c-wrapper/api/c-conference.cpp index 51b763ef6c..f3fc8e13d2 100644 --- a/src/c-wrapper/api/c-conference.cpp +++ b/src/c-wrapper/api/c-conference.cpp @@ -106,6 +106,14 @@ LinphoneConference *linphone_remote_conference_new_with_params(LinphoneCore *cor return conference->toC(); } +const char *linphone_conference_get_identifier(const LinphoneConference *conference) { + const auto &identifier = Conference::toCpp(conference)->getIdentifier(); + if (identifier) { + return L_STRING_TO_C(identifier.value()); + } + return NULL; +} + LinphoneConferenceState linphone_conference_get_state(const LinphoneConference *conference) { return (LinphoneConferenceState)Conference::toCpp(conference)->getState(); } @@ -633,4 +641,4 @@ const LinphoneConferenceInfo *linphone_conference_get_info(LinphoneConference *c LinphoneAccount *linphone_conference_get_account(LinphoneConference *conference) { shared_ptr<Account> account = Conference::toCpp(conference)->getAccount(); return account ? account->toC() : nullptr; -} \ No newline at end of file +} diff --git a/src/chat/chat-room/abstract-chat-room.h b/src/chat/chat-room/abstract-chat-room.h index 13d727c920..2e762b32b2 100644 --- a/src/chat/chat-room/abstract-chat-room.h +++ b/src/chat/chat-room/abstract-chat-room.h @@ -116,6 +116,7 @@ public: virtual const std::shared_ptr<Address> &getPeerAddress() const = 0; virtual const std::shared_ptr<Address> &getLocalAddress() const = 0; + virtual std::optional<std::reference_wrapper<const std::string>> getIdentifier() const = 0; virtual time_t getCreationTime() const = 0; virtual time_t getLastUpdateTime() const = 0; diff --git a/src/chat/chat-room/basic-chat-room.cpp b/src/chat/chat-room/basic-chat-room.cpp index 9fd577a257..819abe5449 100644 --- a/src/chat/chat-room/basic-chat-room.cpp +++ b/src/chat/chat-room/basic-chat-room.cpp @@ -116,6 +116,13 @@ const ConferenceId &BasicChatRoom::getConferenceId() const { return mConferenceId; } +std::optional<std::reference_wrapper<const std::string>> BasicChatRoom::getIdentifier() const { + if (mState == ConferenceInterface::State::Instantiated) { + return std::nullopt; + } + return mConferenceId.getIdentifier(); +} + ConferenceInterface::State BasicChatRoom::getState() const { return mState; } diff --git a/src/chat/chat-room/basic-chat-room.h b/src/chat/chat-room/basic-chat-room.h index 662b0db585..b94259b7d3 100644 --- a/src/chat/chat-room/basic-chat-room.h +++ b/src/chat/chat-room/basic-chat-room.h @@ -44,6 +44,7 @@ public: bool isReadOnly() const override; const ConferenceId &getConferenceId() const override; + std::optional<std::reference_wrapper<const std::string>> getIdentifier() const override; void invalidateAccount() override; std::shared_ptr<Account> getAccount() override; diff --git a/src/chat/chat-room/chat-room.cpp b/src/chat/chat-room/chat-room.cpp index 0cecf38bf1..1c86cce6ed 100644 --- a/src/chat/chat-room/chat-room.cpp +++ b/src/chat/chat-room/chat-room.cpp @@ -1044,6 +1044,14 @@ std::list<std::shared_ptr<Address>> ChatRoom::getParticipantAddresses() const { return conference->getParticipantAddresses(); } +std::optional<std::reference_wrapper<const std::string>> ChatRoom::getIdentifier() const { + const auto conference = getConference(); + if (!conference) { + return std::nullopt; + } + return conference->getIdentifier(); +} + std::shared_ptr<ConferenceParams> ChatRoom::getCurrentParams() const { const auto conference = getConference(); if (!conference) { diff --git a/src/chat/chat-room/chat-room.h b/src/chat/chat-room/chat-room.h index 2b5a8bae0b..e7d4c9bd1f 100644 --- a/src/chat/chat-room/chat-room.h +++ b/src/chat/chat-room/chat-room.h @@ -47,6 +47,7 @@ public: const std::shared_ptr<Address> &getPeerAddress() const override; const std::shared_ptr<Address> &getLocalAddress() const override; + std::optional<std::reference_wrapper<const std::string>> getIdentifier() const override; time_t getCreationTime() const override; time_t getLastUpdateTime() const override; diff --git a/src/conference/conference-context.cpp b/src/conference/conference-context.cpp index 435eff0dd7..3dd1ed698c 100644 --- a/src/conference/conference-context.cpp +++ b/src/conference/conference-context.cpp @@ -77,7 +77,7 @@ bool ConferenceContext::operator==(const ConferenceContext &other) const { } // Check participants only if list provided as argument is not empty - if (mParticipants.empty() == false) { + if (!mParticipants.empty()) { const auto &otherParticipants = other.getParticipants(); if (mParticipants.size() != otherParticipants.size()) return false; for (const auto &participant : mParticipants) { diff --git a/src/conference/conference-id.cpp b/src/conference/conference-id.cpp index df400e711a..967238a351 100644 --- a/src/conference/conference-id.cpp +++ b/src/conference/conference-id.cpp @@ -29,6 +29,8 @@ using namespace std; LINPHONE_BEGIN_NAMESPACE +const std::string ConferenceId::IdentifierDelimiter = "##"; + ConferenceId::ConferenceId() { } @@ -143,6 +145,15 @@ size_t ConferenceId::getHash() const { return mHash; } +const std::string &ConferenceId::getIdentifier() const { + if (mIdentifier.empty()) { + const auto &pAddress = mPeerAddress ? reducedAddress(*mPeerAddress).toStringUriOnlyOrdered(false) : "sip:"; + const auto &lAddress = mLocalAddress ? reducedAddress(*mLocalAddress).toStringUriOnlyOrdered(false) : "sip:"; + mIdentifier += pAddress + ConferenceId::IdentifierDelimiter + lAddress; + } + return mIdentifier; +} + Address ConferenceId::reducedAddress(const Address &addr) { Address ret = addr.getUriWithoutGruu(); ret.removeUriParam(Conference::SecurityModeParameter); @@ -164,4 +175,15 @@ bool ConferenceId::weakEqual(const ConferenceId &other) const { reducedAddress(*mLocalAddress) == reducedAddress(*other.mLocalAddress); } +std::pair<std::shared_ptr<Address>, std::shared_ptr<Address>> +ConferenceId::parseIdentifier(const std::string &identifier) { + std::string peerAddressString = identifier.substr(0, identifier.find(ConferenceId::IdentifierDelimiter)); + std::string localAddressString = + identifier.substr(identifier.find(ConferenceId::IdentifierDelimiter) + ConferenceId::IdentifierDelimiter.size(), + identifier.size() - 1); + auto localAddress = Address::create(localAddressString); + auto peerAddress = Address::create(peerAddressString); + return std::make_pair(localAddress, peerAddress); +} + LINPHONE_END_NAMESPACE diff --git a/src/conference/conference-id.h b/src/conference/conference-id.h index 3a808c13c9..cafa8ce33d 100644 --- a/src/conference/conference-id.h +++ b/src/conference/conference-id.h @@ -30,6 +30,9 @@ LINPHONE_BEGIN_NAMESPACE class LINPHONE_PUBLIC ConferenceId { public: + static const std::string IdentifierDelimiter; + static std::pair<std::shared_ptr<Address>, std::shared_ptr<Address>> parseIdentifier(const std::string &identifier); + ConferenceId(); // Caution: this optimized constructor does not care about extracting the URI part only. Use it for URI only // Address. @@ -59,6 +62,8 @@ public: void setPeerAddress(const std::shared_ptr<const Address> &addr, bool forceUpdate = false); void setLocalAddress(const std::shared_ptr<const Address> &addr, bool forceUpdate = false); + const std::string &getIdentifier() const; + bool isValid() const; size_t getHash() const; size_t getWeakHash() const; @@ -81,6 +86,7 @@ private: mutable size_t mHash = 0; mutable size_t mWeakHash = 0; ConferenceIdParams mParams; + mutable std::string mIdentifier; bool canUpdateAddress(const std::shared_ptr<const Address> &addr, bool useLocal) const; std::shared_ptr<Address> processAddress(const Address &addr) const; diff --git a/src/conference/conference.cpp b/src/conference/conference.cpp index ab3faf158c..7e9e560888 100644 --- a/src/conference/conference.cpp +++ b/src/conference/conference.cpp @@ -1097,6 +1097,13 @@ const ConferenceId &Conference::getConferenceId() const { return mConferenceId; } +std::optional<std::reference_wrapper<const std::string>> Conference::getIdentifier() const { + if (mState == ConferenceInterface::State::Instantiated) { + return std::nullopt; + } + return mConferenceId.getIdentifier(); +} + void Conference::notifyFullState() { for (const auto &l : mConfListeners) { l->onFullStateReceived(); diff --git a/src/conference/conference.h b/src/conference/conference.h index fcb466b442..f94d81576f 100644 --- a/src/conference/conference.h +++ b/src/conference/conference.h @@ -183,6 +183,7 @@ public: void addListener(std::shared_ptr<ConferenceListenerInterface> listener) override; const ConferenceId &getConferenceId() const override; + std::optional<std::reference_wrapper<const std::string>> getIdentifier() const; inline unsigned int getLastNotify() const { return mLastNotify; }; diff --git a/src/core/core-chat-room.cpp b/src/core/core-chat-room.cpp index d3ee6e328e..8e20020a18 100644 --- a/src/core/core-chat-room.cpp +++ b/src/core/core-chat-room.cpp @@ -293,6 +293,14 @@ CorePrivate::searchChatRoom(const std::shared_ptr<ConferenceParams> ¶ms, return chatRoom; } +std::shared_ptr<AbstractChatRoom> CorePrivate::searchChatRoom(const std::string identifier) const { + auto [localAddress, peerAddress] = ConferenceId::parseIdentifier(identifier); + if (!localAddress || !localAddress->isValid() || !peerAddress || !peerAddress->isValid()) { + return nullptr; + } + return searchChatRoom(nullptr, localAddress, peerAddress, std::list<std::shared_ptr<Address>>()); +} + shared_ptr<AbstractChatRoom> CorePrivate::createChatRoom(const shared_ptr<ConferenceParams> ¶ms, const std::shared_ptr<const Address> &localAddr, diff --git a/src/core/core-p.h b/src/core/core-p.h index 601620ccc9..fe5a3eb53f 100644 --- a/src/core/core-p.h +++ b/src/core/core-p.h @@ -143,6 +143,7 @@ public: const std::shared_ptr<const Address> &participant); std::shared_ptr<AbstractChatRoom> createChatRoom(const std::shared_ptr<const Address> &participant); + std::shared_ptr<AbstractChatRoom> searchChatRoom(const std::string identifier) const; std::shared_ptr<AbstractChatRoom> searchChatRoom(const std::shared_ptr<ConferenceParams> ¶ms, const std::shared_ptr<const Address> &localAddr, const std::shared_ptr<const Address> &remoteAddr, diff --git a/src/core/core.cpp b/src/core/core.cpp index ac96c472a9..6259efd1bc 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -2000,6 +2000,14 @@ std::shared_ptr<Conference> Core::searchConference(const std::shared_ptr<Confere return conference; } +std::shared_ptr<Conference> Core::searchConference(const std::string identifier) const { + auto [localAddress, peerAddress] = ConferenceId::parseIdentifier(identifier); + if (!localAddress || !localAddress->isValid() || !peerAddress || !peerAddress->isValid()) { + return nullptr; + } + return searchConference(nullptr, localAddress, peerAddress, {}); +} + shared_ptr<Conference> Core::searchConference(const std::shared_ptr<const Address> &conferenceAddress) const { L_D(); diff --git a/src/core/core.h b/src/core/core.h index 595451dc56..d3d10c4304 100644 --- a/src/core/core.h +++ b/src/core/core.h @@ -262,6 +262,7 @@ public: const std::shared_ptr<const Address> &remoteAddress, const std::list<std::shared_ptr<Address>> &participants) const; std::shared_ptr<Conference> searchConference(const std::shared_ptr<const Address> &conferenceAddress) const; + std::shared_ptr<Conference> searchConference(const std::string identifier) const; // --------------------------------------------------------------------------- // Paths. diff --git a/tester/local-chat-tester-functions.cpp b/tester/local-chat-tester-functions.cpp index 624cee48d5..3984d52466 100644 --- a/tester/local-chat-tester-functions.cpp +++ b/tester/local-chat-tester-functions.cpp @@ -415,8 +415,30 @@ void group_chat_room_with_client_restart_base(bool encrypted) { BC_ASSERT_TRUE( CoreManagerAssert({focus, marie, michelle, michelle2, berthe, laure}) .waitUntil(chrono::seconds(10), [&focus, &core] { return checkChatroom(focus, core, -1); })); + + const bctbx_list_t *chat_rooms = linphone_core_get_chat_rooms(core.getLc()); + for (const bctbx_list_t *chat_room_it = chat_rooms; chat_room_it != NULL; + chat_room_it = chat_room_it->next) { + const LinphoneChatRoom *chat_room = + static_cast<const LinphoneChatRoom *>(bctbx_list_get_data(chat_room_it)); + BC_ASSERT_PTR_NOT_NULL(chat_room); + if (chat_room) { + const char *chat_room_identifier = linphone_chat_room_get_identifier(chat_room); + LinphoneChatRoom *found_chat_room = + linphone_core_search_chat_room_by_identifier(core.getLc(), chat_room_identifier); + BC_ASSERT_PTR_NOT_NULL(found_chat_room); + BC_ASSERT_PTR_EQUAL(chat_room, found_chat_room); + } + } }; + // Test invalid peer address + BC_ASSERT_PTR_NULL(linphone_core_search_chat_room_by_identifier( + marie.getLc(), "==sip:toto@sip.conference.org##sip:me@sip.local.org")); + // Test inexistent chat room identifier + BC_ASSERT_PTR_NULL(linphone_core_search_chat_room_by_identifier( + marie.getLc(), "sip:toto@sip.conference.org##sip:me@sip.local.org")); + initialMarieStats = marie.getStats(); initialMichelleStats = michelle.getStats(); initialBertheStats = berthe.getStats(); diff --git a/tester/local-conference-tester-functions.cpp b/tester/local-conference-tester-functions.cpp index 99bd73cab7..6703f14c60 100644 --- a/tester/local-conference-tester-functions.cpp +++ b/tester/local-conference-tester-functions.cpp @@ -1693,10 +1693,23 @@ void create_conference_base(time_t start_time, return marie_call && (linphone_call_get_duration(marie_call) > nortp_timeout); }); + // Test invalid peer address + BC_ASSERT_PTR_NULL(linphone_core_search_conference_by_identifier( + marie.getLc(), "==sip:toto@sip.conference.org##sip:me@sip.local.org")); + // Test inexistent chat room identifier + BC_ASSERT_PTR_NULL(linphone_core_search_conference_by_identifier( + marie.getLc(), "sip:toto@sip.conference.org##sip:me@sip.local.org")); + for (auto mgr : conferenceMgrs) { LinphoneConference *pconference = linphone_core_search_conference_2(mgr->lc, confAddr); BC_ASSERT_PTR_NOT_NULL(pconference); if (pconference) { + const char *conference_identifier = linphone_conference_get_identifier(pconference); + LinphoneConference *found_pconference = + linphone_core_search_conference_by_identifier(mgr->lc, conference_identifier); + BC_ASSERT_PTR_NOT_NULL(found_pconference); + BC_ASSERT_PTR_EQUAL(pconference, found_pconference); + const LinphoneConferenceParams *conference_params = linphone_conference_get_current_params(pconference); int no_participants = 0; if (start_time >= 0) { -- GitLab