Commit 60802389 authored by Ghislain MARY's avatar Ghislain MARY

Change the account creator API so that it is wrapper-friendly.

parent 18141ff1
......@@ -52,7 +52,7 @@ set(LINPHONE_PRIVATE_HEADER_FILES
set(LINPHONE_SOURCE_FILES_C
account_creator.c
account_creator_request_engine.c
account_creator_service.c
address.c
authentication.c
bellesip_sal/sal_address_impl.c
......
......@@ -26,7 +26,7 @@ lib_LTLIBRARIES=liblinphone.la
liblinphone_la_SOURCES=\
account_creator.c \
account_creator_request_engine.c \
account_creator_service.c \
address.c \
authentication.c \
buffer.c \
......
This diff is collapsed.
/*
account_creator_request_engine.c
Copyright (C) 2017 Belledonne Communications SARL
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/account_creator_request_engine.h"
#include "linphone/core.h"
#include "private.h"
BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(LinphoneAccountCreatorRequestCbs);
BELLE_SIP_INSTANCIATE_VPTR(LinphoneAccountCreatorRequestCbs, belle_sip_object_t,
NULL, // destroy
NULL, // clone
NULL, // marshal
FALSE
);
/************************** Start Account Creator requests_cbs **************************/
LinphoneAccountCreatorRequestCbs * linphone_account_creator_requests_cbs_new(void) {
return belle_sip_object_new(LinphoneAccountCreatorRequestCbs);
}
LinphoneAccountCreatorRequestCbs * linphone_account_creator_requests_cbs_ref(LinphoneAccountCreatorRequestCbs *requests_cbs) {
belle_sip_object_ref(requests_cbs);
return requests_cbs;
}
void linphone_account_creator_requests_cbs_unref(LinphoneAccountCreatorRequestCbs *requests_cbs) {
belle_sip_object_unref(requests_cbs);
}
void *linphone_account_creator_requests_cbs_get_user_data(const LinphoneAccountCreatorRequestCbs *requests_cbs) {
return requests_cbs->user_data;
}
void linphone_account_creator_requests_cbs_set_user_data(LinphoneAccountCreatorRequestCbs *requests_cbs, void *ud) {
requests_cbs->user_data = ud;
}
LinphoneAccountCreatorRequestFunc linphone_account_creator_requests_cbs_get_constructor_cb(const LinphoneAccountCreatorRequestCbs *requests_cbs) {
return requests_cbs->account_creator_request_constructor_cb;
}
void linphone_account_creator_requests_cbs_set_constructor_cb(LinphoneAccountCreatorRequestCbs *requests_cbs, LinphoneAccountCreatorRequestFunc cb) {
requests_cbs->account_creator_request_constructor_cb = cb;
}
LinphoneAccountCreatorRequestFunc linphone_account_creator_requests_cbs_get_destructor_cb(const LinphoneAccountCreatorRequestCbs *requests_cbs) {
return requests_cbs->account_creator_request_destructor_cb;
}
void linphone_account_creator_requests_cbs_set_destructor_cb(LinphoneAccountCreatorRequestCbs *requests_cbs, LinphoneAccountCreatorRequestFunc cb) {
requests_cbs->account_creator_request_destructor_cb = cb;
}
LinphoneAccountCreatorRequestFunc linphone_account_creator_requests_cbs_get_create_account_cb(const LinphoneAccountCreatorRequestCbs *requests_cbs) {
return requests_cbs->create_account_request_cb;
}
void linphone_account_creator_requests_cbs_set_create_account_cb(LinphoneAccountCreatorRequestCbs *requests_cbs, LinphoneAccountCreatorRequestFunc cb) {
requests_cbs->create_account_request_cb = cb;
}
LinphoneAccountCreatorRequestFunc linphone_account_creator_requests_cbs_get_is_account_exist_cb(const LinphoneAccountCreatorRequestCbs *requests_cbs) {
return requests_cbs->is_account_exist_request_cb;
}
void linphone_account_creator_requests_cbs_set_is_account_exist_cb(LinphoneAccountCreatorRequestCbs *requests_cbs, LinphoneAccountCreatorRequestFunc cb) {
requests_cbs->is_account_exist_request_cb = cb;
}
LinphoneAccountCreatorRequestFunc linphone_account_creator_requests_cbs_get_activate_account_cb(const LinphoneAccountCreatorRequestCbs *requests_cbs) {
return requests_cbs->activate_account_request_cb;
}
void linphone_account_creator_requests_cbs_set_activate_account_cb(LinphoneAccountCreatorRequestCbs *requests_cbs, LinphoneAccountCreatorRequestFunc cb) {
requests_cbs->activate_account_request_cb = cb;
}
LinphoneAccountCreatorRequestFunc linphone_account_creator_requests_cbs_get_is_account_activated_cb(const LinphoneAccountCreatorRequestCbs *requests_cbs) {
return requests_cbs->is_account_activated_request_cb;
}
void linphone_account_creator_requests_cbs_set_is_account_activated_cb(LinphoneAccountCreatorRequestCbs *requests_cbs, LinphoneAccountCreatorRequestFunc cb) {
requests_cbs->is_account_activated_request_cb = cb;
}
LinphoneAccountCreatorRequestFunc linphone_account_creator_requests_cbs_get_link_account_cb(const LinphoneAccountCreatorRequestCbs *requests_cbs) {
return requests_cbs->link_account_request_cb;
}
void linphone_account_creator_requests_cbs_set_link_account_cb(LinphoneAccountCreatorRequestCbs *requests_cbs, LinphoneAccountCreatorRequestFunc cb) {
requests_cbs->link_account_request_cb = cb;
}
LinphoneAccountCreatorRequestFunc linphone_account_creator_requests_cbs_get_activate_alias_cb(const LinphoneAccountCreatorRequestCbs *requests_cbs) {
return requests_cbs->activate_alias_request_cb;
}
void linphone_account_creator_requests_cbs_set_activate_alias_cb(LinphoneAccountCreatorRequestCbs *requests_cbs, LinphoneAccountCreatorRequestFunc cb) {
requests_cbs->activate_alias_request_cb = cb;
}
LinphoneAccountCreatorRequestFunc linphone_account_creator_requests_cbs_get_is_alias_used_cb(const LinphoneAccountCreatorRequestCbs *requests_cbs) {
return requests_cbs->is_alias_used_request_cb;
}
void linphone_account_creator_requests_cbs_set_is_alias_used_cb(LinphoneAccountCreatorRequestCbs *requests_cbs, LinphoneAccountCreatorRequestFunc cb) {
requests_cbs->is_alias_used_request_cb = cb;
}
LinphoneAccountCreatorRequestFunc linphone_account_creator_requests_cbs_get_is_account_linked_cb(const LinphoneAccountCreatorRequestCbs *requests_cbs) {
return requests_cbs->is_account_linked_request_cb;
}
void linphone_account_creator_requests_cbs_set_is_account_linked_cb(LinphoneAccountCreatorRequestCbs *requests_cbs, LinphoneAccountCreatorRequestFunc cb) {
requests_cbs->is_account_linked_request_cb = cb;
}
LinphoneAccountCreatorRequestFunc linphone_account_creator_requests_cbs_get_recover_account_cb(const LinphoneAccountCreatorRequestCbs *requests_cbs) {
return requests_cbs->is_account_linked_request_cb;
}
void linphone_account_creator_requests_cbs_set_recover_account_cb(LinphoneAccountCreatorRequestCbs *requests_cbs, LinphoneAccountCreatorRequestFunc cb) {
requests_cbs->recover_account_request_cb = cb;
}
LinphoneAccountCreatorRequestFunc linphone_account_creator_requests_cbs_get_update_account_cb(const LinphoneAccountCreatorRequestCbs *requests_cbs) {
return requests_cbs->update_account_request_cb;
}
void linphone_account_creator_requests_cbs_set_update_account_cb(LinphoneAccountCreatorRequestCbs *requests_cbs, LinphoneAccountCreatorRequestFunc cb) {
requests_cbs->update_account_request_cb = cb;
}
/************************** End Account Creator requests_cbs **************************/
void linphone_core_set_account_creator_request_engine_cbs(LinphoneCore *lc, LinphoneAccountCreatorRequestCbs *cbs) {
if (lc->default_ac_request_cbs)
linphone_account_creator_requests_cbs_unref(lc->default_ac_request_cbs);
lc->default_ac_request_cbs = cbs;
}
LinphoneAccountCreatorRequestCbs* linphone_core_get_account_creator_request_engine_cbs(LinphoneCore *lc) {
return lc->default_ac_request_cbs;
}
/*
account_creator_service.c
Copyright (C) 2017 Belledonne Communications SARL
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/account_creator_service.h"
#include "linphone/core.h"
#include "private.h"
BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(LinphoneAccountCreatorService);
BELLE_SIP_INSTANCIATE_VPTR(LinphoneAccountCreatorService, belle_sip_object_t,
NULL, // destroy
NULL, // clone
NULL, // marshal
FALSE
);
/************************** Start Account Creator service **************************/
LinphoneAccountCreatorService * linphone_account_creator_service_new(void) {
return belle_sip_object_new(LinphoneAccountCreatorService);
}
LinphoneAccountCreatorService * linphone_account_creator_service_ref(LinphoneAccountCreatorService *service) {
belle_sip_object_ref(service);
return service;
}
void linphone_account_creator_service_unref(LinphoneAccountCreatorService *service) {
belle_sip_object_unref(service);
}
void *linphone_account_creator_service_get_user_data(const LinphoneAccountCreatorService *service) {
return service->user_data;
}
void linphone_account_creator_service_set_user_data(LinphoneAccountCreatorService *service, void *ud) {
service->user_data = ud;
}
LinphoneAccountCreatorRequestFunc linphone_account_creator_service_get_constructor_cb(const LinphoneAccountCreatorService *service) {
return service->account_creator_service_constructor_cb;
}
void linphone_account_creator_service_set_constructor_cb(LinphoneAccountCreatorService *service, LinphoneAccountCreatorRequestFunc cb) {
service->account_creator_service_constructor_cb = cb;
}
LinphoneAccountCreatorRequestFunc linphone_account_creator_service_get_destructor_cb(const LinphoneAccountCreatorService *service) {
return service->account_creator_service_destructor_cb;
}
void linphone_account_creator_service_set_destructor_cb(LinphoneAccountCreatorService *service, LinphoneAccountCreatorRequestFunc cb) {
service->account_creator_service_destructor_cb = cb;
}
LinphoneAccountCreatorRequestFunc linphone_account_creator_service_get_create_account_cb(const LinphoneAccountCreatorService *service) {
return service->create_account_request_cb;
}
void linphone_account_creator_service_set_create_account_cb(LinphoneAccountCreatorService *service, LinphoneAccountCreatorRequestFunc cb) {
service->create_account_request_cb = cb;
}
LinphoneAccountCreatorRequestFunc linphone_account_creator_service_get_is_account_exist_cb(const LinphoneAccountCreatorService *service) {
return service->is_account_exist_request_cb;
}
void linphone_account_creator_service_set_is_account_exist_cb(LinphoneAccountCreatorService *service, LinphoneAccountCreatorRequestFunc cb) {
service->is_account_exist_request_cb = cb;
}
LinphoneAccountCreatorRequestFunc linphone_account_creator_service_get_activate_account_cb(const LinphoneAccountCreatorService *service) {
return service->activate_account_request_cb;
}
void linphone_account_creator_service_set_activate_account_cb(LinphoneAccountCreatorService *service, LinphoneAccountCreatorRequestFunc cb) {
service->activate_account_request_cb = cb;
}
LinphoneAccountCreatorRequestFunc linphone_account_creator_service_get_is_account_activated_cb(const LinphoneAccountCreatorService *service) {
return service->is_account_activated_request_cb;
}
void linphone_account_creator_service_set_is_account_activated_cb(LinphoneAccountCreatorService *service, LinphoneAccountCreatorRequestFunc cb) {
service->is_account_activated_request_cb = cb;
}
LinphoneAccountCreatorRequestFunc linphone_account_creator_service_get_link_account_cb(const LinphoneAccountCreatorService *service) {
return service->link_account_request_cb;
}
void linphone_account_creator_service_set_link_account_cb(LinphoneAccountCreatorService *service, LinphoneAccountCreatorRequestFunc cb) {
service->link_account_request_cb = cb;
}
LinphoneAccountCreatorRequestFunc linphone_account_creator_service_get_activate_alias_cb(const LinphoneAccountCreatorService *service) {
return service->activate_alias_request_cb;
}
void linphone_account_creator_service_set_activate_alias_cb(LinphoneAccountCreatorService *service, LinphoneAccountCreatorRequestFunc cb) {
service->activate_alias_request_cb = cb;
}
LinphoneAccountCreatorRequestFunc linphone_account_creator_service_get_is_alias_used_cb(const LinphoneAccountCreatorService *service) {
return service->is_alias_used_request_cb;
}
void linphone_account_creator_service_set_is_alias_used_cb(LinphoneAccountCreatorService *service, LinphoneAccountCreatorRequestFunc cb) {
service->is_alias_used_request_cb = cb;
}
LinphoneAccountCreatorRequestFunc linphone_account_creator_service_get_is_account_linked_cb(const LinphoneAccountCreatorService *service) {
return service->is_account_linked_request_cb;
}
void linphone_account_creator_service_set_is_account_linked_cb(LinphoneAccountCreatorService *service, LinphoneAccountCreatorRequestFunc cb) {
service->is_account_linked_request_cb = cb;
}
LinphoneAccountCreatorRequestFunc linphone_account_creator_service_get_recover_account_cb(const LinphoneAccountCreatorService *service) {
return service->is_account_linked_request_cb;
}
void linphone_account_creator_service_set_recover_account_cb(LinphoneAccountCreatorService *service, LinphoneAccountCreatorRequestFunc cb) {
service->recover_account_request_cb = cb;
}
LinphoneAccountCreatorRequestFunc linphone_account_creator_service_get_update_account_cb(const LinphoneAccountCreatorService *service) {
return service->update_account_request_cb;
}
void linphone_account_creator_service_set_update_account_cb(LinphoneAccountCreatorService *service, LinphoneAccountCreatorRequestFunc cb) {
service->update_account_request_cb = cb;
}
/************************** End Account Creator service **************************/
void linphone_core_set_account_creator_service(LinphoneCore *lc, LinphoneAccountCreatorService *service) {
if (lc->default_ac_service)
linphone_account_creator_service_unref(lc->default_ac_service);
lc->default_ac_service = service;
}
LinphoneAccountCreatorService * linphone_core_get_account_creator_service(LinphoneCore *lc) {
return lc->default_ac_service;
}
......@@ -2080,21 +2080,21 @@ static void linphone_core_internal_subscription_state_changed(LinphoneCore *lc,
}
}
static void _linphone_core_init_account_creator_request_cbs(LinphoneCore *lc) {
LinphoneAccountCreatorRequestCbs *cbs = linphone_account_creator_requests_cbs_new();
cbs->account_creator_request_constructor_cb = linphone_account_creator_constructor_custom;
cbs->account_creator_request_destructor_cb = NULL;
cbs->create_account_request_cb = linphone_account_creator_create_account_custom;
cbs->is_account_exist_request_cb = linphone_account_creator_is_account_exist_custom;
cbs->activate_account_request_cb = linphone_account_creator_activate_account_custom;
cbs->is_account_activated_request_cb = linphone_account_creator_is_account_activated_custom;
cbs->link_account_request_cb = linphone_account_creator_link_phone_number_with_account_custom;
cbs->activate_alias_request_cb = linphone_account_creator_activate_phone_number_link_custom;
cbs->is_alias_used_request_cb = linphone_account_creator_is_phone_number_used_custom;
cbs->is_account_linked_request_cb = linphone_account_creator_is_account_linked_custom;
cbs->recover_account_request_cb = linphone_account_creator_recover_phone_account_custom;
cbs->update_account_request_cb = linphone_account_creator_update_password_custom;
linphone_core_set_account_creator_request_engine_cbs(lc, cbs);
static void _linphone_core_init_account_creator_service(LinphoneCore *lc) {
LinphoneAccountCreatorService *service = linphone_account_creator_service_new();
service->account_creator_service_constructor_cb = linphone_account_creator_constructor_linphone;
service->account_creator_service_destructor_cb = NULL;
service->create_account_request_cb = linphone_account_creator_create_account_linphone;
service->is_account_exist_request_cb = linphone_account_creator_is_account_exist_linphone;
service->activate_account_request_cb = linphone_account_creator_activate_account_linphone;
service->is_account_activated_request_cb = linphone_account_creator_is_account_activated_linphone;
service->link_account_request_cb = linphone_account_creator_link_phone_number_with_account_linphone;
service->activate_alias_request_cb = linphone_account_creator_activate_phone_number_link_linphone;
service->is_alias_used_request_cb = linphone_account_creator_is_phone_number_used_linphone;
service->is_account_linked_request_cb = linphone_account_creator_is_account_linked_linphone;
service->recover_account_request_cb = linphone_account_creator_recover_phone_account_linphone;
service->update_account_request_cb = linphone_account_creator_update_password_linphone;
linphone_core_set_account_creator_service(lc, service);
}
static void linphone_core_init(LinphoneCore * lc, LinphoneCoreCbs *cbs, LpConfig *config, void * userdata){
......@@ -2112,7 +2112,7 @@ static void linphone_core_init(LinphoneCore * lc, LinphoneCoreCbs *cbs, LpConfig
linphone_task_list_init(&lc->hooks);
_linphone_core_init_account_creator_request_cbs(lc);
_linphone_core_init_account_creator_service(lc);
linphone_core_cbs_set_notify_received(internal_cbs, linphone_core_internal_notify_received);
linphone_core_cbs_set_subscription_state_changed(internal_cbs, linphone_core_internal_subscription_state_changed);
......@@ -5763,8 +5763,8 @@ static void linphone_core_uninit(LinphoneCore *lc)
if (lc->im_encryption_engine) {
linphone_im_encryption_engine_unref(lc->im_encryption_engine);
}
if (lc->default_ac_request_cbs) {
linphone_account_creator_requests_cbs_unref(lc->default_ac_request_cbs);
if (lc->default_ac_service) {
linphone_account_creator_service_unref(lc->default_ac_service);
}
linphone_core_free_payload_types(lc);
......
This diff is collapsed.
......@@ -1128,7 +1128,7 @@ struct _LinphoneCore
LinphoneAddress *default_rls_addr; /*default resource list server*/
LinphoneImEncryptionEngine *im_encryption_engine;
struct _LinphoneAccountCreatorRequestCbs *default_ac_request_cbs;
struct _LinphoneAccountCreatorService *default_ac_service;
MSBandwidthController *bw_controller;
};
......@@ -1414,12 +1414,12 @@ BELLE_SIP_DECLARE_VPTR_NO_EXPORT(LinphoneXmlRpcSession);
* Account creator interface *
****************************************************************************/
struct _LinphoneAccountCreatorRequestCbs {
struct _LinphoneAccountCreatorService {
belle_sip_object_t base;
void *user_data;
LinphoneAccountCreatorRequestFunc account_creator_request_constructor_cb; /**< Constructor */
LinphoneAccountCreatorRequestFunc account_creator_request_destructor_cb; /**< Destructor */
LinphoneAccountCreatorRequestFunc account_creator_service_constructor_cb; /**< Constructor */
LinphoneAccountCreatorRequestFunc account_creator_service_destructor_cb; /**< Destructor */
LinphoneAccountCreatorRequestFunc create_account_request_cb; /**< Request to create account */
LinphoneAccountCreatorRequestFunc is_account_exist_request_cb; /**< Request to know if account exist */
......@@ -1436,28 +1436,28 @@ struct _LinphoneAccountCreatorRequestCbs {
LinphoneAccountCreatorRequestFunc update_account_request_cb; /**< Request to update account */
};
BELLE_SIP_DECLARE_VPTR(LinphoneAccountCreatorRequestCbs);
BELLE_SIP_DECLARE_VPTR(LinphoneAccountCreatorService);
struct _LinphoneAccountCreatorResponseCbs {
struct _LinphoneAccountCreatorCbs {
belle_sip_object_t base;
void *user_data;
LinphoneAccountCreatorResponseFunc create_account_response_cb; /**< Response of create_account request */
LinphoneAccountCreatorResponseFunc is_account_exist_response_cb; /**< Response of is_account_exist request */
LinphoneAccountCreatorCbsStatusCb create_account_response_cb; /**< Response of create_account request */
LinphoneAccountCreatorCbsStatusCb is_account_exist_response_cb; /**< Response of is_account_exist request */
LinphoneAccountCreatorResponseFunc activate_account_response_cb; /**< Response of activate_account request */
LinphoneAccountCreatorResponseFunc is_account_activated_response_cb; /**< Response of is_account_activated request */
LinphoneAccountCreatorCbsStatusCb activate_account_response_cb; /**< Response of activate_account request */
LinphoneAccountCreatorCbsStatusCb is_account_activated_response_cb; /**< Response of is_account_activated request */
LinphoneAccountCreatorResponseFunc link_account_response_cb; /**< Response of link_account request */
LinphoneAccountCreatorResponseFunc activate_alias_response_cb; /**< Response of activation alias */
LinphoneAccountCreatorResponseFunc is_alias_used_response_cb; /**< Response of is_alias_used request */
LinphoneAccountCreatorResponseFunc is_account_linked_response_cb; /**< Response of is_account_linked request */
LinphoneAccountCreatorCbsStatusCb link_account_response_cb; /**< Response of link_account request */
LinphoneAccountCreatorCbsStatusCb activate_alias_response_cb; /**< Response of activation alias */
LinphoneAccountCreatorCbsStatusCb is_alias_used_response_cb; /**< Response of is_alias_used request */
LinphoneAccountCreatorCbsStatusCb is_account_linked_response_cb; /**< Response of is_account_linked request */
LinphoneAccountCreatorResponseFunc recover_account_response_cb; /**< Response of recover_account request */
LinphoneAccountCreatorResponseFunc update_account_response_cb; /**< Response of update_account request */
LinphoneAccountCreatorCbsStatusCb recover_account_response_cb; /**< Response of recover_account request */
LinphoneAccountCreatorCbsStatusCb update_account_response_cb; /**< Response of update_account request */
};
BELLE_SIP_DECLARE_VPTR(LinphoneAccountCreatorResponseCbs);
BELLE_SIP_DECLARE_VPTR(LinphoneAccountCreatorCbs);
struct _LinphoneAccountCreator {
belle_sip_object_t base;
......@@ -1465,8 +1465,8 @@ struct _LinphoneAccountCreator {
LinphoneCore *core;
/* AccountCreator */
LinphoneAccountCreatorRequestCbs *requests_cbs; /**< Account creator requests cbs */
LinphoneAccountCreatorResponseCbs *responses_cbs; /**< Account creator responses cbs */
LinphoneAccountCreatorService *service; /**< Account creator service */
LinphoneAccountCreatorCbs *cbs; /**< Account creator cbs */
LinphoneXmlRpcSession *xmlrpc_session; /**< XML-RPC session */
LinphoneProxyConfig *proxy_cfg; /**< Default proxy config */
......@@ -1492,6 +1492,85 @@ struct _LinphoneAccountCreator {
BELLE_SIP_DECLARE_VPTR_NO_EXPORT(LinphoneAccountCreator);
/**
* Account creator custom to set Linphone default values
* @param[in] creator LinphoneAccountCreator object
* @return LinphoneAccountCreatorStatusRequestOk if the request has been sent, LinphoneAccountCreatorStatusRequestFailed otherwise
**/
LINPHONE_PUBLIC LinphoneAccountCreatorStatus linphone_account_creator_constructor_linphone(LinphoneAccountCreator *creator);
/**
* Send an XML-RPC request to test the existence of a Linphone account.
* @param[in] creator LinphoneAccountCreator object
* @return LinphoneAccountCreatorStatusRequestOk if the request has been sent, LinphoneAccountCreatorStatusRequestFailed otherwise
**/
LINPHONE_PUBLIC LinphoneAccountCreatorStatus linphone_account_creator_is_account_exist_linphone(LinphoneAccountCreator *creator);
/**
* Send an XML-RPC request to create a Linphone account.
* @param[in] creator LinphoneAccountCreator object
* @return LinphoneAccountCreatorStatusRequestOk if the request has been sent, LinphoneAccountCreatorStatusRequestFailed otherwise
**/
LINPHONE_PUBLIC LinphoneAccountCreatorStatus linphone_account_creator_create_account_linphone(LinphoneAccountCreator *creator);
/**
* Send an XML-RPC request to activate a Linphone account.
* @param[in] creator LinphoneAccountCreator object
* @return LinphoneAccountCreatorStatusRequestOk if the request has been sent, LinphoneAccountCreatorStatusRequestFailed otherwise
**/
LINPHONE_PUBLIC LinphoneAccountCreatorStatus linphone_account_creator_activate_account_linphone(LinphoneAccountCreator *creator);
/**
* Send an XML-RPC request to test the validation of a Linphone account.
* @param[in] creator LinphoneAccountCreator object
* @return LinphoneAccountCreatorStatusRequestOk if the request has been sent, LinphoneAccountCreatorStatusRequestFailed otherwise
**/
LINPHONE_PUBLIC LinphoneAccountCreatorStatus linphone_account_creator_is_account_activated_linphone(LinphoneAccountCreator *creator);
/**
* Send an XML-RPC request to test the existence a phone number with a Linphone account.
* @param[in] creator LinphoneAccountCreator object
* @return LinphoneAccountCreatorStatusRequestOk if the request has been sent, LinphoneAccountCreatorStatusRequestFailed otherwise
**/
LINPHONE_PUBLIC LinphoneAccountCreatorStatus linphone_account_creator_is_phone_number_used_linphone(LinphoneAccountCreator *creator);
/**
* Send an XML-RPC request to link a phone number with a Linphone account.
* @param[in] creator LinphoneAccountCreator object
* @return LinphoneAccountCreatorStatusRequestOk if the request has been sent, LinphoneAccountCreatorStatusRequestFailed otherwise
**/
LINPHONE_PUBLIC LinphoneAccountCreatorStatus linphone_account_creator_link_phone_number_with_account_linphone(LinphoneAccountCreator *creator);
/**
* Send an XML-RPC request to activate the link of a phone number with a Linphone account.
* @param[in] creator LinphoneAccountCreator object
* @return LinphoneAccountCreatorStatusRequestOk if the request has been sent, LinphoneAccountCreatorStatusRequestFailed otherwise
**/
LINPHONE_PUBLIC LinphoneAccountCreatorStatus linphone_account_creator_activate_phone_number_link_linphone(LinphoneAccountCreator *creator);
/**
* Send an XML-RPC request to a Linphone account with the phone number.
* @param[in] creator LinphoneAccountCreator object
* @return LinphoneAccountCreatorStatusRequestOk if the request has been sent, LinphoneAccountCreatorStatusRequestFailed otherwise
**/
LINPHONE_PUBLIC LinphoneAccountCreatorStatus linphone_account_creator_recover_phone_account_linphone(LinphoneAccountCreator *creator);
/**
* Send an XML-RPC request to ask if an account is linked with a phone number
* @param[in] creator LinphoneAccountCreator object
* @return if this account is linked with a phone number
**/
LINPHONE_PUBLIC LinphoneAccountCreatorStatus linphone_account_creator_is_account_linked_linphone(LinphoneAccountCreator *creator);
/**
* Send an XML-RPC request to ask if an account is linked with a phone number
* @param[in] creator LinphoneAccountCreator object
* @param[in] new_pwd const char * : new password for the account creator
* @return LinphoneAccountCreatorStatusRequestOk if everything is OK, or a specific error otherwise.
**/
LINPHONE_PUBLIC LinphoneAccountCreatorStatus linphone_account_creator_update_password_linphone(LinphoneAccountCreator *creator);
/*****************************************************************************
* CardDAV interface *
****************************************************************************/
......@@ -1638,8 +1717,8 @@ LINPHONE_PUBLIC LinphoneImEncryptionEngine *linphone_im_encryption_engine_new(Li
BELLE_SIP_DECLARE_TYPES_BEGIN(linphone,10000)
BELLE_SIP_TYPE_ID(LinphoneAccountCreator),
BELLE_SIP_TYPE_ID(LinphoneAccountCreatorRequestCbs),
BELLE_SIP_TYPE_ID(LinphoneAccountCreatorResponseCbs),
BELLE_SIP_TYPE_ID(LinphoneAccountCreatorCbs),
BELLE_SIP_TYPE_ID(LinphoneAccountCreatorService),
BELLE_SIP_TYPE_ID(LinphoneBuffer),
BELLE_SIP_TYPE_ID(LinphoneContactProvider),
BELLE_SIP_TYPE_ID(LinphoneContactSearch),
......
......@@ -31,9 +31,9 @@ static LinphoneAccountCreator * linphone_gtk_assistant_get_creator(GtkWidget *w)
return (LinphoneAccountCreator *)g_object_get_data(G_OBJECT(w), "creator");
}
static void linphone_gtk_create_account_cb(LinphoneAccountCreator *creator, LinphoneRequestStatus status, const char* resp) {
static void linphone_gtk_create_account_cb(LinphoneAccountCreator *creator, LinphoneAccountCreatorStatus status, const char* resp) {
GtkWidget *assistant = (GtkWidget *)linphone_account_creator_get_user_data(creator);
if (status == LinphoneRequestAccountCreated) {
if (status == LinphoneAccountCreatorStatusAccountCreated) {
// Go to page_6_linphone_account_validation_wait
gtk_assistant_set_current_page(GTK_ASSISTANT(assistant), 6);
} else { // Error when attempting to create the account
......@@ -48,9 +48,9 @@ static void create_account(GtkWidget *assistant) {
linphone_account_creator_create_account(creator);
}
static void linphone_gtk_test_account_validation_cb(LinphoneAccountCreator *creator, LinphoneRequestStatus status, const char* resp) {
static void linphone_gtk_test_account_validation_cb(LinphoneAccountCreator *creator, LinphoneAccountCreatorStatus status, const char* resp) {
GtkWidget *assistant = (GtkWidget *)linphone_account_creator_get_user_data(creator);
if (status == LinphoneRequestAccountActivated) {
if (status == LinphoneAccountCreatorStatusAccountActivated) {
// Go to page_9_finish
gtk_assistant_set_current_page(GTK_ASSISTANT(assistant), 9);
} else {
......@@ -215,11 +215,11 @@ static gboolean update_interface_with_username_availability(GtkWidget *page) {
GtkLabel* usernameError = GTK_LABEL(linphone_gtk_get_widget(assistant, "p4_label_error"));
int account_status = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(page), "is_username_used"));
if (account_status == LinphoneRequestAccountNotExist) {
if (account_status == LinphoneAccountCreatorStatusAccountNotExist) {
g_object_set_data(G_OBJECT(page), "is_username_available", GINT_TO_POINTER(1));
gtk_image_set_from_stock(isUsernameOk, GTK_STOCK_OK, GTK_ICON_SIZE_LARGE_TOOLBAR);
gtk_label_set_text(usernameError, "");
} else if (account_status == LinphoneRequestAccountExist) {
} else if (account_status == LinphoneAccountCreatorStatusAccountExist) {
gtk_label_set_text(usernameError, _("Username is already in use!"));
g_object_set_data(G_OBJECT(page), "is_username_available", GINT_TO_POINTER(0));
gtk_image_set_from_stock(isUsernameOk, GTK_STOCK_NO, GTK_ICON_SIZE_LARGE_TOOLBAR);
......@@ -232,7 +232,7 @@ static gboolean update_interface_with_username_availability(GtkWidget *page) {
return FALSE;
}
static void linphone_gtk_test_account_existence_cb(LinphoneAccountCreator *creator, LinphoneRequestStatus status, const char* resp) {
static void linphone_gtk_test_account_existence_cb(LinphoneAccountCreator *creator, LinphoneAccountCreatorStatus status, const char* resp) {
GtkWidget *assistant = (GtkWidget *)linphone_account_creator_get_user_data(creator);
GtkWidget *page = gtk_assistant_get_nth_page(GTK_ASSISTANT(assistant), gtk_assistant_get_current_page(GTK_ASSISTANT(assistant)));
g_object_set_data(G_OBJECT(page), "is_username_used", GINT_TO_POINTER(status));
......@@ -324,11 +324,11 @@ void linphone_gtk_account_creation_password_changed(GtkEntry *entry) {
static void linphone_gtk_assistant_init(GtkWidget *w) {
LinphoneAccountCreator *creator = linphone_account_creator_new(linphone_gtk_get_core(), "https://subscribe.linphone.org:444/wizard.php");
LinphoneAccountCreatorResponseCbs *cbs = linphone_account_creator_get_responses_cbs(creator);
LinphoneAccountCreatorCbs *cbs = linphone_account_creator_get_callbacks(creator);
linphone_account_creator_set_user_data(creator, w);
linphone_account_creator_responses_cbs_set_is_account_exist_cb(cbs, linphone_gtk_test_account_existence_cb);
linphone_account_creator_responses_cbs_set_is_account_activated_cb(cbs, linphone_gtk_test_account_validation_cb);
linphone_account_creator_responses_cbs_set_create_account_cb(cbs, linphone_gtk_create_account_cb);
linphone_account_creator_cbs_set_is_account_exist(cbs, linphone_gtk_test_account_existence_cb);
linphone_account_creator_cbs_set_is_account_activated(cbs, linphone_gtk_test_account_validation_cb);
linphone_account_creator_cbs_set_create_account(cbs, linphone_gtk_create_account_cb);
g_object_set_data(G_OBJECT(w), "creator", creator);
gtk_assistant_set_forward_page_func(GTK_ASSISTANT(w), linphone_gtk_assistant_forward, w, NULL);
......
......@@ -22,7 +22,7 @@
set(HEADER_FILES
account_creator.h
account_creator_request_engine.h
account_creator_service.h
address.h
auth_info.h
buffer.h
......
......@@ -2,7 +2,7 @@ linphone_includedir=$(includedir)/linphone
linphone_include_HEADERS=\
account_creator.h \
account_creator_request_engine.h \
account_creator_service.h \
address.h \
auth_info.h \
buffer.h \
......
This diff is collapsed.
......@@ -33,7 +33,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "linphone/sipsetup.h"
#include "linphone/account_creator.h"
#include "linphone/account_creator_request_engine.h"
#include "linphone/account_creator_service.h"
#include "linphone/address.h"
#include "linphone/auth_info.h"
#include "linphone/buffer.h"
......@@ -1909,18 +1909,18 @@ LINPHONE_PUBLIC void linphone_core_abort_authentication(LinphoneCore *lc, Linpho
LINPHONE_PUBLIC void linphone_core_clear_all_auth_info(LinphoneCore *lc);
/**
* Sets an default account creator request cbs in the core
* Sets an default account creator service in the core
* @param lc LinphoneCore object
* @param cbs LinphoneAccountCreatorRequestCbs object
* @param cbs LinphoneAccountCreatorService object
**/
LINPHONE_PUBLIC void linphone_core_set_account_creator_request_engine_cbs(LinphoneCore *lc, LinphoneAccountCreatorRequestCbs *cbs);
LINPHONE_PUBLIC void linphone_core_set_account_creator_service(LinphoneCore *lc, LinphoneAccountCreatorService *service);
/**
* Get default account creator request cbs from the core
* Get default account creator service from the core
* @param lc LinphoneCore object
* @return LinphoneAccountCreatorRequestCbs object
* @return LinphoneAccountCreatorService object
**/
LINPHONE_PUBLIC LinphoneAccountCreatorRequestCbs* linphone_core_get_account_creator_request_engine_cbs(LinphoneCore *lc);
LINPHONE_PUBLIC LinphoneAccountCreatorService * linphone_core_get_account_creator_service(LinphoneCore *lc);
/**
* Enable or disable the audio adaptive jitter compensation.
......
......@@ -34,121 +34,122 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
typedef struct _LinphoneAccountCreator LinphoneAccountCreator;
/**
* An object to handle the requests callbacks for handling the LinphoneAccountCreator server requests.
* An object to define a LinphoneAccountCreator service.
* @ingroup account_creator
* @donotwrap
**/
typedef struct _LinphoneAccountCreatorRequestCbs LinphoneAccountCreatorRequestCbs;
typedef struct _LinphoneAccountCreatorService LinphoneAccountCreatorService;
/**
* An object to handle the responses callbacks for handling the LinphoneAccountCreator operations.
* @ingroup account_creator
**/
typedef struct _LinphoneAccountCreatorResponseCbs LinphoneAccountCreatorResponseCbs;
typedef struct _LinphoneAccountCreatorCbs LinphoneAccountCreatorCbs;
/**
* Enum describing Phone number checking.
* @ingroup account_creator_checking
* @ingroup account_creator
**/
typedef enum _LinphonePhoneNumberCheck {