diff --git a/include/linphone/api/c-event-log.h b/include/linphone/api/c-event-log.h index 82fe4247c..81fd18990 100644 --- a/include/linphone/api/c-event-log.h +++ b/include/linphone/api/c-event-log.h @@ -204,7 +204,6 @@ LINPHONE_PUBLIC const LinphoneAddress *linphone_conference_participant_device_ev * Constructs a #LinphoneConferenceSubjectEvent object. **/ LINPHONE_PUBLIC LinphoneConferenceSubjectEvent *linphone_conference_subject_event_new ( - LinphoneEventLogType type, time_t time, const LinphoneAddress *conference_address, unsigned int notify_id, diff --git a/src/c-wrapper/api/c-event-log.cpp b/src/c-wrapper/api/c-event-log.cpp index 94f926e07..ee6625104 100644 --- a/src/c-wrapper/api/c-event-log.cpp +++ b/src/c-wrapper/api/c-event-log.cpp @@ -17,7 +17,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "linphone/api/c-chat-message.h" #include "linphone/api/c-event-log.h" #include "c-wrapper/c-wrapper.h" @@ -30,6 +29,7 @@ L_DECLARE_C_OBJECT_IMPL(ConferenceCallEvent); L_DECLARE_C_OBJECT_IMPL(ConferenceChatMessageEvent); L_DECLARE_C_OBJECT_IMPL(ConferenceEvent); +L_DECLARE_C_OBJECT_IMPL(ConferenceNotifiedEvent); L_DECLARE_C_OBJECT_IMPL(ConferenceParticipantDeviceEvent); L_DECLARE_C_OBJECT_IMPL(ConferenceParticipantEvent); L_DECLARE_C_OBJECT_IMPL(ConferenceSubjectEvent); @@ -38,11 +38,11 @@ L_DECLARE_C_OBJECT_IMPL(EventLog); using namespace std; // ----------------------------------------------------------------------------- -// Event log. +// EventLog. // ----------------------------------------------------------------------------- LinphoneEventLog *linphone_event_log_new () { - LinphoneEventLog *event_log = _linphone_EventLog_init(); + LinphoneEventLog *event_log = L_INIT(EventLog); L_SET_CPP_PTR_FROM_C_OBJECT(event_log, make_shared()); return event_log; } @@ -52,18 +52,88 @@ LinphoneEventLog *linphone_event_log_ref (LinphoneEventLog *event_log) { return event_log; } +void linphone_event_log_unref (LinphoneEventLog *event_log) { + belle_sip_object_unref(event_log); +} + LinphoneEventLogType linphone_event_log_get_type (const LinphoneEventLog *event_log) { return static_cast( L_GET_CPP_PTR_FROM_C_OBJECT(event_log)->getType() ); } +time_t linphone_event_log_get_time (const LinphoneEventLog *event_log) { + return L_GET_CPP_PTR_FROM_C_OBJECT(event_log)->getTime(); +} + // ----------------------------------------------------------------------------- -// Call event. +// ConferenceEvent. // ----------------------------------------------------------------------------- -LinphoneConferenceCallEvent *linphone_conference_call_event_new (LinphoneEventLogType type, time_t time, LinphoneCall *call) { - LinphoneConferenceCallEvent *conference_call_event = _linphone_ConferenceCallEvent_init(); +LinphoneConferenceEvent *linphone_conference_event_new ( + LinphoneEventLogType type, + time_t time, + const LinphoneAddress *conference_address +) { + LinphoneConferenceEvent *conference_event = L_INIT(ConferenceEvent); + L_SET_CPP_PTR_FROM_C_OBJECT( + conference_event, + make_shared( + static_cast(type), + time, + *L_GET_CPP_PTR_FROM_C_OBJECT(conference_address) + ) + ); + return conference_event; +} + +const LinphoneAddress *linphone_conference_event_get_conference_address ( + const LinphoneConferenceEvent *conference_event +) { + return L_GET_C_BACK_PTR( + &L_GET_CPP_PTR_FROM_C_OBJECT(conference_event)->getConferenceAddress() + ); +} + +// ----------------------------------------------------------------------------- +// ConferenceNotifiedEvent. +// ----------------------------------------------------------------------------- + +LinphoneConferenceNotifiedEvent *linphone_conference_notified_event_new ( + LinphoneEventLogType type, + time_t time, + const LinphoneAddress *conference_address, + unsigned int notify_id +) { + LinphoneConferenceNotifiedEvent *conference_notified_event = L_INIT(ConferenceNotifiedEvent); + L_SET_CPP_PTR_FROM_C_OBJECT( + conference_notified_event, + make_shared( + static_cast(type), + time, + *L_GET_CPP_PTR_FROM_C_OBJECT(conference_address), + notify_id + ) + ); + return conference_notified_event; +} + +unsigned int linphone_conference_notified_event_get_notify_id ( + const LinphoneConferenceNotifiedEvent *conference_notified_event +) { + return L_GET_CPP_PTR_FROM_C_OBJECT(conference_notified_event)->getNotifyId(); +} + +// ----------------------------------------------------------------------------- +// ConferenceCallEvent. +// ----------------------------------------------------------------------------- + +LinphoneConferenceCallEvent *linphone_conference_call_event_new ( + LinphoneEventLogType type, + time_t time, + LinphoneCall *call +) { + LinphoneConferenceCallEvent *conference_call_event = L_INIT(ConferenceCallEvent); L_SET_CPP_PTR_FROM_C_OBJECT( conference_call_event, make_shared( @@ -82,64 +152,130 @@ LinphoneCall *linphone_conference_call_event_get_call (const LinphoneConferenceC } // ----------------------------------------------------------------------------- -// Conference event. +// ConferenceChatMessageEvent. // ----------------------------------------------------------------------------- -LinphoneConferenceEvent *linphone_conference_event_new ( - LinphoneEventLogType type, +LinphoneConferenceChatMessageEvent *linphone_conference_chat_message_event_new ( time_t time, - const LinphoneAddress *address + LinphoneChatMessage *chat_message ) { - // TODO. - return nullptr; -} - -const LinphoneAddress *linphone_conference_event_get_address (const LinphoneConferenceEvent *conference_event) { - // TODO. - return nullptr; -} - -// ----------------------------------------------------------------------------- -// Conference participant event. -// ----------------------------------------------------------------------------- - -LinphoneConferenceParticipantEvent *linphone_conference_participant_event_new ( - LinphoneEventLogType type, - time_t time, - const LinphoneAddress *conferenceAddress, - const LinphoneAddress *participantAddress -) { - // TODO. - return nullptr; -} - -const LinphoneAddress *linphone_conference_participant_event_get_participant_address ( - const LinphoneConferenceParticipantEvent *conference_participant_event -) { - // TODO. - return nullptr; -} - -// ----------------------------------------------------------------------------- -// Message event. -// ----------------------------------------------------------------------------- - -LinphoneConferenceChatMessageEvent *linphone_chat_message_event_new (LinphoneChatMessage *chat_message, time_t time) { - LinphoneConferenceChatMessageEvent *chat_message_event = _linphone_ConferenceChatMessageEvent_init(); + LinphoneConferenceChatMessageEvent *conference_chat_message_event = L_INIT(ConferenceChatMessageEvent); L_SET_CPP_PTR_FROM_C_OBJECT( - chat_message_event, + conference_chat_message_event, make_shared( time, L_GET_CPP_PTR_FROM_C_OBJECT(chat_message) ) ); - return chat_message_event; + return conference_chat_message_event; } -LinphoneChatMessage *linphone_chat_message_event_get_chat_message ( - const LinphoneConferenceChatMessageEvent *chat_message_event +LinphoneChatMessage *linphone_conference_chat_message_event_get_chat_message ( + const LinphoneConferenceChatMessageEvent *conference_chat_message_event ) { return L_GET_C_BACK_PTR( - L_GET_CPP_PTR_FROM_C_OBJECT(chat_message_event)->getChatMessage() + L_GET_CPP_PTR_FROM_C_OBJECT(conference_chat_message_event)->getChatMessage() + ); +} + +// ----------------------------------------------------------------------------- +// ConferenceParticipantEvent. +// ----------------------------------------------------------------------------- + +LinphoneConferenceParticipantEvent *linphone_conference_participant_event_new ( + LinphoneEventLogType type, + time_t time, + const LinphoneAddress *conference_address, + unsigned int notify_id, + const LinphoneAddress *participant_address +) { + LinphoneConferenceParticipantEvent *conference_participant_event = L_INIT(ConferenceParticipantEvent); + L_SET_CPP_PTR_FROM_C_OBJECT( + conference_participant_event, + make_shared( + static_cast(type), + time, + *L_GET_CPP_PTR_FROM_C_OBJECT(conference_address), + notify_id, + *L_GET_CPP_PTR_FROM_C_OBJECT(participant_address) + ) + ); + return conference_participant_event; +} + +const LinphoneAddress *linphone_conference_participant_event_get_participant_address ( + const LinphoneConferenceParticipantEvent *conference_participant_event +) { + return L_GET_C_BACK_PTR( + &L_GET_CPP_PTR_FROM_C_OBJECT(conference_participant_event)->getParticipantAddress() + ); +} + +// ----------------------------------------------------------------------------- +// ConferenceParticipantDeviceEvent. +// ----------------------------------------------------------------------------- + +LinphoneConferenceParticipantDeviceEvent *linphone_conference_participant_device_event_new ( + LinphoneEventLogType type, + time_t time, + const LinphoneAddress *conference_address, + unsigned int notify_id, + const LinphoneAddress *participant_address, + const LinphoneAddress *gruu_address +) { + LinphoneConferenceParticipantDeviceEvent *conference_participant_device_event = L_INIT( + ConferenceParticipantDeviceEvent + ); + L_SET_CPP_PTR_FROM_C_OBJECT( + conference_participant_device_event, + make_shared( + static_cast(type), + time, + *L_GET_CPP_PTR_FROM_C_OBJECT(conference_address), + notify_id, + *L_GET_CPP_PTR_FROM_C_OBJECT(participant_address), + *L_GET_CPP_PTR_FROM_C_OBJECT(gruu_address) + ) + ); + return conference_participant_device_event; +} + +const LinphoneAddress *linphone_conference_participant_device_event_get_gruu_address ( + const LinphoneConferenceParticipantDeviceEvent *conference_participant_device_event +) { + return L_GET_C_BACK_PTR( + &L_GET_CPP_PTR_FROM_C_OBJECT(conference_participant_device_event)->getGruuAddress() + ); +} + +// ----------------------------------------------------------------------------- +// ConferenceSubjectEvent. +// ----------------------------------------------------------------------------- + +LinphoneConferenceSubjectEvent *linphone_conference_subject_event_new ( + LinphoneEventLogType type, + time_t time, + const LinphoneAddress *conference_address, + unsigned int notify_id, + const char *subject +) { + LinphoneConferenceSubjectEvent *conference_subject_event = L_INIT(ConferenceSubjectEvent); + L_SET_CPP_PTR_FROM_C_OBJECT( + conference_subject_event, + make_shared( + time, + *L_GET_CPP_PTR_FROM_C_OBJECT(conference_address), + notify_id, + L_C_TO_STRING(subject) + ) + ); + return conference_subject_event; +} + +LINPHONE_PUBLIC const char *linphone_conference_subject_event_get_subject ( + const LinphoneConferenceSubjectEvent *conference_subject_event +) { + return L_STRING_TO_C( + L_GET_CPP_PTR_FROM_C_OBJECT(conference_subject_event)->getSubject() ); }