Commit 156896a4 authored by Sylvain Berfini's avatar Sylvain Berfini 🎩
Browse files

Fixed newly created account creator method not wrapped

parent f7742c21
......@@ -730,6 +730,11 @@ LinphoneAccountCreatorStatus linphone_account_creator_recover_account(LinphoneAc
LinphoneAccountCreatorStatus linphone_account_creator_update_account(LinphoneAccountCreator *creator) {
return creator->service->update_account_request_cb(creator);
}
LinphoneAccountCreatorStatus linphone_account_creator_login_linphone_account(LinphoneAccountCreator *creator) {
return creator->service->login_linphone_account_request_cb(creator);
}
/************************** End Account Creator data **************************/
/************************** Start Account Creator Linphone **************************/
......@@ -964,7 +969,20 @@ static void _login_account_confirmation_key_cb_custom(LinphoneXmlRpcRequest *req
const auto &it2 = bctbx_map_cchar_find_key(resp, "algorithm");
if (!bctbx_iterator_equals(it2, bctbx_map_cchar_end(resp))) {
const char *algo = (const char *)bctbx_pair_cchar_get_second(bctbx_iterator_cchar_get_pair(it2));
set_string(&creator->algorithm, algo, FALSE);
if (algo) {
if (creator->algorithm) {
if (strcmp(algo, creator->algorithm) != 0) {
ms_warning("Asked for password hashed using %s, got algorithm %s", creator->algorithm, algo);
} else {
ms_debug("Got password hashed using %s that we requested", algo);
}
} else {
ms_debug("Account creator wasn't configured for a specific alogithm, got %s", algo);
}
set_string(&creator->algorithm, algo, FALSE);
} else {
ms_error("Couldn't get algorithm from struct response !");
}
}
}
......@@ -975,7 +993,7 @@ static void _login_account_confirmation_key_cb_custom(LinphoneXmlRpcRequest *req
NOTIFY_IF_EXIST(Status, login_linphone_account, creator, status, content)
}
LinphoneAccountCreatorStatus linphone_account_creator_login_linphone_account(LinphoneAccountCreator *creator) {
LinphoneAccountCreatorStatus linphone_account_creator_login_linphone_account_linphone(LinphoneAccountCreator *creator) {
LinphoneXmlRpcRequest *request = NULL;
if ((!creator->username && !creator->phone_number) || !creator->activation_code) {
if (creator->cbs->login_linphone_account_response_cb != NULL) {
......
......@@ -47,6 +47,7 @@ struct _LinphoneAccountCreatorService {
LinphoneAccountCreatorRequestFunc recover_account_request_cb; /**< Request to recover account */
LinphoneAccountCreatorRequestFunc update_account_request_cb; /**< Request to update account */
LinphoneAccountCreatorRequestFunc login_linphone_account_request_cb; /**< Request to get password & algorithm from confirmation key */
};
BELLE_SIP_DECLARE_VPTR_NO_EXPORT(LinphoneAccountCreatorService);
......@@ -210,7 +211,7 @@ LINPHONE_PUBLIC LinphoneAccountCreatorStatus linphone_account_creator_update_pas
* @param[in] creator LinphoneAccountCreator object
* @return LinphoneAccountCreatorStatusRequestOk if everything is OK, or a specific error otherwise.
**/
LINPHONE_PUBLIC LinphoneAccountCreatorStatus linphone_account_creator_login_linphone_account(LinphoneAccountCreator *creator);
LINPHONE_PUBLIC LinphoneAccountCreatorStatus linphone_account_creator_login_linphone_account_linphone(LinphoneAccountCreator *creator);
#ifdef __cplusplus
}
......
......@@ -152,6 +152,14 @@ void linphone_account_creator_service_set_update_account_cb(LinphoneAccountCreat
service->update_account_request_cb = cb;
}
LinphoneAccountCreatorRequestFunc linphone_account_creator_service_get_login_linphone_account_cb(const LinphoneAccountCreatorService *service) {
return service->login_linphone_account_request_cb;
}
void linphone_account_creator_service_set_login_linphone_account_cb(LinphoneAccountCreatorService *service, LinphoneAccountCreatorRequestFunc cb) {
service->login_linphone_account_request_cb = cb;
}
/************************** End Account Creator service **************************/
void linphone_core_set_account_creator_service(LinphoneCore *lc, LinphoneAccountCreatorService *service) {
......
......@@ -2385,6 +2385,7 @@ static void _linphone_core_init_account_creator_service(LinphoneCore *lc) {
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;
service->login_linphone_account_request_cb = linphone_account_creator_login_linphone_account_linphone;
linphone_core_set_account_creator_service(lc, service);
}
......
......@@ -125,6 +125,13 @@ LINPHONE_PUBLIC LinphoneAccountCreatorStatus linphone_account_creator_recover_ac
**/
LINPHONE_PUBLIC LinphoneAccountCreatorStatus linphone_account_creator_update_account(LinphoneAccountCreator *creator);
/**
* Send a request to get the password & algorithm of an account using the confirmation key
* @param[in] creator #LinphoneAccountCreator object
* @return #LinphoneAccountCreatorStatusRequestOk if everything is OK, or a specific error otherwise.
**/
LINPHONE_PUBLIC LinphoneAccountCreatorStatus linphone_account_creator_login_linphone_account(LinphoneAccountCreator *creator);
/**
* Acquire a reference to the LinphoneAccountCreator.
* @param[in] creator #LinphoneAccountCreator object.
......
......@@ -269,6 +269,22 @@ LINPHONE_PUBLIC LinphoneAccountCreatorRequestFunc linphone_account_creator_servi
**/
LINPHONE_PUBLIC void linphone_account_creator_service_set_update_account_cb(LinphoneAccountCreatorService *service, LinphoneAccountCreatorRequestFunc cb);
/**
* Get the login linphone account request.
* @param[in] service #LinphoneAccountCreatorService object.
* @return The current login linphone account request.
* @donotwrap
**/
LINPHONE_PUBLIC LinphoneAccountCreatorRequestFunc linphone_account_creator_service_get_login_linphone_account_cb(const LinphoneAccountCreatorService *service);
/**
* Assign a user pointer to a #LinphoneAccountCreatorService object.
* @param[in] service #LinphoneAccountCreatorService object.
* @param[in] cb The login linphone account request to be used.
* @donotwrap
**/
LINPHONE_PUBLIC void linphone_account_creator_service_set_login_linphone_account_cb(LinphoneAccountCreatorService *service, LinphoneAccountCreatorRequestFunc cb);
/************************** End Account Creator Requests **************************/
#ifdef __cplusplus
......
......@@ -41,6 +41,7 @@ static void init_linphone_account_creator_service(LinphoneCore *lc) {
linphone_account_creator_service_set_is_account_linked_cb(service, linphone_account_creator_is_account_linked_linphone);
linphone_account_creator_service_set_recover_account_cb(service, linphone_account_creator_recover_phone_account_linphone);
linphone_account_creator_service_set_update_account_cb(service, linphone_account_creator_update_password_linphone);
linphone_account_creator_service_set_login_linphone_account_cb(service, linphone_account_creator_login_linphone_account_linphone);
linphone_core_set_account_creator_service(lc, service);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment