account_creator_service.c 6.74 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
/*
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"
22 23

#include "c-wrapper/c-wrapper.h"
24

25 26 27
// TODO: From coreapi. Remove me later.
#include "private.h"

28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165
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;
}