Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
BC
public
liblinphone
Commits
78646be7
Commit
78646be7
authored
Sep 22, 2017
by
Ronan
Browse files
feat(c-wrapper): rename C_STRUCT to C_OBJECT
parent
c73614b8
Changes
16
Hide whitespace changes
Inline
Side-by-side
coreapi/callbacks.c
View file @
78646be7
...
...
@@ -169,7 +169,7 @@ static void call_received(SalOp *h) {
LinphoneCall
*
call
=
linphone_call_new_incoming
(
lc
,
fromAddr
,
toAddr
,
h
);
linphone_address_unref
(
fromAddr
);
linphone_address_unref
(
toAddr
);
L_GET_PRIVATE_FROM_C_
STRU
CT
(
call
,
Call
)
->
startIncomingNotification
();
L_GET_PRIVATE_FROM_C_
OBJE
CT
(
call
,
Call
)
->
startIncomingNotification
();
}
static
void
call_rejected
(
SalOp
*
h
){
...
...
coreapi/chat.c
View file @
78646be7
...
...
@@ -80,7 +80,7 @@ static LinphoneChatRoom *_linphone_core_create_chat_room_from_url(LinphoneCore *
}
static
bool_t
linphone_chat_room_matches
(
LinphoneChatRoom
*
cr
,
const
LinphoneAddress
*
from
)
{
LinphoneAddress
*
addr
=
linphone_address_new
(
L_GET_CPP_PTR_FROM_C_
STRU
CT
(
cr
)
->
getPeerAddress
().
asString
().
c_str
());
LinphoneAddress
*
addr
=
linphone_address_new
(
L_GET_CPP_PTR_FROM_C_
OBJE
CT
(
cr
)
->
getPeerAddress
().
asString
().
c_str
());
bool_t
result
=
linphone_address_weak_equal
(
addr
,
from
);
linphone_address_unref
(
addr
);
return
result
;
...
...
@@ -225,7 +225,7 @@ int linphone_core_message_received(LinphoneCore *lc, SalOp *op, const SalMessage
LinphoneAddress
*
addr
=
linphone_address_new
(
sal_msg
->
from
);
linphone_address_clean
(
addr
);
LinphoneChatRoom
*
cr
=
linphone_core_get_chat_room
(
lc
,
addr
);
LinphoneReason
reason
=
L_GET_PRIVATE_FROM_C_
STRU
CT
(
cr
,
ChatRoom
)
->
messageReceived
(
op
,
sal_msg
);
LinphoneReason
reason
=
L_GET_PRIVATE_FROM_C_
OBJE
CT
(
cr
,
ChatRoom
)
->
messageReceived
(
op
,
sal_msg
);
linphone_address_unref
(
addr
);
return
reason
;
}
...
...
@@ -235,8 +235,8 @@ int linphone_core_message_received(LinphoneCore *lc, SalOp *op, const SalMessage
void
linphone_core_real_time_text_received
(
LinphoneCore
*
lc
,
LinphoneChatRoom
*
cr
,
uint32_t
character
,
LinphoneCall
*
call
)
{
if
(
linphone_core_realtime_text_enabled
(
lc
))
{
std
::
shared_ptr
<
LinphonePrivate
::
RealTimeTextChatRoom
>
rttcr
=
std
::
static_pointer_cast
<
LinphonePrivate
::
RealTimeTextChatRoom
>
(
L_GET_CPP_PTR_FROM_C_
STRU
CT
(
cr
));
std
::
static_pointer_cast
<
LinphonePrivate
::
RealTimeTextChatRoom
>
(
L_GET_CPP_PTR_FROM_C_
OBJE
CT
(
cr
));
L_GET_PRIVATE
(
rttcr
)
->
realtimeTextReceived
(
character
,
call
);
//L_GET_PRIVATE(std::static_pointer_cast<LinphonePrivate::RealTimeTextChatRoom>(L_GET_CPP_PTR_FROM_C_
STRU
CT(cr)))->realtimeTextReceived(character, call);
//L_GET_PRIVATE(std::static_pointer_cast<LinphonePrivate::RealTimeTextChatRoom>(L_GET_CPP_PTR_FROM_C_
OBJE
CT(cr)))->realtimeTextReceived(character, call);
}
}
coreapi/chat_file_transfer.c
View file @
78646be7
...
...
@@ -29,5 +29,5 @@
#include "chat/chat-room.h"
LinphoneChatMessage
*
linphone_chat_room_create_file_transfer_message
(
LinphoneChatRoom
*
cr
,
const
LinphoneContent
*
initial_content
)
{
return
L_GET_CPP_PTR_FROM_C_
STRU
CT
(
cr
)
->
createFileTransferMessage
(
initial_content
);
return
L_GET_CPP_PTR_FROM_C_
OBJE
CT
(
cr
)
->
createFileTransferMessage
(
initial_content
);
}
coreapi/linphonecore.c
View file @
78646be7
...
...
@@ -3205,7 +3205,7 @@ void linphone_core_iterate(LinphoneCore *lc){
/* Get immediately a reference to next one in case the one we are going to examine is destroyed
* and removed during linphone_call_start_invite() */
calls
=
bctbx_list_next
(
calls
);
L_GET_PRIVATE_FROM_C_
STRU
CT
(
call
,
Call
)
->
iterate
(
current_real_time
,
one_second_elapsed
);
L_GET_PRIVATE_FROM_C_
OBJE
CT
(
call
,
Call
)
->
iterate
(
current_real_time
,
one_second_elapsed
);
}
if
(
linphone_core_video_preview_enabled
(
lc
)){
...
...
@@ -3341,7 +3341,7 @@ static bctbx_list_t *make_routes_for_proxy(LinphoneProxyConfig *proxy, const Lin
ret
=
bctbx_list_append
(
ret
,
sal_address_new
(
local_route
));
}
if
(
srv_route
){
ret
=
bctbx_list_append
(
ret
,
sal_address_clone
(
L_GET_PRIVATE_FROM_C_
STRU
CT
(
srv_route
,
Address
)
->
getInternalAddress
()));
ret
=
bctbx_list_append
(
ret
,
sal_address_clone
(
L_GET_PRIVATE_FROM_C_
OBJE
CT
(
srv_route
,
Address
)
->
getInternalAddress
()));
}
if
(
ret
==
NULL
){
/*if the proxy address matches the domain part of the destination, then use the same transport
...
...
@@ -3530,9 +3530,9 @@ LinphoneCall * linphone_core_invite_address_with_params(LinphoneCore *lc, const
if (linphone_call_params_get_local_conference_mode(params) == FALSE)
#endif
lc
->
current_call
=
call
;
bool
defer
=
L_GET_PRIVATE_FROM_C_
STRU
CT
(
call
,
Call
)
->
initiateOutgoing
();
bool
defer
=
L_GET_PRIVATE_FROM_C_
OBJE
CT
(
call
,
Call
)
->
initiateOutgoing
();
if
(
!
defer
)
{
if
(
L_GET_PRIVATE_FROM_C_
STRU
CT
(
call
,
Call
)
->
startInvite
(
nullptr
)
!=
0
)
{
if
(
L_GET_PRIVATE_FROM_C_
OBJE
CT
(
call
,
Call
)
->
startInvite
(
nullptr
)
!=
0
)
{
/* The call has already gone to error and released state, so do not return it */
call
=
nullptr
;
}
...
...
@@ -6653,7 +6653,7 @@ void linphone_core_set_media_encryption_mandatory(LinphoneCore *lc, bool_t m) {
}
void
linphone_core_init_default_params
(
LinphoneCore
*
lc
,
LinphoneCallParams
*
params
)
{
L_GET_CPP_PTR_FROM_C_
STRU
CT
(
params
)
->
initDefault
(
lc
);
L_GET_CPP_PTR_FROM_C_
OBJE
CT
(
params
)
->
initDefault
(
lc
);
}
void
linphone_core_set_device_identifier
(
LinphoneCore
*
lc
,
const
char
*
device_id
)
{
...
...
coreapi/proxy.c
View file @
78646be7
...
...
@@ -492,7 +492,7 @@ static void linphone_proxy_config_register(LinphoneProxyConfig *cfg){
linphone_configure_op
(
cfg
->
lc
,
cfg
->
op
,
cfg
->
identity_address
,
cfg
->
sent_headers
,
FALSE
);
if
((
contact
=
guess_contact_for_register
(
cfg
)))
{
sal_op_set_contact_address
(
cfg
->
op
,
L_GET_PRIVATE_FROM_C_
STRU
CT
(
contact
,
Address
)
->
getInternalAddress
());
sal_op_set_contact_address
(
cfg
->
op
,
L_GET_PRIVATE_FROM_C_
OBJE
CT
(
contact
,
Address
)
->
getInternalAddress
());
linphone_address_unref
(
contact
);
}
...
...
@@ -503,7 +503,7 @@ static void linphone_proxy_config_register(LinphoneProxyConfig *cfg){
proxy_string
,
cfg
->
reg_identity
,
cfg
->
expires
,
cfg
->
pending_contact
?
L_GET_PRIVATE_FROM_C_
STRU
CT
(
cfg
->
pending_contact
,
Address
)
->
getInternalAddress
()
:
NULL
cfg
->
pending_contact
?
L_GET_PRIVATE_FROM_C_
OBJE
CT
(
cfg
->
pending_contact
,
Address
)
->
getInternalAddress
()
:
NULL
)
==
0
)
{
if
(
cfg
->
pending_contact
)
{
linphone_address_unref
(
cfg
->
pending_contact
);
...
...
@@ -1364,7 +1364,7 @@ const char* linphone_proxy_config_get_transport(const LinphoneProxyConfig *cfg)
bool_t
destroy_route_addr
=
FALSE
;
if
(
linphone_proxy_config_get_service_route
(
cfg
))
{
route_addr
=
L_GET_PRIVATE_FROM_C_
STRU
CT
(
linphone_proxy_config_get_service_route
(
cfg
),
Address
)
->
getInternalAddress
();
route_addr
=
L_GET_PRIVATE_FROM_C_
OBJE
CT
(
linphone_proxy_config_get_service_route
(
cfg
),
Address
)
->
getInternalAddress
();
}
else
if
(
linphone_proxy_config_get_route
(
cfg
))
{
addr
=
linphone_proxy_config_get_route
(
cfg
);
}
else
if
(
linphone_proxy_config_get_addr
(
cfg
))
{
...
...
coreapi/quality_reporting.c
View file @
78646be7
...
...
@@ -380,7 +380,7 @@ static int send_report(LinphoneCall* call, reporting_session_report_t * report,
* (port, transport, maddr), then it is sent directly.
* Otherwise it is routed as any LinphoneEvent publish, following proxy config policy.
**/
salAddress = L_GET_PRIVATE_FROM_C_
STRU
CT(request_uri, Address)->getInternalAddress();
salAddress = L_GET_PRIVATE_FROM_C_
OBJE
CT(request_uri, Address)->getInternalAddress();
if (sal_address_has_uri_param(salAddress, "transport") ||
sal_address_has_uri_param(salAddress, "maddr") ||
linphone_address_get_port(request_uri) != 0) {
...
...
src/c-wrapper/api/c-call-params.cpp
View file @
78646be7
...
...
@@ -22,8 +22,8 @@
// =============================================================================
#define GET_MEDIA_CPP_PTR(obj) L_GET_CPP_PTR_FROM_C_
STRU
CT(obj)
#define GET_MEDIA_CPP_PRIVATE_PTR(obj) L_GET_PRIVATE_FROM_C_
STRU
CT(obj, MediaSessionParams)
#define GET_MEDIA_CPP_PTR(obj) L_GET_CPP_PTR_FROM_C_
OBJE
CT(obj)
#define GET_MEDIA_CPP_PRIVATE_PTR(obj) L_GET_PRIVATE_FROM_C_
OBJE
CT(obj, MediaSessionParams)
L_DECLARE_C_CLONABLE_STRUCT_IMPL
(
CallParams
)
...
...
@@ -485,11 +485,11 @@ void linphone_call_params_set_no_user_consent (LinphoneCallParams *params, bool_
// =============================================================================
void
*
linphone_call_params_get_user_data
(
const
LinphoneCallParams
*
cp
)
{
return
L_GET_USER_DATA_FROM_C_
STRU
CT
(
cp
,
MediaSessionParams
);
return
L_GET_USER_DATA_FROM_C_
OBJE
CT
(
cp
,
MediaSessionParams
);
}
void
linphone_call_params_set_user_data
(
LinphoneCallParams
*
cp
,
void
*
ud
)
{
L_SET_USER_DATA_FROM_C_
STRU
CT
(
cp
,
ud
,
MediaSessionParams
);
L_SET_USER_DATA_FROM_C_
OBJE
CT
(
cp
,
ud
,
MediaSessionParams
);
}
LinphoneCallParams
*
linphone_call_params_ref
(
LinphoneCallParams
*
cp
)
{
...
...
@@ -507,7 +507,7 @@ void linphone_call_params_unref (LinphoneCallParams *cp) {
LinphoneCallParams
*
linphone_call_params_new
(
LinphoneCore
*
core
)
{
LinphoneCallParams
*
params
=
_linphone_CallParams_init
();
L_SET_CPP_PTR_FROM_C_
STRU
CT
(
params
,
new
LinphonePrivate
::
MediaSessionParams
());
L_SET_CPP_PTR_FROM_C_
OBJE
CT
(
params
,
new
LinphonePrivate
::
MediaSessionParams
());
GET_MEDIA_CPP_PTR
(
params
)
->
initDefault
(
core
);
return
params
;
}
...
...
src/c-wrapper/api/c-call.cpp
View file @
78646be7
...
...
@@ -28,15 +28,15 @@
// =============================================================================
#define GET_CPP_PTR(obj) L_GET_CPP_PTR_FROM_C_
STRU
CT(obj)
#define GET_CPP_PRIVATE_PTR(obj) L_GET_PRIVATE_FROM_C_
STRU
CT(obj, Call)
#define GET_CPP_PTR(obj) L_GET_CPP_PTR_FROM_C_
OBJE
CT(obj)
#define GET_CPP_PRIVATE_PTR(obj) L_GET_PRIVATE_FROM_C_
OBJE
CT(obj, Call)
using
namespace
std
;
static
void
_linphone_call_constructor
(
LinphoneCall
*
call
);
static
void
_linphone_call_destructor
(
LinphoneCall
*
call
);
L_DECLARE_C_
STRU
CT_IMPL_WITH_XTORS
(
Call
,
L_DECLARE_C_
OBJE
CT_IMPL_WITH_XTORS
(
Call
,
_linphone_call_constructor
,
_linphone_call_destructor
,
bctbx_list_t
*
callbacks
;
/* A list of LinphoneCallCbs object */
LinphoneCallCbs
*
currentCbs
;
/* The current LinphoneCallCbs object used to call a callback */
...
...
@@ -601,7 +601,7 @@ bool_t linphone_call_asked_to_autoanswer (LinphoneCall *call) {
}
const
LinphoneAddress
*
linphone_call_get_remote_address
(
const
LinphoneCall
*
call
)
{
L_SET_CPP_PTR_FROM_C_
STRU
CT
(
call
->
remoteAddressCache
,
&
GET_CPP_PTR
(
call
)
->
getRemoteAddress
());
L_SET_CPP_PTR_FROM_C_
OBJE
CT
(
call
->
remoteAddressCache
,
&
GET_CPP_PTR
(
call
)
->
getRemoteAddress
());
return
call
->
remoteAddressCache
;
}
...
...
@@ -690,7 +690,7 @@ int linphone_call_get_duration (const LinphoneCall *call) {
}
const
LinphoneCallParams
*
linphone_call_get_current_params
(
LinphoneCall
*
call
)
{
L_SET_CPP_PTR_FROM_C_
STRU
CT
(
call
->
currentParamsCache
,
GET_CPP_PTR
(
call
)
->
getCurrentParams
());
L_SET_CPP_PTR_FROM_C_
OBJE
CT
(
call
->
currentParamsCache
,
GET_CPP_PTR
(
call
)
->
getCurrentParams
());
return
call
->
currentParamsCache
;
}
...
...
@@ -698,7 +698,7 @@ const LinphoneCallParams *linphone_call_get_remote_params(LinphoneCall *call) {
const
LinphonePrivate
::
MediaSessionParams
*
remoteParams
=
GET_CPP_PTR
(
call
)
->
getRemoteParams
();
if
(
!
remoteParams
)
return
nullptr
;
L_SET_CPP_PTR_FROM_C_
STRU
CT
(
call
->
remoteParamsCache
,
remoteParams
);
L_SET_CPP_PTR_FROM_C_
OBJE
CT
(
call
->
remoteParamsCache
,
remoteParams
);
return
call
->
remoteParamsCache
;
}
...
...
@@ -936,7 +936,7 @@ LinphoneStatus linphone_call_accept (LinphoneCall *call) {
}
LinphoneStatus
linphone_call_accept_with_params
(
LinphoneCall
*
call
,
const
LinphoneCallParams
*
params
)
{
return
GET_CPP_PTR
(
call
)
->
accept
(
params
?
L_GET_CPP_PTR_FROM_C_
STRU
CT
(
params
)
:
nullptr
);
return
GET_CPP_PTR
(
call
)
->
accept
(
params
?
L_GET_CPP_PTR_FROM_C_
OBJE
CT
(
params
)
:
nullptr
);
}
LinphoneStatus
linphone_call_accept_early_media
(
LinphoneCall
*
call
)
{
...
...
@@ -944,11 +944,11 @@ LinphoneStatus linphone_call_accept_early_media (LinphoneCall* call) {
}
LinphoneStatus
linphone_call_accept_early_media_with_params
(
LinphoneCall
*
call
,
const
LinphoneCallParams
*
params
)
{
return
GET_CPP_PTR
(
call
)
->
acceptEarlyMedia
(
params
?
L_GET_CPP_PTR_FROM_C_
STRU
CT
(
params
)
:
nullptr
);
return
GET_CPP_PTR
(
call
)
->
acceptEarlyMedia
(
params
?
L_GET_CPP_PTR_FROM_C_
OBJE
CT
(
params
)
:
nullptr
);
}
LinphoneStatus
linphone_call_update
(
LinphoneCall
*
call
,
const
LinphoneCallParams
*
params
)
{
return
GET_CPP_PTR
(
call
)
->
update
(
params
?
L_GET_CPP_PTR_FROM_C_
STRU
CT
(
params
)
:
nullptr
);
return
GET_CPP_PTR
(
call
)
->
update
(
params
?
L_GET_CPP_PTR_FROM_C_
OBJE
CT
(
params
)
:
nullptr
);
}
LinphoneStatus
linphone_call_defer_update
(
LinphoneCall
*
call
)
{
...
...
@@ -971,7 +971,7 @@ LinphoneStatus linphone_call_defer_update (LinphoneCall *call) {
}
LinphoneStatus
linphone_call_accept_update
(
LinphoneCall
*
call
,
const
LinphoneCallParams
*
params
)
{
return
GET_CPP_PTR
(
call
)
->
acceptUpdate
(
params
?
L_GET_CPP_PTR_FROM_C_
STRU
CT
(
params
)
:
nullptr
);
return
GET_CPP_PTR
(
call
)
->
acceptUpdate
(
params
?
L_GET_CPP_PTR_FROM_C_
OBJE
CT
(
params
)
:
nullptr
);
}
LinphoneStatus
linphone_call_transfer
(
LinphoneCall
*
call
,
const
char
*
refer_to
)
{
...
...
@@ -1156,7 +1156,7 @@ void linphone_call_set_params (LinphoneCall *call, const LinphoneCallParams *par
}
const
LinphoneCallParams
*
linphone_call_get_params
(
LinphoneCall
*
call
)
{
L_SET_CPP_PTR_FROM_C_
STRU
CT
(
call
->
paramsCache
,
GET_CPP_PTR
(
call
)
->
getParams
());
L_SET_CPP_PTR_FROM_C_
OBJE
CT
(
call
->
paramsCache
,
GET_CPP_PTR
(
call
)
->
getParams
());
return
call
->
paramsCache
;
}
...
...
@@ -1174,11 +1174,11 @@ void linphone_call_unref (LinphoneCall *call) {
}
void
*
linphone_call_get_user_data
(
const
LinphoneCall
*
call
)
{
return
L_GET_USER_DATA_FROM_C_
STRU
CT
(
call
,
Call
);
return
L_GET_USER_DATA_FROM_C_
OBJE
CT
(
call
,
Call
);
}
void
linphone_call_set_user_data
(
LinphoneCall
*
call
,
void
*
ud
)
{
L_SET_USER_DATA_FROM_C_
STRU
CT
(
call
,
ud
,
Call
);
L_SET_USER_DATA_FROM_C_
OBJE
CT
(
call
,
ud
,
Call
);
}
// =============================================================================
...
...
@@ -1187,9 +1187,9 @@ void linphone_call_set_user_data (LinphoneCall *call, void *ud) {
LinphoneCall
*
linphone_call_new_outgoing
(
LinphoneCore
*
lc
,
const
LinphoneAddress
*
from
,
const
LinphoneAddress
*
to
,
const
LinphoneCallParams
*
params
,
LinphoneProxyConfig
*
cfg
)
{
LinphoneCall
*
call
=
L_INIT
(
Call
);
L_SET_CPP_PTR_FROM_C_
STRU
CT
(
call
,
std
::
make_shared
<
LinphonePrivate
::
Call
>
(
call
,
lc
,
LinphoneCallOutgoing
,
*
L_GET_CPP_PTR_FROM_C_
STRU
CT
(
from
),
*
L_GET_CPP_PTR_FROM_C_
STRU
CT
(
to
),
cfg
,
nullptr
,
L_GET_CPP_PTR_FROM_C_
STRU
CT
(
params
)));
L_SET_CPP_PTR_FROM_C_
OBJE
CT
(
call
,
std
::
make_shared
<
LinphonePrivate
::
Call
>
(
call
,
lc
,
LinphoneCallOutgoing
,
*
L_GET_CPP_PTR_FROM_C_
OBJE
CT
(
from
),
*
L_GET_CPP_PTR_FROM_C_
OBJE
CT
(
to
),
cfg
,
nullptr
,
L_GET_CPP_PTR_FROM_C_
OBJE
CT
(
params
)));
call
->
currentParamsCache
=
linphone_call_params_new_for_wrapper
();
call
->
paramsCache
=
linphone_call_params_new_for_wrapper
();
call
->
remoteParamsCache
=
linphone_call_params_new_for_wrapper
();
...
...
@@ -1199,8 +1199,8 @@ LinphoneCall *linphone_call_new_outgoing (LinphoneCore *lc, const LinphoneAddres
LinphoneCall
*
linphone_call_new_incoming
(
LinphoneCore
*
lc
,
const
LinphoneAddress
*
from
,
const
LinphoneAddress
*
to
,
SalOp
*
op
)
{
LinphoneCall
*
call
=
L_INIT
(
Call
);
L_SET_CPP_PTR_FROM_C_
STRU
CT
(
call
,
std
::
make_shared
<
LinphonePrivate
::
Call
>
(
call
,
lc
,
LinphoneCallIncoming
,
*
L_GET_CPP_PTR_FROM_C_
STRU
CT
(
from
),
*
L_GET_CPP_PTR_FROM_C_
STRU
CT
(
to
),
L_SET_CPP_PTR_FROM_C_
OBJE
CT
(
call
,
std
::
make_shared
<
LinphonePrivate
::
Call
>
(
call
,
lc
,
LinphoneCallIncoming
,
*
L_GET_CPP_PTR_FROM_C_
OBJE
CT
(
from
),
*
L_GET_CPP_PTR_FROM_C_
OBJE
CT
(
to
),
nullptr
,
op
,
nullptr
));
call
->
currentParamsCache
=
linphone_call_params_new_for_wrapper
();
call
->
paramsCache
=
linphone_call_params_new_for_wrapper
();
...
...
src/c-wrapper/api/c-chat-message.cpp
View file @
78646be7
...
...
@@ -30,15 +30,15 @@
// =============================================================================
#define GET_CPP_PTR(obj) L_GET_CPP_PTR_FROM_C_
STRU
CT(obj)
#define GET_CPP_PRIVATE_PTR(obj) L_GET_PRIVATE_FROM_C_
STRU
CT(obj, ChatMessage, ChatMessage)
#define GET_CPP_PTR(obj) L_GET_CPP_PTR_FROM_C_
OBJE
CT(obj)
#define GET_CPP_PRIVATE_PTR(obj) L_GET_PRIVATE_FROM_C_
OBJE
CT(obj, ChatMessage, ChatMessage)
using
namespace
std
;
static
void
_linphone_chat_message_constructor
(
LinphoneChatMessage
*
msg
);
static
void
_linphone_chat_message_destructor
(
LinphoneChatMessage
*
msg
);
L_DECLARE_C_
STRU
CT_IMPL_WITH_XTORS
(
ChatMessage
,
L_DECLARE_C_
OBJE
CT_IMPL_WITH_XTORS
(
ChatMessage
,
_linphone_chat_message_constructor
,
_linphone_chat_message_destructor
,
LinphoneChatMessageCbs
*
cbs
;
LinphoneChatRoom
*
chat_room
;
...
...
@@ -92,11 +92,11 @@ void linphone_chat_message_unref (LinphoneChatMessage *msg) {
}
void
*
linphone_chat_message_get_user_data
(
const
LinphoneChatMessage
*
msg
)
{
return
L_GET_USER_DATA_FROM_C_
STRU
CT
(
msg
,
ChatMessage
);
return
L_GET_USER_DATA_FROM_C_
OBJE
CT
(
msg
,
ChatMessage
);
}
void
linphone_chat_message_set_user_data
(
LinphoneChatMessage
*
msg
,
void
*
ud
)
{
L_SET_USER_DATA_FROM_C_
STRU
CT
(
msg
,
ud
,
ChatMessage
);
L_SET_USER_DATA_FROM_C_
OBJE
CT
(
msg
,
ud
,
ChatMessage
);
}
...
...
@@ -309,7 +309,7 @@ void linphone_chat_message_update_state(LinphoneChatMessage *msg, LinphoneChatMe
linphone_chat_message_store_state
(
msg
);
if
(
msg
->
state
==
LinphoneChatMessageStateDelivered
||
msg
->
state
==
LinphoneChatMessageStateNotDelivered
)
{
L_GET_PRIVATE_FROM_C_
STRU
CT
(
msg
->
chat_room
,
ChatRoom
)
->
moveTransientMessageToWeakMessages
(
msg
);
L_GET_PRIVATE_FROM_C_
OBJE
CT
(
msg
->
chat_room
,
ChatRoom
)
->
moveTransientMessageToWeakMessages
(
msg
);
}
}
...
...
@@ -324,7 +324,7 @@ void _linphone_chat_message_resend(LinphoneChatMessage *msg, bool_t ref_msg) {
cr
=
linphone_chat_message_get_chat_room
(
msg
);
if
(
ref_msg
)
linphone_chat_message_ref
(
msg
);
L_GET_CPP_PTR_FROM_C_
STRU
CT
(
cr
)
->
sendMessage
(
msg
);
L_GET_CPP_PTR_FROM_C_
OBJE
CT
(
cr
)
->
sendMessage
(
msg
);
}
void
linphone_chat_message_resend
(
LinphoneChatMessage
*
msg
)
{
...
...
@@ -440,7 +440,7 @@ static char *linphone_chat_message_create_imdn_xml(LinphoneChatMessage *cm, Imdn
void
linphone_chat_message_send_imdn
(
LinphoneChatMessage
*
cm
,
ImdnType
imdn_type
,
LinphoneReason
reason
)
{
char
*
content
=
linphone_chat_message_create_imdn_xml
(
cm
,
imdn_type
,
reason
);
if
(
content
)
{
L_GET_PRIVATE_FROM_C_
STRU
CT
(
linphone_chat_message_get_chat_room
(
cm
),
ChatRoom
)
->
sendImdn
(
content
,
reason
);
L_GET_PRIVATE_FROM_C_
OBJE
CT
(
linphone_chat_message_get_chat_room
(
cm
),
ChatRoom
)
->
sendImdn
(
content
,
reason
);
ms_free
(
content
);
}
}
...
...
@@ -465,7 +465,7 @@ void linphone_chat_message_send_display_notification(LinphoneChatMessage *cm) {
LinphoneChatRoom
*
cr
=
linphone_chat_message_get_chat_room
(
msg
);
if
(
linphone_core_realtime_text_enabled
(
linphone_chat_room_get_core
(
cr
)))
{
std
::
shared_ptr
<
LinphonePrivate
::
RealTimeTextChatRoom
>
rttcr
=
std
::
static_pointer_cast
<
LinphonePrivate
::
RealTimeTextChatRoom
>
(
L_GET_CPP_PTR_FROM_C_
STRU
CT
(
cr
));
std
::
static_pointer_cast
<
LinphonePrivate
::
RealTimeTextChatRoom
>
(
L_GET_CPP_PTR_FROM_C_
OBJE
CT
(
cr
));
LinphoneCall
*
call
=
rttcr
->
getCall
();
LinphoneCore
*
lc
=
rttcr
->
getCore
();
const
uint32_t
new_line
=
0x2028
;
...
...
@@ -936,7 +936,7 @@ static void linphone_chat_message_process_response_from_post_file(void *data, co
linphone_chat_message_ref
(
msg
);
linphone_chat_message_set_state
(
msg
,
LinphoneChatMessageStateFileTransferDone
);
_release_http_request
(
msg
);
L_GET_CPP_PTR_FROM_C_
STRU
CT
(
msg
->
chat_room
)
->
sendMessage
(
msg
);
L_GET_CPP_PTR_FROM_C_
OBJE
CT
(
msg
->
chat_room
)
->
sendMessage
(
msg
);
file_upload_end_background_task
(
msg
);
linphone_chat_message_unref
(
msg
);
}
else
{
...
...
src/c-wrapper/api/c-chat-room.cpp
View file @
78646be7
...
...
@@ -29,15 +29,15 @@
// =============================================================================
#define GET_CPP_PTR(obj) L_GET_CPP_PTR_FROM_C_
STRU
CT(obj)
#define GET_CPP_PRIVATE_PTR(obj) L_GET_PRIVATE_FROM_C_
STRU
CT(obj, ChatRoom)
#define GET_CPP_PTR(obj) L_GET_CPP_PTR_FROM_C_
OBJE
CT(obj)
#define GET_CPP_PRIVATE_PTR(obj) L_GET_PRIVATE_FROM_C_
OBJE
CT(obj, ChatRoom)
using
namespace
std
;
static
void
_linphone_chat_room_constructor
(
LinphoneChatRoom
*
cr
);
static
void
_linphone_chat_room_destructor
(
LinphoneChatRoom
*
cr
);
L_DECLARE_C_
STRU
CT_IMPL_WITH_XTORS
(
L_DECLARE_C_
OBJE
CT_IMPL_WITH_XTORS
(
ChatRoom
,
_linphone_chat_room_constructor
,
_linphone_chat_room_destructor
,
LinphoneChatRoomCbs
*
cbs
;
...
...
@@ -211,7 +211,7 @@ LinphoneChatRoomState linphone_chat_room_get_state (const LinphoneChatRoom *cr)
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_
STRU
CT
(
addr
),
nullptr
,
false
),
*
L_GET_CPP_PTR_FROM_C_
OBJE
CT
(
addr
),
nullptr
,
false
),
Participant
);
}
...
...
@@ -237,7 +237,7 @@ bctbx_list_t *linphone_chat_room_get_participants (const LinphoneChatRoom *cr) {
}
void
linphone_chat_room_remove_participant
(
LinphoneChatRoom
*
cr
,
LinphoneParticipant
*
participant
)
{
GET_CPP_PTR
(
cr
)
->
removeParticipant
(
L_GET_CPP_PTR_FROM_C_
STRU
CT
(
participant
));
GET_CPP_PTR
(
cr
)
->
removeParticipant
(
L_GET_CPP_PTR_FROM_C_
OBJE
CT
(
participant
));
}
void
linphone_chat_room_remove_participants
(
LinphoneChatRoom
*
cr
,
const
bctbx_list_t
*
participants
)
{
...
...
@@ -258,11 +258,11 @@ void linphone_chat_room_unref (LinphoneChatRoom *cr) {
}
void
*
linphone_chat_room_get_user_data
(
const
LinphoneChatRoom
*
cr
)
{
return
L_GET_USER_DATA_FROM_C_
STRU
CT
(
cr
,
ChatRoom
);
return
L_GET_USER_DATA_FROM_C_
OBJE
CT
(
cr
,
ChatRoom
);
}
void
linphone_chat_room_set_user_data
(
LinphoneChatRoom
*
cr
,
void
*
ud
)
{
L_SET_USER_DATA_FROM_C_
STRU
CT
(
cr
,
ud
,
ChatRoom
);
L_SET_USER_DATA_FROM_C_
OBJE
CT
(
cr
,
ud
,
ChatRoom
);
}
// =============================================================================
...
...
@@ -272,12 +272,12 @@ void linphone_chat_room_set_user_data (LinphoneChatRoom *cr, void *ud) {
LinphoneChatRoom
*
linphone_chat_room_new
(
LinphoneCore
*
core
,
const
LinphoneAddress
*
addr
)
{
LinphoneChatRoom
*
cr
=
_linphone_ChatRoom_init
();
if
(
linphone_core_realtime_text_enabled
(
core
))
L_SET_CPP_PTR_FROM_C_
STRU
CT
(
cr
,
std
::
make_shared
<
LinphonePrivate
::
RealTimeTextChatRoom
>
(
core
,
*
L_GET_CPP_PTR_FROM_C_
STRU
CT
(
addr
)));
L_SET_CPP_PTR_FROM_C_
OBJE
CT
(
cr
,
std
::
make_shared
<
LinphonePrivate
::
RealTimeTextChatRoom
>
(
core
,
*
L_GET_CPP_PTR_FROM_C_
OBJE
CT
(
addr
)));
else
L_SET_CPP_PTR_FROM_C_
STRU
CT
(
cr
,
std
::
make_shared
<
LinphonePrivate
::
BasicChatRoom
>
(
core
,
*
L_GET_CPP_PTR_FROM_C_
STRU
CT
(
addr
)));
L_SET_CPP_PTR_FROM_C_
OBJE
CT
(
cr
,
std
::
make_shared
<
LinphonePrivate
::
BasicChatRoom
>
(
core
,
*
L_GET_CPP_PTR_FROM_C_
OBJE
CT
(
addr
)));
linphone_core_notify_chat_room_instantiated
(
core
,
cr
);
L_GET_PRIVATE_FROM_C_
STRU
CT
(
cr
,
ChatRoom
)
->
setState
(
LinphonePrivate
::
ChatRoom
::
State
::
Instantiated
);
L_GET_PRIVATE_FROM_C_
STRU
CT
(
cr
,
ChatRoom
)
->
setState
(
LinphonePrivate
::
ChatRoom
::
State
::
Created
);
L_GET_PRIVATE_FROM_C_
OBJE
CT
(
cr
,
ChatRoom
)
->
setState
(
LinphonePrivate
::
ChatRoom
::
State
::
Instantiated
);
L_GET_PRIVATE_FROM_C_
OBJE
CT
(
cr
,
ChatRoom
)
->
setState
(
LinphonePrivate
::
ChatRoom
::
State
::
Created
);
return
cr
;
}
...
...
@@ -290,16 +290,16 @@ LinphoneChatRoom *linphone_client_group_chat_room_new (LinphoneCore *core, const
linphone_address_unref
(
factoryAddr
);
std
::
string
from
;
if
(
proxy
)
from
=
L_GET_CPP_PTR_FROM_C_
STRU
CT
(
linphone_proxy_config_get_identity_address
(
proxy
))
->
asString
();
from
=
L_GET_CPP_PTR_FROM_C_
OBJE
CT
(
linphone_proxy_config_get_identity_address
(
proxy
))
->
asString
();
if
(
from
.
empty
())
from
=
linphone_core_get_primary_contact
(
core
);
LinphonePrivate
::
Address
me
(
from
);
std
::
list
<
LinphonePrivate
::
Address
>
l
=
L_GET_CPP_LIST_OF_CPP_OBJ_FROM_C_LIST_OF_STRUCT_PTR
(
addresses
,
Address
,
Address
);
LinphoneChatRoom
*
cr
=
_linphone_ChatRoom_init
();
L_SET_CPP_PTR_FROM_C_
STRU
CT
(
cr
,
make_shared
<
LinphonePrivate
::
ClientGroupChatRoom
>
(
core
,
me
,
l
));
L_SET_CPP_PTR_FROM_C_
OBJE
CT
(
cr
,
make_shared
<
LinphonePrivate
::
ClientGroupChatRoom
>
(
core
,
me
,
l
));
linphone_core_notify_chat_room_instantiated
(
core
,
cr
);
L_GET_PRIVATE_FROM_C_
STRU
CT
(
cr
,
ChatRoom
)
->
setState
(
LinphonePrivate
::
ChatRoom
::
State
::
Instantiated
);
L_GET_PRIVATE_FROM_C_
STRU
CT
(
cr
,
ChatRoom
)
->
setState
(
LinphonePrivate
::
ChatRoom
::
State
::
CreationPending
);
L_GET_PRIVATE_FROM_C_
OBJE
CT
(
cr
,
ChatRoom
)
->
setState
(
LinphonePrivate
::
ChatRoom
::
State
::
Instantiated
);
L_GET_PRIVATE_FROM_C_
OBJE
CT
(
cr
,
ChatRoom
)
->
setState
(
LinphonePrivate
::
ChatRoom
::
State
::
CreationPending
);
return
cr
;
}
...
...
src/c-wrapper/api/c-event-log.cpp
View file @
78646be7
...
...
@@ -42,7 +42,7 @@ using namespace std;
LinphoneEventLog
*
linphone_event_log_new
()
{
LinphoneEventLog
*
event_log
=
_linphone_EventLog_init
();
L_SET_CPP_PTR_FROM_C_
STRU
CT
(
event_log
,
new
LINPHONE_NAMESPACE
::
EventLog
());
L_SET_CPP_PTR_FROM_C_
OBJE
CT
(
event_log
,
new
LINPHONE_NAMESPACE
::
EventLog
());
return
event_log
;
}
...
...
@@ -53,7 +53,7 @@ LinphoneEventLog *linphone_event_log_ref (LinphoneEventLog *event_log) {
LinphoneEventLogType
linphone_event_log_get_type
(
const
LinphoneEventLog
*
event_log
)
{
return
static_cast
<
LinphoneEventLogType
>
(
L_GET_CPP_PTR_FROM_C_
STRU
CT
(
event_log
)
->
getType
()
L_GET_CPP_PTR_FROM_C_
OBJE
CT
(
event_log
)
->
getType
()
);
}
...
...
@@ -63,11 +63,11 @@ LinphoneEventLogType linphone_event_log_get_type (const LinphoneEventLog *event_
LinphoneCallEvent
*
linphone_call_event_new
(
LinphoneEventLogType
type
,
LinphoneCall
*
call
)
{
LinphoneCallEvent
*
call_event
=
_linphone_CallEvent_init
();
L_SET_CPP_PTR_FROM_C_
STRU
CT
(
L_SET_CPP_PTR_FROM_C_
OBJE
CT
(
call_event
,
new
LINPHONE_NAMESPACE
::
CallEvent
(
static_cast
<
LINPHONE_NAMESPACE
::
EventLog
::
Type
>
(
type
),
L_GET_CPP_PTR_FROM_C_
STRU
CT
(
call
)
L_GET_CPP_PTR_FROM_C_
OBJE
CT
(
call
)
)
);
return
call_event
;
...
...
@@ -75,7 +75,7 @@ LinphoneCallEvent *linphone_call_event_new (LinphoneEventLogType type, LinphoneC
LinphoneCall
*
linphone_call_event_get_call
(
const
LinphoneCallEvent
*
call_event
)
{
return
L_GET_C_BACK_PTR
(
L_GET_CPP_PTR_FROM_C_
STRU
CT
(
call_event
)
->
getCall
(),
Call
L_GET_CPP_PTR_FROM_C_
OBJE
CT
(
call_event
)
->
getCall
(),
Call
);
}
...
...
@@ -122,10 +122,10 @@ const LinphoneAddress *linphone_conference_participant_event_get_participant_add
LinphoneChatMessageEvent
*
linphone_chat_message_event_new
(
LinphoneChatMessage
*
chat_message
)
{
LinphoneChatMessageEvent
*
chat_message_event
=
_linphone_ChatMessageEvent_init
();
L_SET_CPP_PTR_FROM_C_
STRU
CT
(
L_SET_CPP_PTR_FROM_C_
OBJE
CT
(
chat_message_event
,
new
LINPHONE_NAMESPACE
::
ChatMessageEvent
(
L_GET_CPP_PTR_FROM_C_
STRU
CT
(
chat_message
)
L_GET_CPP_PTR_FROM_C_
OBJE
CT
(
chat_message
)
)
);
return
chat_message_event
;
...
...
@@ -133,7 +133,7 @@ LinphoneChatMessageEvent *linphone_chat_message_event_new (LinphoneChatMessage *
LinphoneChatMessage
*
linphone_chat_message_event_get_chat_message
(
const
LinphoneChatMessageEvent
*
chat_message_event
)
{
return
L_GET_C_BACK_PTR
(
L_GET_CPP_PTR_FROM_C_
STRU
CT
(
chat_message_event
)
->
getChatMessage
(),
L_GET_CPP_PTR_FROM_C_
OBJE
CT
(
chat_message_event
)
->
getChatMessage
(),
ChatMessage
);
}
src/c-wrapper/api/c-participant.cpp
View file @
78646be7
...
...
@@ -25,7 +25,7 @@
using
namespace
std
;
L_DECLARE_C_
STRU
CT_IMPL
(
Participant
,
L_DECLARE_C_
OBJE
CT_IMPL
(
Participant
,
mutable
LinphoneAddress
*
addressCache
;
);
...
...
@@ -39,15 +39,15 @@ void linphone_participant_unref (LinphoneParticipant *participant) {
}
void
*
linphone_participant_get_user_data
(
const
LinphoneParticipant
*
participant
)
{
return
L_GET_USER_DATA_FROM_C_
STRU
CT
(
participant
,
Participant
);
return
L_GET_USER_DATA_FROM_C_
OBJE
CT
(
participant
,
Participant
);
}
void
linphone_participant_set_user_data
(
LinphoneParticipant
*
participant
,
void
*
ud
)
{
L_SET_USER_DATA_FROM_C_
STRU
CT
(
participant
,
ud
,
Participant
);
L_SET_USER_DATA_FROM_C_
OBJE
CT
(
participant
,
ud
,
Participant
);
}
const
LinphoneAddress
*
linphone_participant_get_address
(
const
LinphoneParticipant
*
participant
)
{
LinphonePrivate
::
Address
addr
=
L_GET_CPP_PTR_FROM_C_
STRU
CT
(
participant
)
->
getAddress
();
LinphonePrivate
::
Address
addr
=
L_GET_CPP_PTR_FROM_C_
OBJE
CT
(
participant
)
->
getAddress
();
if
(
participant
->
addressCache
)
linphone_address_unref
(
participant
->
addressCache
);
participant
->
addressCache
=
linphone_address_new
(
addr
.
asString
().
c_str
());
...
...
@@ -55,9 +55,9 @@ const LinphoneAddress *linphone_participant_get_address (const LinphoneParticipa
}
bool_t
linphone_participant_is_admin
(
const
LinphoneParticipant
*
participant
)
{
return
L_GET_CPP_PTR_FROM_C_
STRU
CT
(
participant
)
->
isAdmin
();
return
L_GET_CPP_PTR_FROM_C_
OBJE
CT
(
participant
)
->
isAdmin
();
}
void
linphone_participant_set_admin
(
LinphoneParticipant
*
participant
,
bool_t
value
)
{
L_GET_CPP_PTR_FROM_C_
STRU
CT
(
participant
)
->
setAdmin
(
value
);
L_GET_CPP_PTR_FROM_C_
OBJE
CT
(
participant
)
->
setAdmin
(
value
);
}
src/c-wrapper/internal/c-tools.h
View file @
78646be7
...
...
@@ -269,9 +269,9 @@ private:
LINPHONE_END_NAMESPACE
#define L_INTERNAL_C_
STRU
CT_NO_XTOR(OBJECT)
#define L_INTERNAL_C_
OBJE
CT_NO_XTOR(
C_
OBJECT)
#define L_INTERNAL_DECLARE_C_
STRU
CT_FUNCTIONS(C_TYPE, CONSTRUCTOR, DESTRUCTOR) \
#define L_INTERNAL_DECLARE_C_
OBJE
CT_FUNCTIONS(C_TYPE, CONSTRUCTOR, DESTRUCTOR) \
BELLE_SIP_DECLARE_VPTR_NO_EXPORT(Linphone ## C_TYPE); \
Linphone ## C_TYPE *_linphone_ ## C_TYPE ## _init() { \
Linphone ## C_TYPE * object = belle_sip_object_new(Linphone ## C_TYPE); \
...
...
@@ -331,22 +331,22 @@ LINPHONE_END_NAMESPACE
// -----------------------------------------------------------------------------
// Declare wrapped C object with constructor/destructor.
#define L_DECLARE_C_
STRU
CT_IMPL_WITH_XTORS(C_TYPE, CONSTRUCTOR, DESTRUCTOR, ...) \
#define L_DECLARE_C_
OBJE
CT_IMPL_WITH_XTORS(C_TYPE, CONSTRUCTOR, DESTRUCTOR, ...) \
struct _Linphone ## C_TYPE { \
belle_sip_object_t base; \
std::shared_ptr<L_CPP_TYPE_OF_C_TYPE(C_TYPE)> cppPtr; \
__VA_ARGS__ \
}; \
L_INTERNAL_DECLARE_C_
STRU
CT_FUNCTIONS(C_TYPE, CONSTRUCTOR, DESTRUCTOR)
L_INTERNAL_DECLARE_C_
OBJE
CT_FUNCTIONS(C_TYPE, CONSTRUCTOR, DESTRUCTOR)
// Declare wrapped C object.
#define L_DECLARE_C_
STRU
CT_IMPL(C_TYPE, ...) \
#define L_DECLARE_C_
OBJE
CT_IMPL(C_TYPE, ...) \
struct _Linphone ## C_TYPE { \
belle_sip_object_t base; \
std::shared_ptr<L_CPP_TYPE_OF_C_TYPE(C_TYPE)> cppPtr; \
__VA_ARGS__ \
}; \
L_INTERNAL_DECLARE_C_
STRU
CT_FUNCTIONS(C_TYPE, L_INTERNAL_C_
STRU
CT_NO_XTOR, L_INTERNAL_C_
STRU
CT_NO_XTOR)
L_INTERNAL_DECLARE_C_
OBJE
CT_FUNCTIONS(C_TYPE, L_INTERNAL_C_
OBJE
CT_NO_XTOR, L_INTERNAL_C_
OBJE
CT_NO_XTOR)
// Declare clonable wrapped C object.
#define L_DECLARE_C_CLONABLE_STRUCT_IMPL(C_TYPE, ...) \
...
...
@@ -376,7 +376,7 @@ LINPHONE_END_NAMESPACE
FALSE \
);
#define L_DECLARE_C_
STRU
CT_NEW_DEFAULT(C_TYPE, C_NAME) \
#define L_DECLARE_C_
OBJE
CT_NEW_DEFAULT(C_TYPE, C_NAME) \
Linphone ## C_TYPE * linphone_ ## C_NAME ## _new() { \
Linphone ## C_TYPE * object = _linphone_ ## C_TYPE ## _init(); \
object->cppPtr = std::make_shared<LINPHONE_NAMESPACE::C_TYPE>(); \
...
...
@@ -395,14 +395,14 @@ LINPHONE_END_NAMESPACE
#define L_INIT(C_TYPE) _linphone_ ## C_TYPE ## _init ()
// Get the cpp-ptr of a wrapped C object.
#define L_GET_CPP_PTR_FROM_C_
STRU
CT(OBJECT) \
#define L_GET_CPP_PTR_FROM_C_
OBJE
CT(OBJECT) \
LINPHONE_NAMESPACE::Wrapper::getCppPtrFromC< \
L_CPP_TYPE_OF_C_OBJECT(OBJECT), \
std::remove_pointer<decltype(OBJECT)>::type \
>(OBJECT)
// Set the cpp-ptr of a wrapped C object.
#define L_SET_CPP_PTR_FROM_C_
STRU
CT(OBJECT, CPP_PTR) \
#define L_SET_CPP_PTR_FROM_C_
OBJE
CT(OBJECT, CPP_PTR) \
LINPHONE_NAMESPACE::Wrapper::setCppPtrFromC(OBJECT, CPP_PTR)
// Get the private data of a shared or simple cpp-ptr.
...
...
@@ -410,9 +410,9 @@ LINPHONE_END_NAMESPACE
LINPHONE_NAMESPACE::Wrapper::getPrivate(OBJECT)