diff --git a/src/c-wrapper/api/c-address.cpp b/src/c-wrapper/api/c-address.cpp index 80d4002db..9e966dfc7 100644 --- a/src/c-wrapper/api/c-address.cpp +++ b/src/c-wrapper/api/c-address.cpp @@ -18,15 +18,16 @@ #include "linphone/api/c-address.h" -#include "c-wrapper/c-tools.h" - #include "address/address.h" +#include "c-wrapper/c-tools.h" // ============================================================================= +L_DECLARE_C_CLONABLE_STRUCT_IMPL(Address, Address, address); + using namespace std; -L_DECLARE_C_CLONABLE_STRUCT_IMPL(Address, Address, address); +// ============================================================================= LinphoneAddress *linphone_address_new (const char *address) { LINPHONE_NAMESPACE::Address *cppPtr = new LINPHONE_NAMESPACE::Address(L_C_TO_STRING(address)); diff --git a/src/c-wrapper/api/c-call-params.cpp b/src/c-wrapper/api/c-call-params.cpp index 13d515655..a51c3fead 100644 --- a/src/c-wrapper/api/c-call-params.cpp +++ b/src/c-wrapper/api/c-call-params.cpp @@ -17,12 +17,16 @@ */ #include "linphone/call_params.h" + +// TODO: Remove me later. #include "private.h" #include "c-wrapper/c-tools.h" -#include "conference/params/media-session-params.h" #include "conference/params/call-session-params-p.h" #include "conference/params/media-session-params-p.h" +#include "conference/params/media-session-params.h" + +// ============================================================================= #define GET_CALL_CPP_PTR(obj) L_GET_CPP_PTR_FROM_C_STRUCT(obj, CallSessionParams, CallParams) #define GET_CALL_CPP_PRIVATE_PTR(obj) L_GET_PRIVATE_FROM_C_STRUCT(obj, CallSessionParams, CallParams) @@ -31,19 +35,17 @@ L_DECLARE_C_CLONABLE_STRUCT_IMPL(MediaSessionParams, CallParams, call_params) -// ============================================================================= - using namespace std; -/******************************************************************************* - * Internal functions * - ******************************************************************************/ +// ============================================================================= +// Internal functions. +// ============================================================================= -SalMediaProto get_proto_from_call_params(const LinphoneCallParams *params) { +SalMediaProto get_proto_from_call_params (const LinphoneCallParams *params) { return GET_MEDIA_CPP_PTR(params)->getMediaProto(); } -SalStreamDir sal_dir_from_call_params_dir(LinphoneMediaDirection cpdir) { +SalStreamDir sal_dir_from_call_params_dir (LinphoneMediaDirection cpdir) { switch (cpdir) { case LinphoneMediaDirectionInactive: return SalStreamInactive; @@ -60,7 +62,7 @@ SalStreamDir sal_dir_from_call_params_dir(LinphoneMediaDirection cpdir) { return SalStreamSendRecv; } -LinphoneMediaDirection media_direction_from_sal_stream_dir(SalStreamDir dir){ +LinphoneMediaDirection media_direction_from_sal_stream_dir (SalStreamDir dir) { switch (dir) { case SalStreamInactive: return LinphoneMediaDirectionInactive; @@ -74,112 +76,111 @@ LinphoneMediaDirection media_direction_from_sal_stream_dir(SalStreamDir dir){ return LinphoneMediaDirectionSendRecv; } -SalStreamDir get_audio_dir_from_call_params(const LinphoneCallParams *params) { +SalStreamDir get_audio_dir_from_call_params (const LinphoneCallParams *params) { return sal_dir_from_call_params_dir(linphone_call_params_get_audio_direction(params)); } -SalStreamDir get_video_dir_from_call_params(const LinphoneCallParams *params) { +SalStreamDir get_video_dir_from_call_params (const LinphoneCallParams *params) { return sal_dir_from_call_params_dir(linphone_call_params_get_video_direction(params)); } -void linphone_call_params_set_custom_headers(LinphoneCallParams *params, const SalCustomHeader *ch) { +void linphone_call_params_set_custom_headers (LinphoneCallParams *params, const SalCustomHeader *ch) { GET_CALL_CPP_PRIVATE_PTR(params)->setCustomHeaders(ch); } -void linphone_call_params_set_custom_sdp_attributes(LinphoneCallParams *params, const SalCustomSdpAttribute *csa) { +void linphone_call_params_set_custom_sdp_attributes (LinphoneCallParams *params, const SalCustomSdpAttribute *csa) { GET_MEDIA_CPP_PRIVATE_PTR(params)->setCustomSdpAttributes(csa); } -void linphone_call_params_set_custom_sdp_media_attributes(LinphoneCallParams *params, LinphoneStreamType type, const SalCustomSdpAttribute *csa) { +void linphone_call_params_set_custom_sdp_media_attributes (LinphoneCallParams *params, LinphoneStreamType type, const SalCustomSdpAttribute *csa) { GET_MEDIA_CPP_PRIVATE_PTR(params)->setCustomSdpMediaAttributes(type, csa); } +// ============================================================================= +// Public functions. +// ============================================================================= -/******************************************************************************* - * Public functions * - ******************************************************************************/ - -void linphone_call_params_add_custom_header(LinphoneCallParams *params, const char *header_name, const char *header_value) { +void linphone_call_params_add_custom_header (LinphoneCallParams *params, const char *header_name, const char *header_value) { GET_MEDIA_CPP_PTR(params)->addCustomHeader(header_name, header_value); } -void linphone_call_params_add_custom_sdp_attribute(LinphoneCallParams *params, const char *attribute_name, const char *attribute_value) { +void linphone_call_params_add_custom_sdp_attribute (LinphoneCallParams *params, const char *attribute_name, const char *attribute_value) { GET_MEDIA_CPP_PTR(params)->addCustomSdpAttribute(attribute_name, attribute_value); } -void linphone_call_params_add_custom_sdp_media_attribute(LinphoneCallParams *params, LinphoneStreamType type, const char *attribute_name, const char *attribute_value) { +void linphone_call_params_add_custom_sdp_media_attribute (LinphoneCallParams *params, LinphoneStreamType type, const char *attribute_name, const char *attribute_value) { GET_MEDIA_CPP_PTR(params)->addCustomSdpMediaAttribute(type, attribute_name, attribute_value); } -void linphone_call_params_clear_custom_sdp_attributes(LinphoneCallParams *params) { +void linphone_call_params_clear_custom_sdp_attributes (LinphoneCallParams *params) { GET_MEDIA_CPP_PTR(params)->clearCustomSdpAttributes(); } -void linphone_call_params_clear_custom_sdp_media_attributes(LinphoneCallParams *params, LinphoneStreamType type) { +void linphone_call_params_clear_custom_sdp_media_attributes (LinphoneCallParams *params, LinphoneStreamType type) { GET_MEDIA_CPP_PTR(params)->clearCustomSdpMediaAttributes(type); } -LinphoneCallParams * linphone_call_params_copy(const LinphoneCallParams *params) { +LinphoneCallParams *linphone_call_params_copy (const LinphoneCallParams *params) { return (LinphoneCallParams *)belle_sip_object_clone((const belle_sip_object_t *)params); } -bool_t linphone_call_params_early_media_sending_enabled(const LinphoneCallParams *params) { +bool_t linphone_call_params_early_media_sending_enabled (const LinphoneCallParams *params) { return GET_MEDIA_CPP_PTR(params)->earlyMediaSendingEnabled(); } -void linphone_call_params_enable_early_media_sending(LinphoneCallParams *params, bool_t enabled) { +void linphone_call_params_enable_early_media_sending (LinphoneCallParams *params, bool_t enabled) { GET_MEDIA_CPP_PTR(params)->enableEarlyMediaSending(enabled); } -void linphone_call_params_enable_low_bandwidth(LinphoneCallParams *params, bool_t enabled) { +void linphone_call_params_enable_low_bandwidth (LinphoneCallParams *params, bool_t enabled) { GET_MEDIA_CPP_PTR(params)->enableLowBandwidth(enabled); } -void linphone_call_params_enable_audio(LinphoneCallParams *params, bool_t enabled) { +void linphone_call_params_enable_audio (LinphoneCallParams *params, bool_t enabled) { GET_MEDIA_CPP_PTR(params)->enableAudio(enabled); } -LinphoneStatus linphone_call_params_enable_realtime_text(LinphoneCallParams *params, bool_t yesno) { +LinphoneStatus linphone_call_params_enable_realtime_text (LinphoneCallParams *params, bool_t yesno) { GET_MEDIA_CPP_PTR(params)->enableRealtimeText(yesno); return 0; } -void linphone_call_params_enable_video(LinphoneCallParams *params, bool_t enabled) { +void linphone_call_params_enable_video (LinphoneCallParams *params, bool_t enabled) { GET_MEDIA_CPP_PTR(params)->enableVideo(enabled); } -const char *linphone_call_params_get_custom_header(const LinphoneCallParams *params, const char *header_name) { +const char *linphone_call_params_get_custom_header (const LinphoneCallParams *params, const char *header_name) { string value = GET_MEDIA_CPP_PTR(params)->getCustomHeader(header_name); return value.empty() ? nullptr : value.c_str(); } -const char * linphone_call_params_get_custom_sdp_attribute(const LinphoneCallParams *params, const char *attribute_name) { +const char *linphone_call_params_get_custom_sdp_attribute (const LinphoneCallParams *params, const char *attribute_name) { string value = GET_MEDIA_CPP_PTR(params)->getCustomSdpAttribute(attribute_name); return value.empty() ? nullptr : value.c_str(); } -const char * linphone_call_params_get_custom_sdp_media_attribute(const LinphoneCallParams *params, LinphoneStreamType type, const char *attribute_name) { +const char *linphone_call_params_get_custom_sdp_media_attribute (const LinphoneCallParams *params, LinphoneStreamType type, const char *attribute_name) { string value = GET_MEDIA_CPP_PTR(params)->getCustomSdpMediaAttribute(type, attribute_name); return value.empty() ? nullptr : value.c_str(); } -bool_t linphone_call_params_get_local_conference_mode(const LinphoneCallParams *params) { +bool_t linphone_call_params_get_local_conference_mode (const LinphoneCallParams *params) { return linphone_call_params_get_in_conference(params); } -LinphoneMediaEncryption linphone_call_params_get_media_encryption(const LinphoneCallParams *params) { +LinphoneMediaEncryption linphone_call_params_get_media_encryption (const LinphoneCallParams *params) { return GET_MEDIA_CPP_PTR(params)->getMediaEncryption(); } -LinphonePrivacyMask linphone_call_params_get_privacy(const LinphoneCallParams *params) { +LinphonePrivacyMask linphone_call_params_get_privacy (const LinphoneCallParams *params) { return GET_MEDIA_CPP_PTR(params)->getPrivacy(); } -float linphone_call_params_get_received_framerate(const LinphoneCallParams *params) { +float linphone_call_params_get_received_framerate (const LinphoneCallParams *params) { return GET_MEDIA_CPP_PTR(params)->getReceivedFps(); } -MSVideoSize linphone_call_params_get_received_video_size(const LinphoneCallParams *params) { +MSVideoSize linphone_call_params_get_received_video_size (const LinphoneCallParams *params) { MSVideoSize vsize; LinphoneVideoDefinition *vdef = GET_MEDIA_CPP_PTR(params)->getReceivedVideoDefinition(); if (vdef) { @@ -192,24 +193,24 @@ MSVideoSize linphone_call_params_get_received_video_size(const LinphoneCallParam return vsize; } -const LinphoneVideoDefinition * linphone_call_params_get_received_video_definition(const LinphoneCallParams *params) { +const LinphoneVideoDefinition *linphone_call_params_get_received_video_definition (const LinphoneCallParams *params) { return GET_MEDIA_CPP_PTR(params)->getReceivedVideoDefinition(); } -const char *linphone_call_params_get_record_file(const LinphoneCallParams *params) { +const char *linphone_call_params_get_record_file (const LinphoneCallParams *params) { const string &value = GET_MEDIA_CPP_PTR(params)->getRecordFilePath(); return value.empty() ? nullptr : value.c_str(); } -const char * linphone_call_params_get_rtp_profile(const LinphoneCallParams *params) { +const char *linphone_call_params_get_rtp_profile (const LinphoneCallParams *params) { return GET_MEDIA_CPP_PTR(params)->getRtpProfile(); } -float linphone_call_params_get_sent_framerate(const LinphoneCallParams *params) { +float linphone_call_params_get_sent_framerate (const LinphoneCallParams *params) { return GET_MEDIA_CPP_PTR(params)->getSentFps(); } -MSVideoSize linphone_call_params_get_sent_video_size(const LinphoneCallParams *params) { +MSVideoSize linphone_call_params_get_sent_video_size (const LinphoneCallParams *params) { MSVideoSize vsize; LinphoneVideoDefinition *vdef = GET_MEDIA_CPP_PTR(params)->getSentVideoDefinition(); if (vdef) { @@ -222,310 +223,308 @@ MSVideoSize linphone_call_params_get_sent_video_size(const LinphoneCallParams *p return vsize; } -const LinphoneVideoDefinition * linphone_call_params_get_sent_video_definition(const LinphoneCallParams *params) { +const LinphoneVideoDefinition *linphone_call_params_get_sent_video_definition (const LinphoneCallParams *params) { return GET_MEDIA_CPP_PTR(params)->getSentVideoDefinition(); } -const char *linphone_call_params_get_session_name(const LinphoneCallParams *params) { +const char *linphone_call_params_get_session_name (const LinphoneCallParams *params) { const string &value = GET_MEDIA_CPP_PTR(params)->getSessionName(); return value.empty() ? nullptr : value.c_str(); } -LinphonePayloadType *linphone_call_params_get_used_audio_payload_type(const LinphoneCallParams *params) { +LinphonePayloadType *linphone_call_params_get_used_audio_payload_type (const LinphoneCallParams *params) { return GET_MEDIA_CPP_PTR(params)->getUsedAudioPayloadType(); } -LinphonePayloadType *linphone_call_params_get_used_video_payload_type(const LinphoneCallParams *params) { +LinphonePayloadType *linphone_call_params_get_used_video_payload_type (const LinphoneCallParams *params) { return GET_MEDIA_CPP_PTR(params)->getUsedVideoPayloadType(); } -LinphonePayloadType *linphone_call_params_get_used_text_payload_type(const LinphoneCallParams *params) { +LinphonePayloadType *linphone_call_params_get_used_text_payload_type (const LinphoneCallParams *params) { return GET_MEDIA_CPP_PTR(params)->getUsedRealtimeTextPayloadType(); } -const OrtpPayloadType *linphone_call_params_get_used_audio_codec(const LinphoneCallParams *params) { +const OrtpPayloadType *linphone_call_params_get_used_audio_codec (const LinphoneCallParams *params) { return GET_MEDIA_CPP_PTR(params)->getUsedAudioCodec(); } -void linphone_call_params_set_used_audio_codec(LinphoneCallParams *params, OrtpPayloadType *codec) { +void linphone_call_params_set_used_audio_codec (LinphoneCallParams *params, OrtpPayloadType *codec) { GET_MEDIA_CPP_PRIVATE_PTR(params)->setUsedAudioCodec(codec); } -const OrtpPayloadType *linphone_call_params_get_used_video_codec(const LinphoneCallParams *params) { +const OrtpPayloadType *linphone_call_params_get_used_video_codec (const LinphoneCallParams *params) { return GET_MEDIA_CPP_PTR(params)->getUsedVideoCodec(); } -void linphone_call_params_set_used_video_codec(LinphoneCallParams *params, OrtpPayloadType *codec) { +void linphone_call_params_set_used_video_codec (LinphoneCallParams *params, OrtpPayloadType *codec) { GET_MEDIA_CPP_PRIVATE_PTR(params)->setUsedVideoCodec(codec); } -const OrtpPayloadType *linphone_call_params_get_used_text_codec(const LinphoneCallParams *params) { +const OrtpPayloadType *linphone_call_params_get_used_text_codec (const LinphoneCallParams *params) { return GET_MEDIA_CPP_PTR(params)->getUsedRealtimeTextCodec(); } -void linphone_call_params_set_used_text_codec(LinphoneCallParams *params, OrtpPayloadType *codec) { +void linphone_call_params_set_used_text_codec (LinphoneCallParams *params, OrtpPayloadType *codec) { GET_MEDIA_CPP_PRIVATE_PTR(params)->setUsedRealtimeTextCodec(codec); } -bool_t linphone_call_params_low_bandwidth_enabled(const LinphoneCallParams *params) { +bool_t linphone_call_params_low_bandwidth_enabled (const LinphoneCallParams *params) { return GET_MEDIA_CPP_PTR(params)->lowBandwidthEnabled(); } -int linphone_call_params_get_audio_bandwidth_limit(const LinphoneCallParams *params) { +int linphone_call_params_get_audio_bandwidth_limit (const LinphoneCallParams *params) { return GET_MEDIA_CPP_PTR(params)->getAudioBandwidthLimit(); } -void linphone_call_params_set_audio_bandwidth_limit(LinphoneCallParams *params, int bandwidth) { +void linphone_call_params_set_audio_bandwidth_limit (LinphoneCallParams *params, int bandwidth) { GET_MEDIA_CPP_PTR(params)->setAudioBandwidthLimit(bandwidth); } -void linphone_call_params_set_media_encryption(LinphoneCallParams *params, LinphoneMediaEncryption encryption) { +void linphone_call_params_set_media_encryption (LinphoneCallParams *params, LinphoneMediaEncryption encryption) { GET_MEDIA_CPP_PTR(params)->setMediaEncryption(encryption); } -void linphone_call_params_set_privacy(LinphoneCallParams *params, LinphonePrivacyMask privacy) { +void linphone_call_params_set_privacy (LinphoneCallParams *params, LinphonePrivacyMask privacy) { GET_MEDIA_CPP_PTR(params)->setPrivacy(privacy); } -void linphone_call_params_set_record_file(LinphoneCallParams *params, const char *path) { +void linphone_call_params_set_record_file (LinphoneCallParams *params, const char *path) { GET_MEDIA_CPP_PTR(params)->setRecordFilePath(path ? path : ""); } -void linphone_call_params_set_session_name(LinphoneCallParams *params, const char *name) { +void linphone_call_params_set_session_name (LinphoneCallParams *params, const char *name) { GET_MEDIA_CPP_PTR(params)->setSessionName(name ? name : ""); } -bool_t linphone_call_params_audio_enabled(const LinphoneCallParams *params) { +bool_t linphone_call_params_audio_enabled (const LinphoneCallParams *params) { return GET_MEDIA_CPP_PTR(params)->audioEnabled(); } -bool_t linphone_call_params_realtime_text_enabled(const LinphoneCallParams *params) { +bool_t linphone_call_params_realtime_text_enabled (const LinphoneCallParams *params) { return GET_MEDIA_CPP_PTR(params)->realtimeTextEnabled(); } -bool_t linphone_call_params_video_enabled(const LinphoneCallParams *params) { +bool_t linphone_call_params_video_enabled (const LinphoneCallParams *params) { return GET_MEDIA_CPP_PTR(params)->videoEnabled(); } -LinphoneMediaDirection linphone_call_params_get_audio_direction(const LinphoneCallParams *params) { +LinphoneMediaDirection linphone_call_params_get_audio_direction (const LinphoneCallParams *params) { return GET_MEDIA_CPP_PTR(params)->getAudioDirection(); } -LinphoneMediaDirection linphone_call_params_get_video_direction(const LinphoneCallParams *params) { +LinphoneMediaDirection linphone_call_params_get_video_direction (const LinphoneCallParams *params) { return GET_MEDIA_CPP_PTR(params)->getVideoDirection(); } -void linphone_call_params_set_audio_direction(LinphoneCallParams *params, LinphoneMediaDirection dir) { +void linphone_call_params_set_audio_direction (LinphoneCallParams *params, LinphoneMediaDirection dir) { GET_MEDIA_CPP_PTR(params)->setAudioDirection(dir); } -void linphone_call_params_set_video_direction(LinphoneCallParams *params, LinphoneMediaDirection dir) { +void linphone_call_params_set_video_direction (LinphoneCallParams *params, LinphoneMediaDirection dir) { GET_MEDIA_CPP_PTR(params)->setVideoDirection(dir); } -void linphone_call_params_enable_audio_multicast(LinphoneCallParams *params, bool_t yesno) { +void linphone_call_params_enable_audio_multicast (LinphoneCallParams *params, bool_t yesno) { GET_MEDIA_CPP_PTR(params)->enableAudioMulticast(yesno); } -bool_t linphone_call_params_audio_multicast_enabled(const LinphoneCallParams *params) { +bool_t linphone_call_params_audio_multicast_enabled (const LinphoneCallParams *params) { return GET_MEDIA_CPP_PTR(params)->audioMulticastEnabled(); } -void linphone_call_params_enable_video_multicast(LinphoneCallParams *params, bool_t yesno) { +void linphone_call_params_enable_video_multicast (LinphoneCallParams *params, bool_t yesno) { GET_MEDIA_CPP_PTR(params)->enableVideoMulticast(yesno); } -bool_t linphone_call_params_video_multicast_enabled(const LinphoneCallParams *params) { + +bool_t linphone_call_params_video_multicast_enabled (const LinphoneCallParams *params) { return GET_MEDIA_CPP_PTR(params)->videoMulticastEnabled(); } -bool_t linphone_call_params_real_early_media_enabled(const LinphoneCallParams *params) { +bool_t linphone_call_params_real_early_media_enabled (const LinphoneCallParams *params) { return GET_MEDIA_CPP_PTR(params)->earlyMediaSendingEnabled(); } -bool_t linphone_call_params_avpf_enabled(const LinphoneCallParams *params) { +bool_t linphone_call_params_avpf_enabled (const LinphoneCallParams *params) { return GET_MEDIA_CPP_PTR(params)->avpfEnabled(); } -void linphone_call_params_enable_avpf(LinphoneCallParams *params, bool_t enable) { +void linphone_call_params_enable_avpf (LinphoneCallParams *params, bool_t enable) { GET_MEDIA_CPP_PTR(params)->enableAvpf(enable); } -bool_t linphone_call_params_mandatory_media_encryption_enabled(const LinphoneCallParams *params) { +bool_t linphone_call_params_mandatory_media_encryption_enabled (const LinphoneCallParams *params) { return GET_MEDIA_CPP_PTR(params)->mandatoryMediaEncryptionEnabled(); } -void linphone_call_params_enable_mandatory_media_encryption(LinphoneCallParams *params, bool_t value) { +void linphone_call_params_enable_mandatory_media_encryption (LinphoneCallParams *params, bool_t value) { GET_MEDIA_CPP_PTR(params)->enableMandatoryMediaEncryption(value); } -uint16_t linphone_call_params_get_avpf_rr_interval(const LinphoneCallParams *params) { +uint16_t linphone_call_params_get_avpf_rr_interval (const LinphoneCallParams *params) { return GET_MEDIA_CPP_PTR(params)->getAvpfRrInterval(); } -void linphone_call_params_set_avpf_rr_interval(LinphoneCallParams *params, uint16_t value) { +void linphone_call_params_set_avpf_rr_interval (LinphoneCallParams *params, uint16_t value) { GET_MEDIA_CPP_PTR(params)->setAvpfRrInterval(value); } -void linphone_call_params_set_sent_fps(LinphoneCallParams *params, float value) { +void linphone_call_params_set_sent_fps (LinphoneCallParams *params, float value) { GET_MEDIA_CPP_PRIVATE_PTR(params)->setSentFps(value); } -void linphone_call_params_set_received_fps(LinphoneCallParams *params, float value) { +void linphone_call_params_set_received_fps (LinphoneCallParams *params, float value) { GET_MEDIA_CPP_PRIVATE_PTR(params)->setReceivedFps(value); } +// ============================================================================= +// Private functions. +// ============================================================================= -/******************************************************************************* - * Private functions * - ******************************************************************************/ - -bool_t linphone_call_params_get_in_conference(const LinphoneCallParams *params) { +bool_t linphone_call_params_get_in_conference (const LinphoneCallParams *params) { return GET_CALL_CPP_PRIVATE_PTR(params)->getInConference(); } -void linphone_call_params_set_in_conference(LinphoneCallParams *params, bool_t value) { +void linphone_call_params_set_in_conference (LinphoneCallParams *params, bool_t value) { GET_CALL_CPP_PRIVATE_PTR(params)->setInConference(value); } -bool_t linphone_call_params_get_internal_call_update(const LinphoneCallParams *params) { +bool_t linphone_call_params_get_internal_call_update (const LinphoneCallParams *params) { return GET_CALL_CPP_PRIVATE_PTR(params)->getInternalCallUpdate(); } -void linphone_call_params_set_internal_call_update(LinphoneCallParams *params, bool_t value) { +void linphone_call_params_set_internal_call_update (LinphoneCallParams *params, bool_t value) { GET_CALL_CPP_PRIVATE_PTR(params)->setInternalCallUpdate(value); } -bool_t linphone_call_params_implicit_rtcp_fb_enabled(const LinphoneCallParams *params) { +bool_t linphone_call_params_implicit_rtcp_fb_enabled (const LinphoneCallParams *params) { return GET_MEDIA_CPP_PRIVATE_PTR(params)->implicitRtcpFbEnabled(); } -void linphone_call_params_enable_implicit_rtcp_fb(LinphoneCallParams *params, bool_t value) { +void linphone_call_params_enable_implicit_rtcp_fb (LinphoneCallParams *params, bool_t value) { GET_MEDIA_CPP_PRIVATE_PTR(params)->enableImplicitRtcpFb(value); } -int linphone_call_params_get_down_bandwidth(const LinphoneCallParams *params) { +int linphone_call_params_get_down_bandwidth (const LinphoneCallParams *params) { return GET_MEDIA_CPP_PRIVATE_PTR(params)->getDownBandwidth(); } -void linphone_call_params_set_down_bandwidth(LinphoneCallParams *params, int value) { +void linphone_call_params_set_down_bandwidth (LinphoneCallParams *params, int value) { GET_MEDIA_CPP_PRIVATE_PTR(params)->setDownBandwidth(value); } -int linphone_call_params_get_up_bandwidth(const LinphoneCallParams *params) { +int linphone_call_params_get_up_bandwidth (const LinphoneCallParams *params) { return GET_MEDIA_CPP_PRIVATE_PTR(params)->getUpBandwidth(); } -void linphone_call_params_set_up_bandwidth(LinphoneCallParams *params, int value) { +void linphone_call_params_set_up_bandwidth (LinphoneCallParams *params, int value) { GET_MEDIA_CPP_PRIVATE_PTR(params)->setUpBandwidth(value); } -int linphone_call_params_get_down_ptime(const LinphoneCallParams *params) { +int linphone_call_params_get_down_ptime (const LinphoneCallParams *params) { return GET_MEDIA_CPP_PRIVATE_PTR(params)->getDownPtime(); } -void linphone_call_params_set_down_ptime(LinphoneCallParams *params, int value) { +void linphone_call_params_set_down_ptime (LinphoneCallParams *params, int value) { GET_MEDIA_CPP_PRIVATE_PTR(params)->setDownPtime(value); } -int linphone_call_params_get_up_ptime(const LinphoneCallParams *params) { +int linphone_call_params_get_up_ptime (const LinphoneCallParams *params) { return GET_MEDIA_CPP_PRIVATE_PTR(params)->getUpPtime(); } -void linphone_call_params_set_up_ptime(LinphoneCallParams *params, int value) { +void linphone_call_params_set_up_ptime (LinphoneCallParams *params, int value) { GET_MEDIA_CPP_PRIVATE_PTR(params)->setUpPtime(value); } -SalCustomHeader * linphone_call_params_get_custom_headers(const LinphoneCallParams *params) { +SalCustomHeader *linphone_call_params_get_custom_headers (const LinphoneCallParams *params) { return GET_CALL_CPP_PRIVATE_PTR(params)->getCustomHeaders(); } -SalCustomSdpAttribute * linphone_call_params_get_custom_sdp_attributes(const LinphoneCallParams *params) { +SalCustomSdpAttribute *linphone_call_params_get_custom_sdp_attributes (const LinphoneCallParams *params) { return GET_MEDIA_CPP_PRIVATE_PTR(params)->getCustomSdpAttributes(); } -SalCustomSdpAttribute * linphone_call_params_get_custom_sdp_media_attributes(const LinphoneCallParams *params, LinphoneStreamType type) { +SalCustomSdpAttribute *linphone_call_params_get_custom_sdp_media_attributes (const LinphoneCallParams *params, LinphoneStreamType type) { return GET_MEDIA_CPP_PRIVATE_PTR(params)->getCustomSdpMediaAttributes(type); } -LinphoneCall * linphone_call_params_get_referer(const LinphoneCallParams *params) { +LinphoneCall *linphone_call_params_get_referer (const LinphoneCallParams *params) { return GET_CALL_CPP_PRIVATE_PTR(params)->getReferer(); } -void linphone_call_params_set_referer(LinphoneCallParams *params, LinphoneCall *referer) { +void linphone_call_params_set_referer (LinphoneCallParams *params, LinphoneCall *referer) { GET_CALL_CPP_PRIVATE_PTR(params)->setReferer(referer); } -bool_t linphone_call_params_get_update_call_when_ice_completed(const LinphoneCallParams *params) { +bool_t linphone_call_params_get_update_call_when_ice_completed (const LinphoneCallParams *params) { return GET_MEDIA_CPP_PRIVATE_PTR(params)->getUpdateCallWhenIceCompleted(); } -void linphone_call_params_set_update_call_when_ice_completed(LinphoneCallParams *params, bool_t value) { +void linphone_call_params_set_update_call_when_ice_completed (LinphoneCallParams *params, bool_t value) { GET_MEDIA_CPP_PRIVATE_PTR(params)->setUpdateCallWhenIceCompleted(value); } -void linphone_call_params_set_sent_vsize(LinphoneCallParams *params, MSVideoSize vsize) { +void linphone_call_params_set_sent_vsize (LinphoneCallParams *params, MSVideoSize vsize) { GET_MEDIA_CPP_PRIVATE_PTR(params)->setSentVideoDefinition(linphone_video_definition_new(vsize.width, vsize.height, nullptr)); } -void linphone_call_params_set_recv_vsize(LinphoneCallParams *params, MSVideoSize vsize) { +void linphone_call_params_set_recv_vsize (LinphoneCallParams *params, MSVideoSize vsize) { GET_MEDIA_CPP_PRIVATE_PTR(params)->setReceivedVideoDefinition(linphone_video_definition_new(vsize.width, vsize.height, nullptr)); } -void linphone_call_params_set_sent_video_definition(LinphoneCallParams *params, LinphoneVideoDefinition *vdef) { +void linphone_call_params_set_sent_video_definition (LinphoneCallParams *params, LinphoneVideoDefinition *vdef) { GET_MEDIA_CPP_PRIVATE_PTR(params)->setSentVideoDefinition(vdef); } -void linphone_call_params_set_received_video_definition(LinphoneCallParams *params, LinphoneVideoDefinition *vdef) { +void linphone_call_params_set_received_video_definition (LinphoneCallParams *params, LinphoneVideoDefinition *vdef) { GET_MEDIA_CPP_PRIVATE_PTR(params)->setReceivedVideoDefinition(vdef); } -bool_t linphone_call_params_get_no_user_consent(const LinphoneCallParams *params) { +bool_t linphone_call_params_get_no_user_consent (const LinphoneCallParams *params) { return GET_CALL_CPP_PRIVATE_PTR(params)->getNoUserConsent(); } -void linphone_call_params_set_no_user_consent(LinphoneCallParams *params, bool_t value) { +void linphone_call_params_set_no_user_consent (LinphoneCallParams *params, bool_t value) { GET_CALL_CPP_PRIVATE_PTR(params)->setNoUserConsent(value); } +// ============================================================================= +// Reference and user data handling functions. +// ============================================================================= -/******************************************************************************* - * Reference and user data handling functions * - ******************************************************************************/ - -void * linphone_call_params_get_user_data(const LinphoneCallParams *cp) { +void *linphone_call_params_get_user_data (const LinphoneCallParams *cp) { return L_GET_USER_DATA_FROM_C_STRUCT(cp, MediaSessionParams, CallParams); } -void linphone_call_params_set_user_data(LinphoneCallParams *cp, void *ud) { +void linphone_call_params_set_user_data (LinphoneCallParams *cp, void *ud) { L_SET_USER_DATA_FROM_C_STRUCT(cp, ud, MediaSessionParams, CallParams); } -LinphoneCallParams * linphone_call_params_ref(LinphoneCallParams *cp) { +LinphoneCallParams *linphone_call_params_ref (LinphoneCallParams *cp) { belle_sip_object_ref(cp); return cp; } -void linphone_call_params_unref(LinphoneCallParams *cp) { +void linphone_call_params_unref (LinphoneCallParams *cp) { belle_sip_object_unref(cp); } +// ============================================================================= +// Constructor and destructor functions. +// ============================================================================= -/******************************************************************************* - * Constructor and destructor functions * - ******************************************************************************/ - -LinphoneCallParams * linphone_call_params_new(LinphoneCore *core) { +LinphoneCallParams *linphone_call_params_new (LinphoneCore *core) { LinphoneCallParams *params = _linphone_call_params_init(); L_SET_CPP_PTR_FROM_C_STRUCT(params, new LinphonePrivate::MediaSessionParams()); GET_MEDIA_CPP_PTR(params)->initDefault(core); return params; } -LinphoneCallParams * linphone_call_params_new_for_wrapper(void) { +LinphoneCallParams *linphone_call_params_new_for_wrapper (void) { return _linphone_call_params_init(); } /* DEPRECATED */ -void linphone_call_params_destroy(LinphoneCallParams *cp) { +void linphone_call_params_destroy (LinphoneCallParams *cp) { linphone_call_params_unref(cp); } diff --git a/src/c-wrapper/api/c-chat-message.cpp b/src/c-wrapper/api/c-chat-message.cpp index 265222519..67d14f173 100644 --- a/src/c-wrapper/api/c-chat-message.cpp +++ b/src/c-wrapper/api/c-chat-message.cpp @@ -16,37 +16,40 @@ * along with this program. If not, see . */ +#include "linphone/chat.h" +#include "linphone/wrapper_utils.h" - #include "linphone/chat.h" - #include "linphone/wrapper_utils.h" - #include "private.h" - - #include "c-wrapper/c-tools.h" - #include "chat/chat-message.h" - #include "chat/chat-message-p.h" - - using namespace std; - - #define GET_CPP_PTR(obj) L_GET_CPP_PTR_FROM_C_STRUCT(obj, ChatMessage, ChatMessage) - #define GET_CPP_PRIVATE_PTR(obj) L_GET_PRIVATE_FROM_C_STRUCT(obj, ChatMessage, ChatMessage) +// TODO: Remove me later. +#include "private.h" - /******************************************************************************* - * Reference and user data handling functions * - ******************************************************************************/ +#include "c-wrapper/c-tools.h" +#include "chat/chat-message.h" +#include "chat/chat-message-p.h" -LinphoneChatMessage *linphone_chat_message_ref(LinphoneChatMessage *msg) { +// ============================================================================= + +#define GET_CPP_PTR(obj) L_GET_CPP_PTR_FROM_C_STRUCT(obj, ChatMessage, ChatMessage) +#define GET_CPP_PRIVATE_PTR(obj) L_GET_PRIVATE_FROM_C_STRUCT(obj, ChatMessage, ChatMessage) + +using namespace std; + +// ============================================================================= +// Reference and user data handling functions. +// ============================================================================= + +LinphoneChatMessage *linphone_chat_message_ref (LinphoneChatMessage *msg) { belle_sip_object_ref(msg); return msg; } -void linphone_chat_message_unref(LinphoneChatMessage *msg) { +void linphone_chat_message_unref (LinphoneChatMessage *msg) { belle_sip_object_unref(msg); } -void * linphone_chat_message_get_user_data(const LinphoneChatMessage *msg) { +void * linphone_chat_message_get_user_data (const LinphoneChatMessage *msg) { return L_GET_USER_DATA_FROM_C_STRUCT(msg, ChatMessage, ChatMessage); } -void linphone_chat_message_set_user_data(LinphoneChatMessage *msg, void *ud) { +void linphone_chat_message_set_user_data (LinphoneChatMessage *msg, void *ud) { L_SET_USER_DATA_FROM_C_STRUCT(msg, ud, ChatMessage, ChatMessage); -} \ No newline at end of file +} diff --git a/src/c-wrapper/api/c-chat-room-cbs.cpp b/src/c-wrapper/api/c-chat-room-cbs.cpp index 2e1dd09e2..04adfabee 100644 --- a/src/c-wrapper/api/c-chat-room-cbs.cpp +++ b/src/c-wrapper/api/c-chat-room-cbs.cpp @@ -16,10 +16,12 @@ * along with this program. If not, see . */ - #include "linphone/api/c-chat-room-cbs.h" + +// TODO: Remove me later. #include "private.h" +// ============================================================================= struct _LinphoneChatRoomCbs { belle_sip_object_t base; @@ -41,6 +43,8 @@ BELLE_SIP_INSTANCIATE_VPTR(LinphoneChatRoomCbs, belle_sip_object_t, FALSE ); +// ============================================================================= + LinphoneChatRoomCbs * linphone_chat_room_cbs_new (void) { return belle_sip_object_new(LinphoneChatRoomCbs); } diff --git a/src/c-wrapper/api/c-chat-room.cpp b/src/c-wrapper/api/c-chat-room.cpp index ffe36c6cc..41822299f 100644 --- a/src/c-wrapper/api/c-chat-room.cpp +++ b/src/c-wrapper/api/c-chat-room.cpp @@ -16,41 +16,43 @@ * along with this program. If not, see . */ - #include "linphone/chat.h" #include "linphone/wrapper_utils.h" + +// TODO: Remove me later. #include "private.h" #include "c-wrapper/c-tools.h" #include "chat/basic-chat-room.h" -#include "chat/chat-room.h" #include "chat/chat-room-p.h" +#include "chat/chat-room.h" #include "chat/client-group-chat-room.h" -#include "chat/real-time-text-chat-room.h" #include "chat/real-time-text-chat-room-p.h" +#include "chat/real-time-text-chat-room.h" -using namespace std; +// ============================================================================= #define GET_CPP_PTR(obj) L_GET_CPP_PTR_FROM_C_STRUCT(obj, ChatRoom, ChatRoom) #define GET_CPP_PRIVATE_PTR(obj) L_GET_PRIVATE_FROM_C_STRUCT(obj, ChatRoom, ChatRoom) +using namespace std; -extern LinphoneParticipant * _linphone_participant_init(); +extern LinphoneParticipant *_linphone_participant_init (); -static void _linphone_chat_room_constructor(LinphoneChatRoom *cr); -static void _linphone_chat_room_destructor(LinphoneChatRoom *cr); +static void _linphone_chat_room_constructor (LinphoneChatRoom *cr); +static void _linphone_chat_room_destructor (LinphoneChatRoom *cr); L_DECLARE_C_STRUCT_IMPL_WITH_XTORS(ChatRoom, ChatRoom, chat_room, _linphone_chat_room_constructor, _linphone_chat_room_destructor, - LinphoneChatRoomCbs *cbs; + LinphoneChatRoomCbs * cbs; LinphoneAddress *peerAddressCache; ) -static void _linphone_chat_room_constructor(LinphoneChatRoom *cr) { +static void _linphone_chat_room_constructor (LinphoneChatRoom *cr) { cr->cbs = linphone_chat_room_cbs_new(); } -static void _linphone_chat_room_destructor(LinphoneChatRoom *cr) { +static void _linphone_chat_room_destructor (LinphoneChatRoom *cr) { linphone_chat_room_cbs_unref(cr->cbs); cr->cbs = nullptr; if (cr->peerAddressCache) { @@ -59,36 +61,35 @@ static void _linphone_chat_room_destructor(LinphoneChatRoom *cr) { } } +// ============================================================================= +// Public functions. +// ============================================================================= -/******************************************************************************* - * Public functions * - ******************************************************************************/ - -void linphone_chat_room_release(LinphoneChatRoom *cr) { +void linphone_chat_room_release (LinphoneChatRoom *cr) { GET_CPP_PRIVATE_PTR(cr)->release(); } -void linphone_chat_room_remove_transient_message(LinphoneChatRoom *cr, LinphoneChatMessage *msg) { +void linphone_chat_room_remove_transient_message (LinphoneChatRoom *cr, LinphoneChatMessage *msg) { GET_CPP_PRIVATE_PTR(cr)->removeTransientMessage(msg); } -void linphone_chat_room_send_message(LinphoneChatRoom *cr, const char *msg) { +void linphone_chat_room_send_message (LinphoneChatRoom *cr, const char *msg) { GET_CPP_PTR(cr)->sendMessage(GET_CPP_PTR(cr)->createMessage(msg)); } -bool_t linphone_chat_room_is_remote_composing(const LinphoneChatRoom *cr) { +bool_t linphone_chat_room_is_remote_composing (const LinphoneChatRoom *cr) { return GET_CPP_PTR(cr)->isRemoteComposing(); } -LinphoneCore *linphone_chat_room_get_lc(const LinphoneChatRoom *cr) { +LinphoneCore *linphone_chat_room_get_lc (const LinphoneChatRoom *cr) { return linphone_chat_room_get_core(cr); } -LinphoneCore *linphone_chat_room_get_core(const LinphoneChatRoom *cr) { +LinphoneCore *linphone_chat_room_get_core (const LinphoneChatRoom *cr) { return GET_CPP_PTR(cr)->getCore(); } -const LinphoneAddress *linphone_chat_room_get_peer_address(LinphoneChatRoom *cr) { +const LinphoneAddress *linphone_chat_room_get_peer_address (LinphoneChatRoom *cr) { if (cr->peerAddressCache) { linphone_address_unref(cr->peerAddressCache); } @@ -96,13 +97,19 @@ const LinphoneAddress *linphone_chat_room_get_peer_address(LinphoneChatRoom *cr) return cr->peerAddressCache; } -LinphoneChatMessage *linphone_chat_room_create_message(LinphoneChatRoom *cr, const char *message) { +LinphoneChatMessage *linphone_chat_room_create_message (LinphoneChatRoom *cr, const char *message) { return GET_CPP_PTR(cr)->createMessage(message ? message : ""); } -LinphoneChatMessage *linphone_chat_room_create_message_2(LinphoneChatRoom *cr, const char *message, - const char *external_body_url, LinphoneChatMessageState state, - time_t time, bool_t is_read, bool_t is_incoming) { +LinphoneChatMessage *linphone_chat_room_create_message_2 ( + LinphoneChatRoom *cr, + const char *message, + const char *external_body_url, + LinphoneChatMessageState state, + time_t time, + bool_t is_read, + bool_t is_incoming +) { LinphoneChatMessage *msg = linphone_chat_room_create_message(cr, message); LinphoneCore *lc = linphone_chat_room_get_core(cr); msg->external_body_url = external_body_url ? ms_strdup(external_body_url) : NULL; @@ -116,91 +123,95 @@ LinphoneChatMessage *linphone_chat_room_create_message_2(LinphoneChatRoom *cr, c } else { msg->dir = LinphoneChatMessageOutgoing; linphone_chat_message_set_to(msg, linphone_chat_room_get_peer_address(cr)); - msg->from = linphone_address_new(linphone_core_get_identity(lc));/*direct assignment*/ + msg->from = linphone_address_new(linphone_core_get_identity(lc)); /*direct assignment*/ } return msg; } -void linphone_chat_room_send_message2(LinphoneChatRoom *cr, LinphoneChatMessage *msg, - LinphoneChatMessageStateChangedCb status_cb, void *ud) { +void linphone_chat_room_send_message2 ( + LinphoneChatRoom *cr, + LinphoneChatMessage *msg, + LinphoneChatMessageStateChangedCb status_cb, + void *ud +) { msg->message_state_changed_cb = status_cb; msg->message_state_changed_user_data = ud; GET_CPP_PTR(cr)->sendMessage(msg); } -void linphone_chat_room_send_chat_message_2(LinphoneChatRoom *cr, LinphoneChatMessage *msg) { +void linphone_chat_room_send_chat_message_2 (LinphoneChatRoom *cr, LinphoneChatMessage *msg) { linphone_chat_message_ref(msg); GET_CPP_PTR(cr)->sendMessage(msg); } -void linphone_chat_room_send_chat_message(LinphoneChatRoom *cr, LinphoneChatMessage *msg) { +void linphone_chat_room_send_chat_message (LinphoneChatRoom *cr, LinphoneChatMessage *msg) { GET_CPP_PTR(cr)->sendMessage(msg); } -uint32_t linphone_chat_room_get_char(const LinphoneChatRoom *cr) { +uint32_t linphone_chat_room_get_char (const LinphoneChatRoom *cr) { if (linphone_core_realtime_text_enabled(linphone_chat_room_get_core(cr))) return static_cast(GET_CPP_PTR(cr).get())->getChar(); return 0; } -void linphone_chat_room_compose(LinphoneChatRoom *cr) { +void linphone_chat_room_compose (LinphoneChatRoom *cr) { GET_CPP_PTR(cr)->compose(); } -LinphoneCall *linphone_chat_room_get_call(const LinphoneChatRoom *cr) { +LinphoneCall *linphone_chat_room_get_call (const LinphoneChatRoom *cr) { if (linphone_core_realtime_text_enabled(linphone_chat_room_get_core(cr))) return static_cast(GET_CPP_PTR(cr).get())->getCall(); return nullptr; } -void linphone_chat_room_set_call(LinphoneChatRoom *cr, LinphoneCall *call) { +void linphone_chat_room_set_call (LinphoneChatRoom *cr, LinphoneCall *call) { if (linphone_core_realtime_text_enabled(linphone_chat_room_get_core(cr))) static_cast(GET_CPP_PRIVATE_PTR(cr))->setCall(call); } -bctbx_list_t * linphone_chat_room_get_transient_messages(const LinphoneChatRoom *cr) { +bctbx_list_t *linphone_chat_room_get_transient_messages (const LinphoneChatRoom *cr) { return L_GET_C_LIST_FROM_CPP_LIST(GET_CPP_PRIVATE_PTR(cr)->getTransientMessages(), LinphoneChatMessage); } -void linphone_chat_room_mark_as_read(LinphoneChatRoom *cr) { +void linphone_chat_room_mark_as_read (LinphoneChatRoom *cr) { GET_CPP_PTR(cr)->markAsRead(); } -int linphone_chat_room_get_unread_messages_count(LinphoneChatRoom *cr) { +int linphone_chat_room_get_unread_messages_count (LinphoneChatRoom *cr) { return GET_CPP_PTR(cr)->getUnreadMessagesCount(); } -int linphone_chat_room_get_history_size(LinphoneChatRoom *cr) { +int linphone_chat_room_get_history_size (LinphoneChatRoom *cr) { return GET_CPP_PTR(cr)->getHistorySize(); } -void linphone_chat_room_delete_message(LinphoneChatRoom *cr, LinphoneChatMessage *msg) { +void linphone_chat_room_delete_message (LinphoneChatRoom *cr, LinphoneChatMessage *msg) { GET_CPP_PTR(cr)->deleteMessage(msg); } -void linphone_chat_room_delete_history(LinphoneChatRoom *cr) { +void linphone_chat_room_delete_history (LinphoneChatRoom *cr) { GET_CPP_PTR(cr)->deleteHistory(); } -bctbx_list_t *linphone_chat_room_get_history_range(LinphoneChatRoom *cr, int startm, int endm) { +bctbx_list_t *linphone_chat_room_get_history_range (LinphoneChatRoom *cr, int startm, int endm) { return L_GET_C_LIST_FROM_CPP_LIST(GET_CPP_PTR(cr)->getHistoryRange(startm, endm), LinphoneChatMessage); } -bctbx_list_t *linphone_chat_room_get_history(LinphoneChatRoom *cr, int nb_message) { +bctbx_list_t *linphone_chat_room_get_history (LinphoneChatRoom *cr, int nb_message) { return L_GET_C_LIST_FROM_CPP_LIST(GET_CPP_PTR(cr)->getHistory(nb_message), LinphoneChatMessage); } -LinphoneChatMessage * linphone_chat_room_find_message(LinphoneChatRoom *cr, const char *message_id) { +LinphoneChatMessage *linphone_chat_room_find_message (LinphoneChatRoom *cr, const char *message_id) { return GET_CPP_PTR(cr)->findMessage(message_id); } -LinphoneChatRoomCbs * linphone_chat_room_get_callbacks (const LinphoneChatRoom *cr) { +LinphoneChatRoomCbs *linphone_chat_room_get_callbacks (const LinphoneChatRoom *cr) { return cr->cbs; } -LinphoneParticipant * linphone_chat_room_add_participant (LinphoneChatRoom *cr, const LinphoneAddress *addr) { +LinphoneParticipant *linphone_chat_room_add_participant (LinphoneChatRoom *cr, const LinphoneAddress *addr) { return L_GET_C_BACK_PTR(GET_CPP_PTR(cr)->addParticipant( - *L_GET_CPP_PTR_FROM_C_STRUCT(addr, Address, Address), nullptr, false), + *L_GET_CPP_PTR_FROM_C_STRUCT(addr, Address, Address), nullptr, false), Participant, participant); } @@ -212,7 +223,7 @@ bool_t linphone_chat_room_can_handle_participants (const LinphoneChatRoom *cr) { return GET_CPP_PTR(cr)->canHandleParticipants(); } -const char * linphone_chat_room_get_id (const LinphoneChatRoom *cr) { +const char *linphone_chat_room_get_id (const LinphoneChatRoom *cr) { string id = GET_CPP_PTR(cr)->getId(); return id.empty() ? nullptr : id.c_str(); } @@ -221,7 +232,7 @@ int linphone_chat_room_get_nb_participants (const LinphoneChatRoom *cr) { return GET_CPP_PTR(cr)->getNbParticipants(); } -bctbx_list_t * linphone_chat_room_get_participants (const LinphoneChatRoom *cr) { +bctbx_list_t *linphone_chat_room_get_participants (const LinphoneChatRoom *cr) { return L_GET_C_LIST_OF_STRUCT_PTR_FROM_CPP_LIST_OF_CPP_OBJ(GET_CPP_PTR(cr)->getParticipants(), Participant, Participant, participant); } @@ -233,34 +244,32 @@ void linphone_chat_room_remove_participants (LinphoneChatRoom *cr, const bctbx_l GET_CPP_PTR(cr)->removeParticipants(L_GET_CPP_LIST_OF_CPP_OBJ_FROM_C_LIST_OF_STRUCT_PTR(participants, Participant, Participant)); } +// ============================================================================= +// Reference and user data handling functions. +// ============================================================================= -/******************************************************************************* - * Reference and user data handling functions * - ******************************************************************************/ - -LinphoneChatRoom *linphone_chat_room_ref(LinphoneChatRoom *cr) { +LinphoneChatRoom *linphone_chat_room_ref (LinphoneChatRoom *cr) { belle_sip_object_ref(cr); return cr; } -void linphone_chat_room_unref(LinphoneChatRoom *cr) { +void linphone_chat_room_unref (LinphoneChatRoom *cr) { belle_sip_object_unref(cr); } -void * linphone_chat_room_get_user_data(const LinphoneChatRoom *cr) { +void *linphone_chat_room_get_user_data (const LinphoneChatRoom *cr) { return L_GET_USER_DATA_FROM_C_STRUCT(cr, ChatRoom, ChatRoom); } -void linphone_chat_room_set_user_data(LinphoneChatRoom *cr, void *ud) { +void linphone_chat_room_set_user_data (LinphoneChatRoom *cr, void *ud) { L_SET_USER_DATA_FROM_C_STRUCT(cr, ud, ChatRoom, ChatRoom); } +// ============================================================================= +// Constructor and destructor functions. +// ============================================================================= -/******************************************************************************* - * Constructor and destructor functions * - ******************************************************************************/ - -LinphoneChatRoom * linphone_chat_room_new(LinphoneCore *core, const LinphoneAddress *addr) { +LinphoneChatRoom *linphone_chat_room_new (LinphoneCore *core, const LinphoneAddress *addr) { LinphoneChatRoom *cr = _linphone_chat_room_init(); if (linphone_core_realtime_text_enabled(core)) L_SET_CPP_PTR_FROM_C_STRUCT(cr, std::make_shared(core, *L_GET_CPP_PTR_FROM_C_STRUCT(addr, Address, Address))); @@ -272,7 +281,7 @@ LinphoneChatRoom * linphone_chat_room_new(LinphoneCore *core, const LinphoneAddr return cr; } -LinphoneChatRoom * linphone_client_group_chat_room_new(LinphoneCore *core, const bctbx_list_t *addresses) { +LinphoneChatRoom *linphone_client_group_chat_room_new (LinphoneCore *core, const bctbx_list_t *addresses) { const char *factoryUri = linphone_core_get_chat_conference_factory_uri(core); if (!factoryUri) return nullptr; @@ -295,6 +304,6 @@ LinphoneChatRoom * linphone_client_group_chat_room_new(LinphoneCore *core, const } /* DEPRECATED */ -void linphone_chat_room_destroy(LinphoneChatRoom *cr) { +void linphone_chat_room_destroy (LinphoneChatRoom *cr) { linphone_chat_room_unref(cr); } diff --git a/src/c-wrapper/api/c-event-log.cpp b/src/c-wrapper/api/c-event-log.cpp index 6cb14499c..8c021be21 100644 --- a/src/c-wrapper/api/c-event-log.cpp +++ b/src/c-wrapper/api/c-event-log.cpp @@ -19,7 +19,6 @@ #include "linphone/api/c-event-log.h" #include "c-wrapper/c-tools.h" - #include "event-log/call-event.h" #include "event-log/conference-participant-event.h" #include "event-log/message-event.h" diff --git a/src/c-wrapper/api/c-participant.cpp b/src/c-wrapper/api/c-participant.cpp index d4d787183..e91677e18 100644 --- a/src/c-wrapper/api/c-participant.cpp +++ b/src/c-wrapper/api/c-participant.cpp @@ -19,7 +19,6 @@ #include "linphone/api/c-participant.h" #include "c-wrapper/c-tools.h" - #include "conference/participant.h" // ============================================================================= @@ -39,7 +38,7 @@ void linphone_participant_unref (LinphoneParticipant *participant) { belle_sip_object_unref(participant); } -void * linphone_participant_get_user_data(const LinphoneParticipant *participant) { +void *linphone_participant_get_user_data(const LinphoneParticipant *participant) { return L_GET_USER_DATA_FROM_C_STRUCT(participant, Participant, Participant); } @@ -47,7 +46,7 @@ void linphone_participant_set_user_data(LinphoneParticipant *participant, void * L_SET_USER_DATA_FROM_C_STRUCT(participant, ud, Participant, Participant); } -const LinphoneAddress * linphone_participant_get_address (const LinphoneParticipant *participant) { +const LinphoneAddress *linphone_participant_get_address (const LinphoneParticipant *participant) { LinphonePrivate::Address addr = L_GET_CPP_PTR_FROM_C_STRUCT(participant, Participant, Participant)->getAddress(); if (participant->addressCache) linphone_address_unref(participant->addressCache); diff --git a/src/c-wrapper/c-tools.h b/src/c-wrapper/c-tools.h index 1197e201a..1ec204c15 100644 --- a/src/c-wrapper/c-tools.h +++ b/src/c-wrapper/c-tools.h @@ -22,11 +22,11 @@ #include #include -#include "variant/variant.h" - -// From coreapi. +// TODO: From coreapi. Remove me later. #include "private.h" +#include "variant/variant.h" + // ============================================================================= LINPHONE_BEGIN_NAMESPACE