Commit 1948fbcb authored by jehan's avatar jehan

Revert most of Ronan refactoring to avoid to much instability on master.

parent 252925a3
......@@ -45,7 +45,6 @@ list(APPEND LINPHONE_PRIVATE_HEADER_FILES
offeranswer.h
private.h
quality_reporting.h
sal/sal.h
sqlite3_bctbx_vfs.h
vcard_private.h
xml2lpc.h
......@@ -54,6 +53,7 @@ list(APPEND LINPHONE_PRIVATE_HEADER_FILES
set(LINPHONE_SOURCE_FILES_C
account_creator.c
account_creator_service.c
address.c
authentication.c
bellesip_sal/sal_address_impl.c
bellesip_sal/sal_impl.c
......@@ -109,7 +109,7 @@ set(LINPHONE_SOURCE_FILES_C
quality_reporting.c
remote_provisioning.c
ringtoneplayer.c
sal/sal.c
sal.c
siplogin.c
sipsetup.c
sqlite3_bctbx_vfs.c
......
/*
linphone
Copyright (C) 2009 Simon MORLAT (simon.morlat@linphone.org)
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "linphone/core.h"
#include "linphone/lpconfig.h"
#include "private.h"
LinphoneAddress * _linphone_address_new(const char *addr){
SalAddress *saddr=sal_address_new(addr);
if (saddr==NULL)
ms_error("Cannot create LinphoneAddress, bad uri [%s]",addr);
return saddr;
}
LinphoneAddress * linphone_address_new(const char *addr) {
return _linphone_address_new(addr);
}
LinphoneAddress * linphone_address_clone(const LinphoneAddress *addr){
return sal_address_clone(addr);
}
LinphoneAddress * linphone_address_ref(LinphoneAddress *addr){
return sal_address_ref(addr);
}
void linphone_address_unref(LinphoneAddress *addr){
sal_address_unref(addr);
}
const char *linphone_address_get_scheme(const LinphoneAddress *u){
return sal_address_get_scheme(u);
}
const char *linphone_address_get_display_name(const LinphoneAddress* u){
return sal_address_get_display_name(u);
}
const char *linphone_address_get_username(const LinphoneAddress *u){
return sal_address_get_username(u);
}
const char *linphone_address_get_domain(const LinphoneAddress *u){
return sal_address_get_domain(u);
}
int linphone_address_get_port(const LinphoneAddress *u) {
return sal_address_get_port(u);
}
LinphoneStatus linphone_address_set_display_name(LinphoneAddress *u, const char *display_name){
sal_address_set_display_name(u,display_name);
return 0;
}
LinphoneStatus linphone_address_set_username(LinphoneAddress *uri, const char *username) {
sal_address_set_username(uri,username);
return 0;
}
LinphoneStatus linphone_address_set_domain(LinphoneAddress *uri, const char *host){
sal_address_set_domain(uri,host);
return 0;
}
LinphoneStatus linphone_address_set_port(LinphoneAddress *uri, int port){
sal_address_set_port(uri,port);
return 0;
}
LinphoneStatus linphone_address_set_transport(LinphoneAddress *uri, LinphoneTransportType tp){
sal_address_set_transport(uri,(SalTransport)tp);
return 0;
}
LinphoneTransportType linphone_address_get_transport(const LinphoneAddress *uri){
return (LinphoneTransportType)sal_address_get_transport(uri);
}
void linphone_address_set_method_param(LinphoneAddress *addr, const char *method) {
sal_address_set_method_param(addr, method);
}
const char *linphone_address_get_method_param(const LinphoneAddress *addr) {
return sal_address_get_method_param(addr);
}
void linphone_address_clean(LinphoneAddress *uri){
sal_address_clean(uri);
}
char *linphone_address_as_string(const LinphoneAddress *u){
return sal_address_as_string(u);
}
char *linphone_address_as_string_uri_only(const LinphoneAddress *u){
return sal_address_as_string_uri_only(u);
}
bool_t linphone_address_is_secure(const LinphoneAddress *uri){
return sal_address_is_secure(uri);
}
bool_t linphone_address_get_secure(const LinphoneAddress *uri){
return sal_address_is_secure(uri);
}
void linphone_address_set_secure(LinphoneAddress *addr, bool_t enabled){
sal_address_set_secure(addr, enabled);
}
bool_t linphone_address_is_sip(const LinphoneAddress *uri){
return sal_address_is_sip(uri);
}
static bool_t strings_equals(const char *s1, const char *s2){
if (s1==NULL && s2==NULL) return TRUE;
if (s1!=NULL && s2!=NULL && strcmp(s1,s2)==0) return TRUE;
return FALSE;
}
bool_t linphone_address_weak_equal(const LinphoneAddress *a1, const LinphoneAddress *a2){
const char *u1,*u2;
const char *h1,*h2;
int p1,p2;
u1=linphone_address_get_username(a1);
u2=linphone_address_get_username(a2);
p1=linphone_address_get_port(a1);
p2=linphone_address_get_port(a2);
h1=linphone_address_get_domain(a1);
h2=linphone_address_get_domain(a2);
return strings_equals(u1,u2) && strings_equals(h1,h2) && p1==p2;
}
bool_t linphone_address_equal(const LinphoneAddress *a1, const LinphoneAddress *a2) {
char *s1;
char *s2;
bool_t res;
if ((a1 == NULL) && (a2 == NULL)) return TRUE;
if ((a1 == NULL) || (a2 == NULL)) return FALSE;
s1 = linphone_address_as_string(a1);
s2 = linphone_address_as_string(a2);
res = (strcmp(s1, s2) == 0) ? TRUE : FALSE;
ms_free(s1);
ms_free(s2);
return res;
}
void linphone_address_destroy(LinphoneAddress *u){
linphone_address_unref(u);
}
void linphone_address_set_password(LinphoneAddress *addr, const char *passwd){
sal_address_set_password(addr,passwd);
}
const char *linphone_address_get_password(const LinphoneAddress *addr){
return sal_address_get_password(addr);
}
void linphone_address_set_header(LinphoneAddress *addr, const char *header_name, const char *header_value){
sal_address_set_header(addr,header_name,header_value);
}
const char *linphone_address_get_header(const LinphoneAddress *addr, const char *name){
return sal_address_get_header(addr,name);
}
bool_t linphone_address_has_param(const LinphoneAddress *addr, const char *name) {
return sal_address_has_param(addr, name);
}
const char * linphone_address_get_param(const LinphoneAddress *addr, const char *name) {
return sal_address_get_param(addr, name);
}
void linphone_address_set_param(LinphoneAddress *addr, const char *name, const char *value) {
sal_address_set_param(addr, name, value);
}
void linphone_address_set_params(LinphoneAddress *addr, const char *params) {
sal_address_set_params(addr, params);
}
void linphone_address_set_uri_param(LinphoneAddress *addr, const char *name, const char *value) {
sal_address_set_uri_param(addr, name, value);
}
void linphone_address_set_uri_params(LinphoneAddress *addr, const char *params) {
sal_address_set_uri_params(addr, params);
}
bool_t linphone_address_has_uri_param(const LinphoneAddress *addr, const char *name) {
return sal_address_has_uri_param(addr, name);
}
const char * linphone_address_get_uri_param(const LinphoneAddress *addr, const char *name) {
return sal_address_get_uri_param(addr, name);
}
LinphoneAddress * linphone_core_create_address(LinphoneCore *lc, const char *address) {
return linphone_address_new(address);
}
/** @} */
......@@ -33,7 +33,7 @@ SalAddress * sal_address_new(const char *uri){
}
SalAddress * sal_address_clone(const SalAddress *addr){
return (SalAddress *) belle_sip_object_ref(belle_sip_header_address_clone(BELLE_SIP_HEADER_ADDRESS(addr)));
return (SalAddress *) belle_sip_object_ref(belle_sip_object_clone(BELLE_SIP_OBJECT(addr)));
}
const char *sal_address_get_scheme(const SalAddress *addr){
......@@ -277,3 +277,4 @@ bool_t sal_address_is_ipv6(const SalAddress *addr){
void sal_address_destroy(SalAddress *addr){
sal_address_unref(addr);
}
......@@ -1141,9 +1141,6 @@ int sal_call_terminate_with_error(SalOp *op, const SalErrorInfo *info){
* The state is passed to Terminating to remember to terminate later.
*/
op->state=SalOpStateTerminating;
/* However, even if the transaction is kept alive, we can stop sending retransmissions to avoid flowing the network with no longer
* necessary messages and avoid confusion in logs.*/
belle_sip_client_transaction_stop_retransmissions(op->pending_client_trans);
}
}
break;
......
......@@ -84,7 +84,7 @@ static void register_refresher_listener (belle_sip_refresher_t* refresher
}
}
int sal_register(SalOp *op, const char *proxy, const char *from, int expires, const SalAddress* old_contact){
int sal_register(SalOp *op, const char *proxy, const char *from, int expires,SalAddress* old_contact){
belle_sip_request_t *req;
belle_sip_uri_t* req_uri;
belle_sip_header_t* accept_header;
......@@ -135,3 +135,5 @@ int sal_register_refresh(SalOp *op, int expires){
int sal_unregister(SalOp *op){
return sal_register_refresh(op,0);
}
......@@ -238,12 +238,6 @@ char * linphone_call_log_to_str(LinphoneCallLog *cl){
case LinphoneCallMissed:
status=_("missed");
break;
case LinphoneCallAcceptedElsewhere:
status=_("answered elsewhere");
break;
case LinphoneCallDeclinedElsewhere:
status=_("declined elsewhere");
break;
default:
status=_("unknown");
}
......
......@@ -950,20 +950,19 @@ static void call_failure(SalOp *op){
case SalReasonRedirect:
{
linphone_call_stop_media_streams(call);
if (
call->state == LinphoneCallOutgoingInit ||
call->state == LinphoneCallOutgoingProgress ||
call->state == LinphoneCallOutgoingRinging ||
call->state == LinphoneCallOutgoingEarlyMedia
) {
const SalAddress* redirection_to = sal_op_get_remote_contact_address(call->op);
if (redirection_to) {
char *url = sal_address_as_string(redirection_to);
if ( call->state==LinphoneCallOutgoingInit
|| call->state==LinphoneCallOutgoingProgress
|| call->state==LinphoneCallOutgoingRinging /*push case*/
|| call->state==LinphoneCallOutgoingEarlyMedia){
LinphoneAddress* redirection_to = (LinphoneAddress*)sal_op_get_remote_contact_address(call->op);
if( redirection_to ){
char* url = linphone_address_as_string(redirection_to);
ms_warning("Redirecting call [%p] to %s",call, url);
if (call->log->to)
linphone_address_unref(call->log->to);
call->log->to = linphone_address_new(url);
ms_free(url);
if( call->log->to != NULL ) {
linphone_address_unref(call->log->to);
}
call->log->to = linphone_address_ref(redirection_to);
linphone_call_restart_invite(call);
return;
}
......
This diff is collapsed.
......@@ -26,12 +26,8 @@
#include "private.h"
#include "ortp/b64.h"
#include "chat/chat-room.h"
extern LinphonePrivate::ChatRoom& linphone_chat_room_get_cpp_obj(LinphoneChatRoom *cr);
static bool_t file_transfer_in_progress_and_valid(LinphoneChatMessage* msg) {
return (msg->chat_room && linphone_chat_room_get_core(msg->chat_room) && msg->http_request && !belle_http_request_is_cancelled(msg->http_request));
return (msg->chat_room && msg->chat_room->lc && msg->http_request && !belle_http_request_is_cancelled(msg->http_request));
}
static void _release_http_request(LinphoneChatMessage* msg) {
......@@ -92,7 +88,7 @@ static void linphone_chat_message_file_transfer_on_progress(belle_sip_body_handl
msg, msg->file_transfer_information, offset, total);
} else {
/* Legacy: call back given by application level */
linphone_core_notify_file_transfer_progress_indication(linphone_chat_room_get_core(msg->chat_room), msg, msg->file_transfer_information,
linphone_core_notify_file_transfer_progress_indication(msg->chat_room->lc, msg, msg->file_transfer_information,
offset, total);
}
}
......@@ -112,7 +108,7 @@ static int on_send_body(belle_sip_user_body_handler_t *bh, belle_sip_message_t *
return BELLE_SIP_STOP;
}
lc = linphone_chat_room_get_core(msg->chat_room);
lc = msg->chat_room->lc;
/* if we've not reach the end of file yet, ask for more data */
/* in case of file body handler, won't be called */
if (msg->file_transfer_filepath == NULL && offset < linphone_content_get_size(msg->file_transfer_information)) {
......@@ -157,7 +153,7 @@ static int on_send_body(belle_sip_user_body_handler_t *bh, belle_sip_message_t *
static void on_send_end(belle_sip_user_body_handler_t *bh, void *data) {
LinphoneChatMessage *msg = (LinphoneChatMessage *)data;
LinphoneCore *lc = linphone_chat_room_get_core(msg->chat_room);
LinphoneCore *lc = msg->chat_room->lc;
LinphoneImEncryptionEngine *imee = linphone_core_get_im_encryption_engine(lc);
if (imee) {
......@@ -189,7 +185,8 @@ static void file_upload_begin_background_task(LinphoneChatMessage *obj){
}
}
static void linphone_chat_message_process_response_from_post_file(void *data, const belle_http_response_event_t *event) {
static void linphone_chat_message_process_response_from_post_file(void *data,
const belle_http_response_event_t *event) {
LinphoneChatMessage *msg = (LinphoneChatMessage *)data;
if (msg->http_request && !file_transfer_in_progress_and_valid(msg)) {
......@@ -208,7 +205,7 @@ static void linphone_chat_message_process_response_from_post_file(void *data, co
belle_sip_body_handler_t *first_part_bh;
bool_t is_file_encryption_enabled = FALSE;
LinphoneImEncryptionEngine *imee = linphone_core_get_im_encryption_engine(linphone_chat_room_get_core(msg->chat_room));
LinphoneImEncryptionEngine *imee = linphone_core_get_im_encryption_engine(msg->chat_room->lc);
if (imee) {
LinphoneImEncryptionEngineCbs *imee_cbs = linphone_im_encryption_engine_get_callbacks(imee);
LinphoneImEncryptionEngineCbsIsEncryptionEnabledForFileTransferCb is_encryption_enabled_for_file_transfer_cb =
......@@ -342,7 +339,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);
linphone_chat_room_get_cpp_obj(msg->chat_room).sendMessage(msg);
_linphone_chat_room_send_message(msg->chat_room, msg);
file_upload_end_background_task(msg);
linphone_chat_message_unref(msg);
} else {
......@@ -377,7 +374,7 @@ static void on_recv_body(belle_sip_user_body_handler_t *bh, belle_sip_message_t
linphone_chat_message_cancel_file_transfer(msg);
return;
}
lc = linphone_chat_room_get_core(msg->chat_room);
lc = msg->chat_room->lc;
if (lc == NULL){
return; /*might happen during linphone_core_destroy()*/
......@@ -428,7 +425,7 @@ static void on_recv_body(belle_sip_user_body_handler_t *bh, belle_sip_message_t
static void on_recv_end(belle_sip_user_body_handler_t *bh, void *data) {
LinphoneChatMessage *msg = (LinphoneChatMessage *)data;
LinphoneCore *lc = linphone_chat_room_get_core(msg->chat_room);
LinphoneCore *lc = msg->chat_room->lc;
LinphoneImEncryptionEngine *imee = linphone_core_get_im_encryption_engine(lc);
int retval = -1;
......@@ -539,7 +536,7 @@ static void linphone_chat_process_response_from_get_file(void *data, const belle
int _linphone_chat_room_start_http_transfer(LinphoneChatMessage *msg, const char* url, const char* action, const belle_http_request_listener_callbacks_t *cbs) {
belle_generic_uri_t *uri = NULL;
const char* ua = linphone_core_get_user_agent(linphone_chat_room_get_core(msg->chat_room));
const char* ua = linphone_core_get_user_agent(msg->chat_room->lc);
if (url == NULL) {
ms_warning("Cannot process file transfer msg: no file remote URI configured.");
......@@ -562,7 +559,7 @@ int _linphone_chat_room_start_http_transfer(LinphoneChatMessage *msg, const char
/* give msg to listener to be able to start the actual file upload when server answer a 204 No content */
msg->http_listener = belle_http_request_listener_create_from_callbacks(cbs, linphone_chat_message_ref(msg));
belle_http_provider_send_request(linphone_chat_room_get_core(msg->chat_room)->http_provider, msg->http_request, msg->http_listener);
belle_http_provider_send_request(msg->chat_room->lc->http_provider, msg->http_request, msg->http_listener);
return 0;
error:
if (uri) {
......@@ -583,7 +580,7 @@ int linphone_chat_room_upload_file(LinphoneChatMessage *msg) {
cbs.process_response = linphone_chat_message_process_response_from_post_file;
cbs.process_io_error = linphone_chat_message_process_io_error_upload;
cbs.process_auth_requested = linphone_chat_message_process_auth_requested_upload;
err = _linphone_chat_room_start_http_transfer(msg, linphone_core_get_file_transfer_server(linphone_chat_room_get_core(msg->chat_room)), "POST", &cbs);
err = _linphone_chat_room_start_http_transfer(msg, linphone_core_get_file_transfer_server(msg->chat_room->lc), "POST", &cbs);
if (err == -1){
linphone_chat_message_set_state(msg, LinphoneChatMessageStateNotDelivered);
}
......@@ -624,10 +621,10 @@ void _linphone_chat_message_cancel_file_transfer(LinphoneChatMessage *msg, bool_
if (!belle_http_request_is_cancelled(msg->http_request)) {
if (msg->chat_room) {
ms_message("Canceling file transfer %s - msg [%p] chat room[%p]"
, (msg->external_body_url == NULL) ? linphone_core_get_file_transfer_server(linphone_chat_room_get_core(msg->chat_room)) : msg->external_body_url
, (msg->external_body_url == NULL) ? linphone_core_get_file_transfer_server(msg->chat_room->lc) : msg->external_body_url
, msg
, msg->chat_room);
belle_http_provider_cancel_request(linphone_chat_room_get_core(msg->chat_room)->http_provider, msg->http_request);
belle_http_provider_cancel_request(msg->chat_room->lc->http_provider, msg->http_request);
if ((msg->dir == LinphoneChatMessageOutgoing) && unref) {
// must release it
linphone_chat_message_unref(msg);
......@@ -657,6 +654,20 @@ const char *linphone_chat_message_get_file_transfer_filepath(LinphoneChatMessage
return msg->file_transfer_filepath;
}
LinphoneChatMessage *linphone_chat_room_create_file_transfer_message(LinphoneChatRoom *cr, const LinphoneContent *initial_content) {
return linphone_chat_room_get_cpp_obj(cr).createFileTransferMessage(initial_content);
LinphoneChatMessage *linphone_chat_room_create_file_transfer_message(LinphoneChatRoom *cr,
const LinphoneContent *initial_content) {
LinphoneChatMessage *msg = belle_sip_object_new(LinphoneChatMessage);
msg->callbacks = linphone_chat_message_cbs_new();
msg->chat_room = (LinphoneChatRoom *)cr;
msg->message = NULL;
msg->file_transfer_information = linphone_content_copy(initial_content);
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(cr->lc)); /*direct assignment*/
/* this will be set to application/vnd.gsma.rcs-ft-http+xml when we will transfer the xml reply from server to the peers */
msg->content_type = NULL;
/* this will store the http request during file upload to the server */
msg->http_request = NULL;
msg->time = ms_time(0);
return msg;
}
......@@ -128,14 +128,10 @@ void linphone_event_set_state(LinphoneEvent *lev, LinphoneSubscriptionState stat
void linphone_event_set_publish_state(LinphoneEvent *lev, LinphonePublishState state){
if (lev->publish_state!=state){
ms_message("LinphoneEvent [%p] moving from [%s] to publish state %s"
, lev
, linphone_publish_state_to_string(lev->publish_state)
, linphone_publish_state_to_string(state));
ms_message("LinphoneEvent [%p] moving to publish state %s",lev,linphone_publish_state_to_string(state));
lev->publish_state=state;
linphone_core_notify_publish_state_changed(lev->lc,lev,state);
switch(state){
case LinphonePublishNone: /*this state is probably trigered by a network state change to DOWN, we should release the op*/
case LinphonePublishCleared:
linphone_event_release(lev);
break;
......@@ -145,6 +141,7 @@ void linphone_event_set_publish_state(LinphoneEvent *lev, LinphonePublishState s
case LinphonePublishError:
linphone_event_release(lev);
break;
case LinphonePublishNone:
case LinphonePublishProgress:
case LinphonePublishExpiring:
/*nothing special to do*/
......@@ -278,7 +275,7 @@ LinphoneStatus linphone_event_notify(LinphoneEvent *lev, const LinphoneContent *
static LinphoneEvent *_linphone_core_create_publish(LinphoneCore *core, LinphoneProxyConfig *cfg, const LinphoneAddress *resource, const char *event, int expires){
LinphoneCore *lc = core;
LinphoneEvent *lev;
if (!lc && cfg) {
if (cfg->lc)
lc = cfg->lc;
......@@ -289,7 +286,7 @@ static LinphoneEvent *_linphone_core_create_publish(LinphoneCore *core, Linphone
}
if (!resource && cfg)
resource = linphone_proxy_config_get_identity_address(cfg);
lev = linphone_event_new(lc,LinphoneSubscriptionInvalidDir, event,expires);
linphone_configure_op_with_proxy(lc,lev->op,resource,NULL,lp_config_get_int(lc->config,"sip","publish_msg_with_contact",0),cfg);
sal_op_set_manual_refresher_mode(lev->op,!lp_config_get_int(lc->config,"sip","refresh_generic_publish",1));
......@@ -299,10 +296,10 @@ LinphoneEvent *linphone_core_create_publish(LinphoneCore *lc, const LinphoneAddr
return _linphone_core_create_publish(lc, NULL, resource, event, expires);
}
LinphoneEvent *linphone_proxy_config_create_publish(LinphoneProxyConfig *cfg, const char *event, int expires) {
return _linphone_core_create_publish(NULL, cfg,NULL, event, expires);
}
LinphoneEvent *linphone_core_create_one_shot_publish(LinphoneCore *lc, const LinphoneAddress *resource, const char *event){
LinphoneEvent *lev = linphone_core_create_publish(lc, resource, event, -1);
......@@ -423,9 +420,6 @@ static void linphone_event_destroy(LinphoneEvent *lev){
if (lev->ei) linphone_error_info_unref(lev->ei);
if (lev->op) sal_op_release(lev->op);
if (lev->send_custom_headers) sal_custom_header_free(lev->send_custom_headers);
if (lev->to_address) linphone_address_unref(lev->to_address);
if (lev->from_address) linphone_address_unref(lev->from_address);
ms_free(lev->name);
}
......@@ -445,34 +439,20 @@ const char *linphone_event_get_name(const LinphoneEvent *lev){
return lev->name;
}
static const LinphoneAddress *_linphone_event_cache_to (const LinphoneEvent *lev) {
if (lev->to_address)
linphone_address_unref(lev->to_address);
char *buf = sal_address_as_string(sal_op_get_to_address(lev->op));
((LinphoneEvent *)lev)->to_address = linphone_address_new(buf);
ms_free(buf);
return lev->to_address;
}
static const LinphoneAddress *_linphone_event_cache_from (const LinphoneEvent *lev) {
if (lev->from_address)
linphone_address_unref(lev->from_address);
char *buf = sal_address_as_string(sal_op_get_from_address(lev->op));
((LinphoneEvent *)lev)->from_address = linphone_address_new(buf);
ms_free(buf);
return lev->from_address;
}
const LinphoneAddress *linphone_event_get_from (const LinphoneEvent *lev) {
if (lev->is_out_of_dialog_op && lev->dir == LinphoneSubscriptionOutgoing)
return _linphone_event_cache_to(lev);
return _linphone_event_cache_from(lev);
const LinphoneAddress *linphone_event_get_from(const LinphoneEvent *lev){
if (lev->is_out_of_dialog_op && lev->dir == LinphoneSubscriptionOutgoing){
return (LinphoneAddress*)sal_op_get_to_address(lev->op);
}else{
return (LinphoneAddress*)sal_op_get_from_address(lev->op);
}
}
const LinphoneAddress *linphone_event_get_resource(const LinphoneEvent *lev){
if (lev->is_out_of_dialog_op && lev->dir == LinphoneSubscriptionOutgoing)
return _linphone_event_cache_from(lev);
return _linphone_event_cache_to(lev);
if (lev->is_out_of_dialog_op && lev->dir == LinphoneSubscriptionOutgoing){
return (LinphoneAddress*)sal_op_get_from_address(lev->op);
}else{
return (LinphoneAddress*)sal_op_get_to_address(lev->op);
}
}
LinphoneCore *linphone_event_get_core(const LinphoneEvent *lev){
......@@ -497,3 +477,4 @@ BELLE_SIP_INSTANCIATE_VPTR(LinphoneEvent, belle_sip_object_t,
_linphone_event_marshall,
FALSE
);
......@@ -48,7 +48,7 @@ struct _LinphoneFactory {
char *ring_resources_dir;
char *image_resources_dir;
char *msplugins_dir;
/*these are the cached result computed from directories set by the application*/
char *cached_data_resources_dir;
char *cached_sound_resources_dir;
......@@ -67,7 +67,7 @@ static void linphone_factory_uninit(LinphoneFactory *obj){
STRING_RESET(obj->ring_resources_dir);
STRING_RESET(obj->image_resources_dir);
STRING_RESET(obj->msplugins_dir);
STRING_RESET(obj->cached_data_resources_dir);
STRING_RESET(obj->cached_sound_resources_dir);
STRING_RESET(obj->cached_ring_resources_dir);
......@@ -94,7 +94,7 @@ static void _linphone_factory_destroying_cb(void) {
#define ADD_SUPPORTED_VIDEO_DEFINITION(factory, width, height, name) \
(factory)->supported_video_definitions = bctbx_list_append((factory)->supported_video_definitions, \
linphone_video_definition_new(width, height, name))
linphone_video_definition_ref(linphone_video_definition_new(width, height, name)))
static void initialize_supported_video_definitions(LinphoneFactory *factory) {
#if !defined(__ANDROID__) && !TARGET_OS_IPHONE
......@@ -163,7 +163,7 @@ LinphoneCoreCbs *linphone_factory_create_core_cbs(const LinphoneFactory *factory
}
LinphoneAddress *linphone_factory_create_address(const LinphoneFactory *factory, const char *addr) {
return linphone_address_new(addr);
return _linphone_address_new(addr);
}
LinphoneAuthInfo *linphone_factory_create_auth_info(const LinphoneFactory *factory, const char *username, const char *userid, const char *passwd, const char *ha1, const char *realm, const char *domain) {
......@@ -179,8 +179,7 @@ LinphoneVcard *linphone_factory_create_vcard(LinphoneFactory *factory) {
}
LinphoneVideoDefinition * linphone_factory_create_video_definition(const LinphoneFactory *factory, unsigned int width, unsigned int height) {
LinphoneVideoDefinition *supported = linphone_factory_find_supported_video_definition(factory, width, height);
return supported ? linphone_video_definition_clone(supported) : linphone_video_definition_new(width, height, NULL);
return linphone_video_definition_ref(linphone_video_definition_new(width, height, NULL));
}
LinphoneVideoDefinition * linphone_factory_create_video_definition_from_name(const LinphoneFactory *factory, const char *name) {
......@@ -202,17 +201,16 @@ LinphoneVideoDefinition * linphone_factory_find_supported_video_definition(const
const bctbx_list_t *item;
const bctbx_list_t *supported = linphone_factory_get_supported_video_definitions(factory);
LinphoneVideoDefinition *searched_vdef = linphone_video_definition_new(width, height, NULL);
LinphoneVideoDefinition *found = NULL;
for (item = supported; item != NULL; item = bctbx_list_next(item)) {
LinphoneVideoDefinition *svdef = (LinphoneVideoDefinition *)bctbx_list_get_data(item);
if (linphone_video_definition_equals(svdef, searched_vdef)) {
found = svdef;
break;
linphone_video_definition_unref(searched_vdef);
return linphone_video_definition_clone(svdef);
}
}
linphone_video_definition_unref(searched_vdef);
return found;
return searched_vdef;
}
LinphoneVideoDefinition * linphone_factory_find_supported_video_definition_by_name(const LinphoneFactory *factory, const char *name) {
......@@ -222,7 +220,7 @@ LinphoneVideoDefinition * linphone_factory_find_supported_video_definition_by_na
for (item = supported; item != NULL; item = bctbx_list_next(item)) {
LinphoneVideoDefinition *svdef = (LinphoneVideoDefinition *)bctbx_list_get_data(item);
if (strcmp(linphone_video_definition_get_name(svdef), name) == 0) {
return svdef;
return linphone_video_definition_clone(svdef);
}
}
return NULL;
......@@ -303,9 +301,9 @@ void linphone_factory_set_msplugins_dir(LinphoneFactory *factory, const char *pa
}
LinphoneErrorInfo *linphone_factory_create_error_info(LinphoneFactory *factory){
return linphone_error_info_new();
}
LinphoneRange *linphone_factory_create_range(LinphoneFactory *factory) {
......@@ -318,4 +316,4 @@ LinphoneTransports *linphone_factory_create_transports(LinphoneFactory *factory)
LinphoneVideoActivationPolicy *linphone_factory_create_video_activation_policy(LinphoneFactory *factory) {
return linphone_video_activation_policy_new();
}
}
\ No newline at end of file
################################################################################
############################################################################
# CMakeLists.txt
# Copyright (C) 2017 Belledonne Communications, Grenoble France
#
################################################################################
############################################################################
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
...