{
char *text_value = NULL;
- if (text_data != NULL) {
+ if (text_data != NULL)
text_value = strdup(text_data);
- }
+
return text_value;
}
-//FIXME : add true singleton logic
AccountManager *
-_account_manager_get_instance ()
+_account_manager_get_instance()
{
_INFO("_account_manager_get_instance");
- if (_acc_mgr != NULL)
- {
+ if (_acc_mgr != NULL) {
_INFO("instance already created.");
return _acc_mgr;
}
-#if !GLIB_CHECK_VERSION(2,35,0)
+#if !GLIB_CHECK_VERSION(2, 35, 0)
g_type_init();
#endif
GDBusConnection *connection = NULL;
GError *error = NULL;
- connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &error);
+ connection = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error);
_INFO("after g_bus_get_sync");
_ERR("Unable account_manager_proxy_new_sync: %s", error->message);
g_clear_error(&error);
}
- if(connection)
+ if (connection)
g_object_unref(connection);
return NULL;
}
return _acc_mgr;
}
-GDBusErrorEntry _account_svc_errors[] =
-{
+GDBusErrorEntry _account_svc_errors[] = {
{ACCOUNT_ERROR_NONE, _ACCOUNT_SVC_ERROR_PREFIX".NoError"},
{ACCOUNT_ERROR_OUT_OF_MEMORY, _ACCOUNT_SVC_ERROR_PREFIX".OutOfMemory"},
{ACCOUNT_ERROR_INVALID_PARAMETER, _ACCOUNT_SVC_ERROR_PREFIX".InvalidParameter"},
static int _account_get_error_code(bool is_success, GError *error)
{
- if (!is_success)
- {
+ if (!is_success) {
_INFO("Received error Domain[%d] Message[%s] Code[%d]", error->domain, error->message, error->code);
- if (g_dbus_error_is_remote_error(error))
- {
+ if (g_dbus_error_is_remote_error(error)) {
gchar *remote_error = g_dbus_error_get_remote_error(error);
- if (remote_error)
- {
+ if (remote_error) {
_INFO("Remote error[%s]", remote_error);
- //FIXME: Temp fix, error->code sent from daemon is not the same as the one received.
- //However error->message matches, so doing reverse lookup
+ /* FIXME: Temp fix, error->code sent from daemon is not the same as the one received.
+ However error->message matches, so doing reverse lookup */
int error_enum_count = G_N_ELEMENTS(_account_svc_errors);
int i = 0;
- for (i = 0; i < error_enum_count; i++)
- {
- if (g_strcmp0(_account_svc_errors[i].dbus_error_name, remote_error) == 0)
- {
+ for (i = 0; i < error_enum_count; i++) {
+ if (g_strcmp0(_account_svc_errors[i].dbus_error_name, remote_error) == 0) {
_INFO("Remote error code matched[%d]", _account_svc_errors[i].error_code);
g_free(remote_error);
return _account_svc_errors[i].error_code;
g_free(remote_error);
}
}
- //All undocumented errors mapped to ACCOUNT_ERROR_PERMISSION_DENIED
+ /* All undocumented errors mapped to ACCOUNT_ERROR_PERMISSION_DENIED */
return ACCOUNT_ERROR_PERMISSION_DENIED;
}
return ACCOUNT_ERROR_NONE;
ACCOUNT_RETURN_VAL((account != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("ACCOUNT HANDLE IS NULL"));
ACCOUNT_RETURN_VAL((account_db_id != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("ACCOUNT ID POINTER IS NULL"));
- account_s *account_data = (account_s*) account;
+ account_s *account_data = (account_s *)account;
int error_code = ACCOUNT_ERROR_NONE;
GError *error = NULL;
_INFO("2. Before _account_manager_get_instance()");
- AccountManager* acc_mgr = _account_manager_get_instance();
+ AccountManager *acc_mgr = _account_manager_get_instance();
ACCOUNT_CATCH_ERROR((acc_mgr != NULL), {}, ACCOUNT_ERROR_PERMISSION_DENIED, "Failed to get dbus.");
int db_id = -1;
- GVariant* account_serialized = marshal_account(account_data);
+ GVariant *account_serialized = marshal_account(account_data);
_INFO("3. Before account_manager_call_account_add_sync");
bool is_success = account_manager_call_account_add_sync(acc_mgr, account_serialized, (int)getuid(), &db_id, NULL, &error);
CATCH:
g_clear_error(&error);
- //Failed to get dbus.
_ERR("account_manager_call_account_add_sync()=[%d]", error_code);
return error_code;
GError *error = NULL;
- AccountManager* acc_mgr = _account_manager_get_instance();
- if (acc_mgr == NULL)
- {
+ AccountManager *acc_mgr = _account_manager_get_instance();
+ if (acc_mgr == NULL) {
_ERR("g_bus_get_sync failed");
return ACCOUNT_ERROR_PERMISSION_DENIED;
}
GVariant *account_serialized_old = NULL;
bool is_success = account_manager_call_account_query_account_by_account_id_sync(acc_mgr, account_db_id, (int)getuid(), &account_serialized_old, NULL, &error);
- if (!is_success)
- {
+ if (!is_success) {
error_code = _account_get_error_code(is_success, error);
g_clear_error(&error);
_ERR("account_manager_call_account_query_account_by_account_id_sync failed [%d]", error_code);
_INFO("3. Before account_manager_call_account_delete_from_db_by_id_sync");
is_success = account_manager_call_account_delete_from_db_by_id_sync(acc_mgr, account_db_id, (int)getuid(), NULL, &error);
- if (!is_success)
- {
+ if (!is_success) {
error_code = _account_get_error_code(is_success, error);
_ERR("account_manager_call_account_delete_from_db_by_id_sync failed [%d]", error_code);
g_clear_error(&error);
GError *error = NULL;
- AccountManager* acc_mgr = _account_manager_get_instance();
- if (acc_mgr == NULL)
- {
+ AccountManager *acc_mgr = _account_manager_get_instance();
+ if (acc_mgr == NULL) {
_ERR("g_bus_get_sync failed");
return ACCOUNT_ERROR_PERMISSION_DENIED;
}
- GVariant* account_list_variant = NULL;
+ GVariant *account_list_variant = NULL;
bool is_success = account_manager_call_account_query_account_by_user_name_sync(acc_mgr, user_name, (int)getuid(), &account_list_variant, NULL, &error);
error_code = _account_get_error_code(is_success, error);
g_clear_error(&error);
- if (error_code != ACCOUNT_ERROR_NONE)
- {
+ if (error_code != ACCOUNT_ERROR_NONE) {
_ERR("account_query_account_by_user_name error=[%d]", error_code);
return error_code;
}
- GSList* account_list = unmarshal_account_list(account_list_variant);
+ GSList *account_list = unmarshal_account_list(account_list_variant);
g_variant_unref(account_list_variant);
if (account_list == NULL)
- {
return ACCOUNT_ERROR_NO_DATA;
- }
-
- //TODO free account_list, account_list_variant
is_success = account_manager_call_account_delete_from_db_by_user_name_sync(acc_mgr, user_name, package_name, (int)getuid(), NULL, &error);
- if (!is_success)
- {
+ if (!is_success) {
error_code = _account_get_error_code(is_success, error);
g_clear_error(&error);
_ERR("account_manager_call_account_delete_from_db_by_user_name_sync failed [%d]", error_code);
GError *error = NULL;
- AccountManager* acc_mgr = _account_manager_get_instance();
- if (acc_mgr == NULL)
- {
+ AccountManager *acc_mgr = _account_manager_get_instance();
+ if (acc_mgr == NULL) {
_ERR("g_bus_get_sync failed");
return ACCOUNT_ERROR_PERMISSION_DENIED;
}
*/
bool is_success = account_manager_call_account_delete_from_db_by_package_name_sync(acc_mgr, package_name, permission, (int)getuid(), NULL, &error);
- if (!is_success)
- {
+ if (!is_success) {
error_code = _account_get_error_code(is_success, error);
g_clear_error(&error);
_ERR("account_manager_call_account_delete_from_db_by_package_name_sync failed [%d]", error_code);
ACCOUNT_API int account_update_to_db_by_id(account_h account, int account_id)
{
- //First we will update account db
_INFO("1. account_update_to_db_by_id start");
int error_code = ACCOUNT_ERROR_NONE;
GError *error = NULL;
- AccountManager* acc_mgr = _account_manager_get_instance();
- if (acc_mgr == NULL)
- {
+ AccountManager *acc_mgr = _account_manager_get_instance();
+ if (acc_mgr == NULL) {
_ERR("g_bus_get_sync failed");
return ACCOUNT_ERROR_PERMISSION_DENIED;
}
GVariant *account_serialized_old = NULL;
bool is_success = account_manager_call_account_query_account_by_account_id_sync(acc_mgr, account_id, (int)getuid(), &account_serialized_old, NULL, &error);
- if (!is_success)
- {
+ if (!is_success) {
error_code = _account_get_error_code(is_success, error);
g_clear_error(&error);
_ERR("account_manager_call_account_query_account_by_account_id_sync failed [%d]", error_code);
g_clear_error(&error);
_INFO("3. Before account_manager_call_account_update_to_db_by_id_sync");
- GVariant* account_serialized = marshal_account((account_s*) account);
+ GVariant *account_serialized = marshal_account((account_s *)account);
is_success = account_manager_call_account_update_to_db_by_id_sync(acc_mgr, account_serialized, account_id, (int)getuid(), NULL, &error);
- if (!is_success)
- {
+ if (!is_success) {
error_code = _account_get_error_code(is_success, error);
g_clear_error(&error);
_ERR("account_manager_call_account_update_to_db_by_id_sync failed [%d]", error_code);
ACCOUNT_INTERNAL_API int account_update_to_db_by_id_without_permission(account_h account, int account_id)
{
- //First we will update account db
- //Then we will update gSSO DB, if it fails then we will rollback account db updates
-
_INFO("account_update_to_db_by_id_without_permission start");
int error_code = ACCOUNT_ERROR_NONE;
GError *error = NULL;
- AccountManager* acc_mgr = _account_manager_get_instance();
- if (acc_mgr == NULL)
- {
+ AccountManager *acc_mgr = _account_manager_get_instance();
+ if (acc_mgr == NULL) {
_ERR("g_bus_get_sync failed");
return ACCOUNT_ERROR_PERMISSION_DENIED;
}
_INFO("before query() account_id[%d]", account_id);
bool is_success = account_manager_call_account_query_account_by_account_id_sync(acc_mgr, account_id, (int)getuid(), &account_serialized_old, NULL, &error);
- if (!is_success)
- {
+ if (!is_success) {
error_code = _account_get_error_code(is_success, error);
g_clear_error(&error);
_ERR("account_manager_call_account_query_account_by_account_id_sync failed [%d]", error_code);
}
g_clear_error(&error);
- _INFO("before marshal() : account_id[%d], user_name=%s", account_id, ((account_s*)account)->user_name);
- GVariant* account_serialized = marshal_account((account_s*) account);
+ _INFO("before marshal() : account_id[%d], user_name=%s", account_id, ((account_s *)account)->user_name);
+ GVariant *account_serialized = marshal_account((account_s *)account);
_INFO("after marshal() : account_id[%d]", account_id);
- if (account_serialized == NULL)
- {
+ if (account_serialized == NULL) {
_ERR("Invalid input");
return ACCOUNT_ERROR_INVALID_PARAMETER;
}
is_success = account_manager_call_account_update_to_db_by_id_ex_sync(acc_mgr, account_serialized, account_id, (int)getuid(), NULL, &error);
_INFO("after call update() : is_success=%d", is_success);
- if (!is_success)
- {
+ if (!is_success) {
error_code = _account_get_error_code(is_success, error);
g_clear_error(&error);
_ERR("account_manager_call_account_update_to_db_by_id_ex_sync failed [%d]", error_code);
ACCOUNT_API int account_update_to_db_by_user_name(account_h account, const char *user_name, const char *package_name)
{
- //First we will update account db
_INFO("account_update_to_db_by_user_name starting");
int error_code = ACCOUNT_ERROR_NONE;
GError *error = NULL;
- AccountManager* acc_mgr = _account_manager_get_instance();
- if (acc_mgr == NULL)
- {
+ AccountManager *acc_mgr = _account_manager_get_instance();
+ if (acc_mgr == NULL) {
_ERR("g_bus_get_sync failed");
return ACCOUNT_ERROR_PERMISSION_DENIED;
}
GVariant *account_serialized_old = NULL;
- account_s *account_data = (account_s*) account;
+ account_s *account_data = (account_s *)account;
bool is_success = account_manager_call_account_query_account_by_account_id_sync(acc_mgr, account_data->id, (int)getuid(), &account_serialized_old, NULL, &error);
- if (!is_success)
- {
+ if (!is_success) {
error_code = _account_get_error_code(is_success, error);
g_clear_error(&error);
_ERR("account_manager_call_account_query_account_by_account_id_sync failed [%d]", error_code);
}
g_clear_error(&error);
- GVariant* account_serialized = marshal_account(account_data);
+ GVariant *account_serialized = marshal_account(account_data);
is_success = account_manager_call_account_update_to_db_by_user_name_sync(acc_mgr, account_serialized, user_name, package_name, (int)getuid(), NULL, &error);
- if (!is_success)
- {
+ if (!is_success) {
error_code = _account_get_error_code(is_success, error);
g_clear_error(&error);
_ERR("account_manager_call_account_update_to_db_by_user_name_sync failed [%d]", error_code);
return ACCOUNT_ERROR_INVALID_PARAMETER;
}
- account_s *data = (account_s*)malloc(sizeof(account_s));
+ account_s *data = (account_s *)malloc(sizeof(account_s));
if (data == NULL) {
ACCOUNT_FATAL("Memory Allocation Failed");
return ACCOUNT_ERROR_OUT_OF_MEMORY;
ACCOUNT_MEMSET(data, 0, sizeof(account_s));
- /*Setting account as visible by default*/
+ /* Setting account as visible by default */
data->secret = ACCOUNT_SECRECY_VISIBLE;
- /*Setting account as not supporting sync by default*/
+ /* Setting account as not supporting sync by default */
data->sync_support = ACCOUNT_SYNC_NOT_SUPPORT;
data->auth_type = ACCOUNT_AUTH_TYPE_INVALID;
-// data->account_list = NULL;
data->capablity_list = NULL;
data->custom_list = NULL;
-// data->domain_list = NULL;
-// data->mechanism_list = NULL;
*account = (account_h)data;
ACCOUNT_API int account_destroy(account_h account)
{
_INFO("account_destroy start");
- account_s *data = (account_s*)account;
+ account_s *data = (account_s *)account;
ACCOUNT_RETURN_VAL((data != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("Account handle is null!"));
return ACCOUNT_ERROR_INVALID_PARAMETER;
}
- account_s *data = (account_s*)account;
+ account_s *data = (account_s *)account;
_ACCOUNT_FREE(data->user_name);
data->user_name = _account_get_text(user_name);
return ACCOUNT_ERROR_INVALID_PARAMETER;
}
- account_s *data = (account_s*)account;
+ account_s *data = (account_s *)account;
_ACCOUNT_FREE(data->display_name);
data->display_name = _account_get_text(display_name);
return ACCOUNT_ERROR_INVALID_PARAMETER;
}
- account_s *data = (account_s*)account;
+ account_s *data = (account_s *)account;
_ACCOUNT_FREE(data->email_address);
data->email_address = _account_get_text(email_address);
return ACCOUNT_ERROR_INVALID_PARAMETER;
}
- account_s *data = (account_s*)account;
+ account_s *data = (account_s *)account;
_ACCOUNT_FREE(data->icon_path);
data->icon_path = _account_get_text(icon_path);
ACCOUNT_SLOGE("(%s)-(%d) source is NULL.\n", __FUNCTION__, __LINE__);
return ACCOUNT_ERROR_INVALID_PARAMETER;
}
- account_s *data = (account_s*)account;
+ account_s *data = (account_s *)account;
_ACCOUNT_FREE(data->source);
data->source = _account_get_text(source);
return ACCOUNT_ERROR_INVALID_PARAMETER;
}
- account_s *data = (account_s*)account;
+ account_s *data = (account_s *)account;
_ACCOUNT_FREE(data->package_name);
data->package_name = _account_get_text(package_name);
ACCOUNT_SLOGE("(%s)-(%d) domain_name is NULL.\n", __FUNCTION__, __LINE__);
return ACCOUNT_ERROR_INVALID_PARAMETER;
}
- account_s *data = (account_s*)account;
+ account_s *data = (account_s *)account;
_ACCOUNT_FREE(data->domain_name);
data->domain_name = _account_get_text(domain_name);
return ACCOUNT_ERROR_INVALID_PARAMETER;
}
- account_s *data = (account_s*)account;
+ account_s *data = (account_s *)account;
_ACCOUNT_FREE(data->access_token);
data->access_token = _account_get_text(access_token);
return ACCOUNT_ERROR_INVALID_PARAMETER;
}
- account_s *data = (account_s*)account;
+ account_s *data = (account_s *)account;
_ACCOUNT_FREE(data->user_data_txt[idx]);
data->user_data_txt[idx] = _account_get_text(user_txt);
return ACCOUNT_ERROR_NONE;
}
-ACCOUNT_API int account_set_custom(account_h account, const char* key, const char* value)
+ACCOUNT_API int account_set_custom(account_h account, const char *key, const char *value)
{
if (!account) {
ACCOUNT_SLOGE("(%s)-(%d) account handle is NULL.\n", __FUNCTION__, __LINE__);
return ACCOUNT_ERROR_INVALID_PARAMETER;
}
- account_s *data = (account_s*)account;
+ account_s *data = (account_s *)account;
GSList *iter;
bool b_is_new = TRUE;
for (iter = data->custom_list; iter != NULL; iter = g_slist_next(iter)) {
- account_custom_s* custom_data = NULL;
- custom_data = (account_custom_s*)iter->data;
- ACCOUNT_SLOGD( "account_custom_s->key = %s, account_custom_s->value = %s \n", custom_data->key, custom_data->value);
+ account_custom_s *custom_data = NULL;
+ custom_data = (account_custom_s *)iter->data;
+ ACCOUNT_SLOGD("account_custom_s->key = %s, account_custom_s->value = %s \n", custom_data->key, custom_data->value);
- if(!strcmp(custom_data->key, key)) {
+ if (!strcmp(custom_data->key, key)) {
char *new_value = NULL;
new_value = _account_get_text(value);
if (new_value == NULL) {
}
}
- if(b_is_new) {
+ if (b_is_new) {
int error_code = ACCOUNT_ERROR_NONE;
- account_custom_s* custom_data = (account_custom_s*)malloc(sizeof(account_custom_s));
+ account_custom_s* custom_data = (account_custom_s *)malloc(sizeof(account_custom_s));
if (custom_data == NULL) {
ACCOUNT_FATAL("Memory Allocation Failed");
return ACCOUNT_ERROR_OUT_OF_MEMORY;
{
ACCOUNT_RETURN_VAL((account != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("(%s)-(%d) account handle is NULL.\n", __FUNCTION__, __LINE__));
- if ( ((int)auth_type < 0) || (auth_type > ACCOUNT_AUTH_TYPE_CLIENT_LOGIN)) {
+ if (((int)auth_type < 0) || (auth_type > ACCOUNT_AUTH_TYPE_CLIENT_LOGIN))
return ACCOUNT_ERROR_INVALID_PARAMETER;
- }
- account_s *data = (account_s*)account;
+ account_s *data = (account_s *)account;
data->auth_type = (int)auth_type;
{
ACCOUNT_RETURN_VAL((account != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("(%s)-(%d) account handle is NULL.\n", __FUNCTION__, __LINE__));
- if ( ((int)secret < 0) || (secret > ACCOUNT_SECRECY_VISIBLE)) {
+ if (((int)secret < 0) || (secret > ACCOUNT_SECRECY_VISIBLE))
return ACCOUNT_ERROR_INVALID_PARAMETER;
- }
- account_s *data = (account_s*)account;
+ account_s *data = (account_s *)account;
data->secret = (int)secret;
{
ACCOUNT_RETURN_VAL((account != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("(%s)-(%d) account handle is NULL.\n", __FUNCTION__, __LINE__));
- if ( ((int)sync_support < 0) || (sync_support > ACCOUNT_SUPPORTS_SYNC)) {
+ if (((int)sync_support < 0) || (sync_support > ACCOUNT_SUPPORTS_SYNC))
return ACCOUNT_ERROR_INVALID_PARAMETER;
- }
- account_s *data = (account_s*)account;
+ account_s *data = (account_s *)account;
- data->sync_support= (int)sync_support;
+ data->sync_support = (int)sync_support;
return ACCOUNT_ERROR_NONE;
}
ACCOUNT_API int account_set_user_int(account_h account, int idx, const int user_int)
{
- if (!account) {
+ if (!account)
return ACCOUNT_ERROR_INVALID_PARAMETER;
- }
- if (idx >= USER_INT_CNT ||idx < 0) {
+ if (idx >= USER_INT_CNT || idx < 0)
return ACCOUNT_ERROR_INVALID_PARAMETER;
- }
- account_s *data = (account_s*)account;
+ account_s *data = (account_s *)account;
data->user_data_int[idx] = user_int;
return ACCOUNT_ERROR_NONE;
}
-ACCOUNT_API int account_set_capability(account_h account, const char* capability_type, account_capability_state_e capability_value)
+ACCOUNT_API int account_set_capability(account_h account, const char *capability_type, account_capability_state_e capability_value)
{
ACCOUNT_RETURN_VAL((account != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("account handle is null"));
ACCOUNT_RETURN_VAL((capability_type != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("capability_type is null"));
- if ((capability_value != ACCOUNT_CAPABILITY_DISABLED) && (capability_value != ACCOUNT_CAPABILITY_ENABLED)) {
+ if ((capability_value != ACCOUNT_CAPABILITY_DISABLED) && (capability_value != ACCOUNT_CAPABILITY_ENABLED))
return ACCOUNT_ERROR_INVALID_PARAMETER;
- }
- account_s *data = (account_s*)account;
+ account_s *data = (account_s *)account;
GSList *iter = NULL;
bool b_is_new = TRUE;
- for(iter = data->capablity_list; iter != NULL; iter = g_slist_next(iter)) {
+ for (iter = data->capablity_list; iter != NULL; iter = g_slist_next(iter)) {
account_capability_s *cap_data = NULL;
- cap_data = (account_capability_s*)iter->data;
+ cap_data = (account_capability_s *)iter->data;
- if(!strcmp(cap_data->type, capability_type)) {
+ if (!strcmp(cap_data->type, capability_type)) {
cap_data->value = capability_value;
b_is_new = FALSE;
break;
}
}
- if(b_is_new) {
- account_capability_s* cap_data = (account_capability_s*)malloc(sizeof(account_capability_s));
+ if (b_is_new) {
+ account_capability_s *cap_data = (account_capability_s *)malloc(sizeof(account_capability_s));
if (cap_data == NULL) {
ACCOUNT_FATAL("Memory Allocation Failed");
return ACCOUNT_ERROR_OUT_OF_MEMORY;
ACCOUNT_API int account_get_user_name(account_h account, char **user_name)
{
- if (!account) {
+ if (!account)
return ACCOUNT_ERROR_INVALID_PARAMETER;
- }
- if (!user_name) {
+ if (!user_name)
return ACCOUNT_ERROR_INVALID_PARAMETER;
- }
- account_s *data = (account_s*)account;
+ account_s *data = (account_s *)account;
(*user_name) = NULL;
*user_name = _account_get_text(data->user_name);
ACCOUNT_API int account_get_display_name(account_h account, char **display_name)
{
- if (!account) {
+ if (!account)
return ACCOUNT_ERROR_INVALID_PARAMETER;
- }
- if (!display_name) {
+ if (!display_name)
return ACCOUNT_ERROR_INVALID_PARAMETER;
- }
- account_s *data = (account_s*)account;
+ account_s *data = (account_s *)account;
(*display_name) = NULL;
return ACCOUNT_ERROR_NONE;
}
-ACCOUNT_API int account_get_email_address(account_h account,char **email_address)
+ACCOUNT_API int account_get_email_address(account_h account, char **email_address)
{
- if (!account) {
+ if (!account)
return ACCOUNT_ERROR_INVALID_PARAMETER;
- }
- if (!email_address) {
+ if (!email_address)
return ACCOUNT_ERROR_INVALID_PARAMETER;
- }
- account_s *data = (account_s*)account;
+ account_s *data = (account_s *)account;
(*email_address) = NULL;
ACCOUNT_API int account_get_icon_path(account_h account, char **icon_path)
{
- if (!account) {
+ if (!account)
return ACCOUNT_ERROR_INVALID_PARAMETER;
- }
- if (!icon_path) {
+ if (!icon_path)
return ACCOUNT_ERROR_INVALID_PARAMETER;
- }
- account_s *data = (account_s*)account;
+ account_s *data = (account_s *)account;
(*icon_path) = NULL;
ACCOUNT_API int account_get_source(account_h account, char **source)
{
- if (!account) {
+ if (!account)
return ACCOUNT_ERROR_INVALID_PARAMETER;
- }
- if (!source) {
+ if (!source)
return ACCOUNT_ERROR_INVALID_PARAMETER;
- }
- account_s *data = (account_s*)account;
+ account_s *data = (account_s *)account;
(*source) = NULL;
ACCOUNT_API int account_get_package_name(account_h account, char **package_name)
{
- if (!account) {
+ if (!account)
return ACCOUNT_ERROR_INVALID_PARAMETER;
- }
- if (!package_name) {
+ if (!package_name)
return ACCOUNT_ERROR_INVALID_PARAMETER;
- }
- account_s *data = (account_s*)account;
+ account_s *data = (account_s *)account;
(*package_name) = NULL;
ACCOUNT_API int account_get_domain_name(account_h account, char **domain_name)
{
- if (!account) {
+ if (!account)
return ACCOUNT_ERROR_INVALID_PARAMETER;
- }
- if (!domain_name) {
+ if (!domain_name)
return ACCOUNT_ERROR_INVALID_PARAMETER;
- }
- account_s *data = (account_s*)account;
+ account_s *data = (account_s *)account;
(*domain_name) = NULL;
ACCOUNT_API int account_get_access_token(account_h account, char **access_token)
{
- if (!account) {
+ if (!account)
return ACCOUNT_ERROR_INVALID_PARAMETER;
- }
- if (!access_token) {
+ if (!access_token)
return ACCOUNT_ERROR_INVALID_PARAMETER;
- }
- account_s *data = (account_s*)account;
+ account_s *data = (account_s *)account;
(*access_token) = NULL;
ACCOUNT_API int account_get_user_text(account_h account, int user_text_index, char **text)
{
- if (!account) {
+ if (!account)
return ACCOUNT_ERROR_INVALID_PARAMETER;
- }
- if (!text) {
+ if (!text)
return ACCOUNT_ERROR_INVALID_PARAMETER;
- }
- ACCOUNT_RETURN_VAL((user_text_index >=0 && user_text_index < USER_TXT_CNT ), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("INVALID USER TEXT INDEX"));
+ ACCOUNT_RETURN_VAL((user_text_index >= 0 && user_text_index < USER_TXT_CNT), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("INVALID USER TEXT INDEX"));
- account_s *data = (account_s*)account;
+ account_s *data = (account_s *)account;
(*text) = NULL;
ACCOUNT_API int account_get_auth_type(account_h account, account_auth_type_e *auth_type)
{
- if (!account) {
+ if (!account)
return ACCOUNT_ERROR_INVALID_PARAMETER;
- }
- if (!auth_type) {
+
+ if (!auth_type)
return ACCOUNT_ERROR_INVALID_PARAMETER;
- }
- account_s* data = (account_s*)account;
+ account_s *data = (account_s *)account;
*auth_type = data->auth_type;
ACCOUNT_API int account_get_secret(account_h account, account_secrecy_state_e *secret)
{
- if (!account) {
+ if (!account)
return ACCOUNT_ERROR_INVALID_PARAMETER;
- }
- if (!secret) {
+
+ if (!secret)
return ACCOUNT_ERROR_INVALID_PARAMETER;
- }
- account_s* data = (account_s*)account;
+ account_s *data = (account_s *)account;
*secret = data->secret;
ACCOUNT_API int account_get_sync_support(account_h account, account_sync_state_e *sync_support)
{
- if (!account) {
+ if (!account)
return ACCOUNT_ERROR_INVALID_PARAMETER;
- }
- if (!sync_support) {
+
+ if (!sync_support)
return ACCOUNT_ERROR_INVALID_PARAMETER;
- }
- account_s* data = (account_s*)account;
+ account_s *data = (account_s *)account;
*sync_support = data->sync_support;
ACCOUNT_API int account_get_account_id(account_h account, int *account_id)
{
- if (!account) {
+ if (!account)
return ACCOUNT_ERROR_INVALID_PARAMETER;
- }
- if (!account_id) {
+
+ if (!account_id)
return ACCOUNT_ERROR_INVALID_PARAMETER;
- }
- account_s *data = (account_s*)account;
+ account_s *data = (account_s *)account;
*account_id = data->id;
ACCOUNT_API int account_get_user_int(account_h account, int user_int_index, int *integer)
{
- if (!account) {
+ if (!account)
return ACCOUNT_ERROR_INVALID_PARAMETER;
- }
- ACCOUNT_RETURN_VAL((user_int_index >=0 && user_int_index < USER_TXT_CNT ), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("INVALID USER TEXT INDEX"));
+ ACCOUNT_RETURN_VAL((user_int_index >= 0 && user_int_index < USER_TXT_CNT), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("INVALID USER TEXT INDEX"));
- if (!integer) {
+ if (!integer)
return ACCOUNT_ERROR_INVALID_PARAMETER;
- }
- account_s *data = (account_s*)account;
+ account_s *data = (account_s *)account;
*integer = data->user_data_int[user_int_index];
return ACCOUNT_ERROR_NONE;
}
-ACCOUNT_API int account_get_capability(account_h account, const char* capability_type, account_capability_state_e* capability_value)
+ACCOUNT_API int account_get_capability(account_h account, const char *capability_type, account_capability_state_e *capability_value)
{
ACCOUNT_RETURN_VAL((account != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("ACCOUNT HANDLE IS NULL"));
ACCOUNT_RETURN_VAL((capability_type != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("capability_type is NULL"));
ACCOUNT_RETURN_VAL((capability_value != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("capability_value is NULL"));
GSList *iter;
- account_s *data = (account_s*)account;
+ account_s *data = (account_s *)account;
for (iter = data->capablity_list; iter != NULL; iter = g_slist_next(iter)) {
account_capability_s *cap_data = NULL;
- cap_data = (account_capability_s*)iter->data;
+ cap_data = (account_capability_s *)iter->data;
- if(!strcmp(capability_type, cap_data->type)) {
+ if (!strcmp(capability_type, cap_data->type)) {
*capability_value = cap_data->value;
return ACCOUNT_ERROR_NONE;
}
ACCOUNT_RETURN_VAL((callback != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("NO CALLBACK FUNCTION"));
GSList *iter;
- account_s *data = (account_s*)account;
+ account_s *data = (account_s *)account;
for (iter = data->capablity_list; iter != NULL; iter = g_slist_next(iter)) {
account_capability_s *cap_data = NULL;
- cap_data = (account_capability_s*)iter->data;
+ cap_data = (account_capability_s *)iter->data;
- if(callback(cap_data->type, cap_data->value, user_data)!=TRUE){
+ if (callback(cap_data->type, cap_data->value, user_data) != TRUE)
return ACCOUNT_ERROR_NONE;
- }
}
return ACCOUNT_ERROR_NONE;
}
-ACCOUNT_API int account_get_custom(account_h account, const char* key, char** value)
+ACCOUNT_API int account_get_custom(account_h account, const char *key, char **value)
{
ACCOUNT_RETURN_VAL((account != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("ACCOUNT HANDLE IS NULL"));
ACCOUNT_RETURN_VAL((key != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("NO KEY TO REQUEST"));
ACCOUNT_RETURN_VAL((value != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("VALUE POINTER IS NULL"));
GSList *iter;
- account_s *data = (account_s*)account;
+ account_s *data = (account_s *)account;
for (iter = data->custom_list; iter != NULL; iter = g_slist_next(iter)) {
account_custom_s *custom_data = NULL;
- custom_data = (account_custom_s*)iter->data;
+ custom_data = (account_custom_s *)iter->data;
- if(!strcmp(key, custom_data->key)) {
+ if (!strcmp(key, custom_data->key)) {
(*value) = NULL;
*value = _account_get_text(custom_data->value);
if (custom_data->value != NULL && *value == NULL) {
return ACCOUNT_ERROR_RECORD_NOT_FOUND;
}
-ACCOUNT_API int account_get_custom_all(account_h account, account_custom_cb callback, void* user_data)
+ACCOUNT_API int account_get_custom_all(account_h account, account_custom_cb callback, void *user_data)
{
ACCOUNT_RETURN_VAL((account != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("ACCOUNT HANDLE IS NULL"));
ACCOUNT_RETURN_VAL((callback != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("NO CALLBACK FUNCTION"));
GSList *iter;
- account_s *data = (account_s*)account;
+ account_s *data = (account_s *)account;
for (iter = data->custom_list; iter != NULL; iter = g_slist_next(iter)) {
bool cb_ret = FALSE;
account_custom_s *custom_data = NULL;
- custom_data = (account_custom_s*)iter->data;
+ custom_data = (account_custom_s *)iter->data;
cb_ret = callback(custom_data->key, custom_data->value, user_data);
- if(!cb_ret) {
+ if (!cb_ret)
break;
- }
}
return ACCOUNT_ERROR_NONE;
GError *error = NULL;
- AccountManager* acc_mgr = _account_manager_get_instance();
- if (acc_mgr == NULL)
- {
+ AccountManager *acc_mgr = _account_manager_get_instance();
+ if (acc_mgr == NULL) {
_ERR("g_bus_get_sync failed");
return ACCOUNT_ERROR_PERMISSION_DENIED;
}
- GVariant* account_list_variant = NULL;
+ GVariant *account_list_variant = NULL;
bool is_success = account_manager_call_account_query_all_sync(acc_mgr, (int)getuid(), &account_list_variant, NULL, &error);
int error_code = _account_get_error_code(is_success, error);
g_clear_error(&error);
if (error_code != ACCOUNT_ERROR_NONE)
- {
return error_code;
- }
- GSList* account_list = unmarshal_account_list(account_list_variant);
+ GSList *account_list = unmarshal_account_list(account_list_variant);
g_variant_unref(account_list_variant);
- GSList* iter;
+ GSList *iter;
- for (iter = account_list; iter != NULL; iter = g_slist_next(iter))
- {
+ for (iter = account_list; iter != NULL; iter = g_slist_next(iter)) {
_INFO("iterating received account_list");
account_s *account = NULL;
- account = (account_s*)iter->data;
+ account = (account_s *)iter->data;
_INFO("Before _account_query_identity_info_by_id");
_INFO("account->id=%d", account->id);
- if (callback((account_h)account, user_data) == false)
- {
+ if (callback((account_h)account, user_data) == false) {
_INFO("application callback requested to discontinue.");
break;
}
GError *error = NULL;
- AccountManager* acc_mgr = _account_manager_get_instance();
- if (acc_mgr == NULL)
- {
+ AccountManager *acc_mgr = _account_manager_get_instance();
+ if (acc_mgr == NULL) {
_ERR("g_bus_get_sync failed");
return ACCOUNT_ERROR_PERMISSION_DENIED;
}
- GVariant* account_variant = NULL;
+ GVariant *account_variant = NULL;
bool is_success = account_manager_call_account_query_account_by_account_id_sync(acc_mgr, account_db_id, (int)getuid(), &account_variant, NULL, &error);
int error_code = _account_get_error_code(is_success, error);
g_clear_error(&error);
if (error_code != ACCOUNT_ERROR_NONE)
- {
return error_code;
- }
_INFO("before unmarshal_account");
- account_s* account_data = umarshal_account(account_variant);
+ account_s *account_data = umarshal_account(account_variant);
_INFO("after unmarshal_account");
- if (account_data == NULL)
- {
+ if (account_data == NULL) {
_ERR("Failed to unmarshal");
return ACCOUNT_ERROR_DB_FAILED;
}
return ACCOUNT_ERROR_NONE;
}
-ACCOUNT_API int account_query_account_by_user_name(account_cb callback, const char* user_name, void* user_data)
+ACCOUNT_API int account_query_account_by_user_name(account_cb callback, const char *user_name, void *user_data)
{
_INFO("account_query_account_by_user_name starting");
GError *error = NULL;
- AccountManager* acc_mgr = _account_manager_get_instance();
- if (acc_mgr == NULL)
- {
+ AccountManager *acc_mgr = _account_manager_get_instance();
+ if (acc_mgr == NULL) {
_ERR("g_bus_get_sync failed");
return ACCOUNT_ERROR_PERMISSION_DENIED;
}
- GVariant* account_list_variant = NULL;
+ GVariant *account_list_variant = NULL;
bool is_success = account_manager_call_account_query_account_by_user_name_sync(acc_mgr, user_name, (int)getuid(), &account_list_variant, NULL, &error);
int error_code = _account_get_error_code(is_success, error);
g_clear_error(&error);
if (error_code != ACCOUNT_ERROR_NONE)
- {
return error_code;
- }
- GSList* account_list = unmarshal_account_list(account_list_variant);
+ GSList *account_list = unmarshal_account_list(account_list_variant);
g_variant_unref(account_list_variant);
if (account_list == NULL)
- {
return ACCOUNT_ERROR_NO_DATA;
- }
- GSList* iter;
+ GSList *iter;
- for (iter = account_list; iter != NULL; iter = g_slist_next(iter))
- {
+ for (iter = account_list; iter != NULL; iter = g_slist_next(iter)) {
_INFO("iterating received account_list");
account_s *account = NULL;
- account = (account_s*)iter->data;
- if (callback((account_h)account, user_data) == false)
- {
+ account = (account_s *)iter->data;
+ if (callback((account_h)account, user_data) == false) {
_INFO("application callback requested to discontinue.");
break;
}
GError *error = NULL;
- AccountManager* acc_mgr = _account_manager_get_instance();
- if (acc_mgr == NULL)
- {
+ AccountManager *acc_mgr = _account_manager_get_instance();
+ if (acc_mgr == NULL) {
_ERR("g_bus_get_sync failed");
return ACCOUNT_ERROR_PERMISSION_DENIED;
}
- GVariant* account_list_variant = NULL;
+ GVariant *account_list_variant = NULL;
bool is_success = account_manager_call_account_query_account_by_package_name_sync(acc_mgr, package_name, (int)getuid(), &account_list_variant, NULL, &error);
int error_code = _account_get_error_code(is_success, error);
g_clear_error(&error);
if (error_code != ACCOUNT_ERROR_NONE)
- {
return error_code;
- }
- GSList* account_list = unmarshal_account_list(account_list_variant);
+ GSList *account_list = unmarshal_account_list(account_list_variant);
g_variant_unref(account_list_variant);
if (account_list == NULL)
- {
return ACCOUNT_ERROR_NO_DATA;
- }
- GSList* iter;
+ GSList *iter;
- for (iter = account_list; iter != NULL; iter = g_slist_next(iter))
- {
+ for (iter = account_list; iter != NULL; iter = g_slist_next(iter)) {
_INFO("iterating received account_list");
account_s *account = NULL;
- account = (account_s*)iter->data;
+ account = (account_s *)iter->data;
- if (callback((account_h)account, user_data) == false)
- {
+ if (callback((account_h)account, user_data) == false) {
_INFO("application callback requested to discontinue.");
break;
}
return ACCOUNT_ERROR_NONE;
}
-ACCOUNT_API int account_query_account_by_capability(account_cb callback, const char* capability_type, account_capability_state_e capability_value, void *user_data)
+ACCOUNT_API int account_query_account_by_capability(account_cb callback, const char *capability_type, account_capability_state_e capability_value, void *user_data)
{
_INFO("account_query_account_by_capability starting");
ACCOUNT_RETURN_VAL((capability_type != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("capability_type IS NULL"));
- if (((int)capability_value < 0) || (capability_value > ACCOUNT_CAPABILITY_ENABLED)) {
+ if (((int)capability_value < 0) || (capability_value > ACCOUNT_CAPABILITY_ENABLED)) {
ACCOUNT_SLOGE("(%s)-(%d) capability_value is not equal to 0 or 1.\n", __FUNCTION__, __LINE__);
return ACCOUNT_ERROR_INVALID_PARAMETER;
}
GError *error = NULL;
- AccountManager* acc_mgr = _account_manager_get_instance();
- if (acc_mgr == NULL)
- {
+ AccountManager *acc_mgr = _account_manager_get_instance();
+ if (acc_mgr == NULL) {
_ERR("g_bus_get_sync failed");
return ACCOUNT_ERROR_PERMISSION_DENIED;
}
- GVariant* account_list_variant = NULL;
+ GVariant *account_list_variant = NULL;
bool is_success = account_manager_call_account_query_account_by_capability_sync(acc_mgr, capability_type, capability_value, (int)getuid(), &account_list_variant, NULL, &error);
int error_code = _account_get_error_code(is_success, error);
g_clear_error(&error);
if (error_code != ACCOUNT_ERROR_NONE)
- {
return error_code;
- }
- GSList* account_list = unmarshal_account_list(account_list_variant);
+ GSList *account_list = unmarshal_account_list(account_list_variant);
g_variant_unref(account_list_variant);
if (account_list == NULL)
- {
return ACCOUNT_ERROR_NO_DATA;
- }
- GSList* iter;
+ GSList *iter;
- for (iter = account_list; iter != NULL; iter = g_slist_next(iter))
- {
+ for (iter = account_list; iter != NULL; iter = g_slist_next(iter)) {
_INFO("iterating received account_list");
account_s *account = NULL;
- account = (account_s*)iter->data;
+ account = (account_s *)iter->data;
- if (callback((account_h)account, user_data) == false)
- {
+ if (callback((account_h)account, user_data) == false) {
_INFO("application callback requested to discontinue.");
break;
}
return ACCOUNT_ERROR_NONE;
}
-ACCOUNT_API int account_query_account_by_capability_type(account_cb callback, const char* capability_type, void* user_data)
+ACCOUNT_API int account_query_account_by_capability_type(account_cb callback, const char *capability_type, void *user_data)
{
_INFO("account_query_account_by_capability_type starting");
GError *error = NULL;
- AccountManager* acc_mgr = _account_manager_get_instance();
- if (acc_mgr == NULL)
- {
+ AccountManager *acc_mgr = _account_manager_get_instance();
+ if (acc_mgr == NULL) {
_ERR("g_bus_get_sync failed");
return ACCOUNT_ERROR_PERMISSION_DENIED;
}
- GVariant* account_list_variant = NULL;
+ GVariant *account_list_variant = NULL;
bool is_success = account_manager_call_account_query_account_by_capability_type_sync(acc_mgr, capability_type, (int)getuid(), &account_list_variant, NULL, &error);
int error_code = _account_get_error_code(is_success, error);
g_clear_error(&error);
if (error_code != ACCOUNT_ERROR_NONE)
- {
return error_code;
- }
- GSList* account_list = unmarshal_account_list(account_list_variant);
+ GSList *account_list = unmarshal_account_list(account_list_variant);
g_variant_unref(account_list_variant);
if (account_list == NULL)
- {
return ACCOUNT_ERROR_NO_DATA;
- }
- GSList* iter;
+ GSList *iter;
- for (iter = account_list; iter != NULL; iter = g_slist_next(iter))
- {
+ for (iter = account_list; iter != NULL; iter = g_slist_next(iter)) {
_INFO("iterating received account_list");
account_s *account = NULL;
- account = (account_s*)iter->data;
+ account = (account_s *)iter->data;
- if (callback((account_h)account, user_data) == false)
- {
+ if (callback((account_h)account, user_data) == false) {
_INFO("application callback requested to discontinue.");
break;
}
ACCOUNT_RETURN_VAL((callback != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("NO CALLBACK FUNCTION"));
GError *error = NULL;
- AccountManager* acc_mgr = _account_manager_get_instance();
- if (acc_mgr == NULL)
- {
+ AccountManager *acc_mgr = _account_manager_get_instance();
+ if (acc_mgr == NULL) {
_ERR("g_bus_get_sync failed");
return ACCOUNT_ERROR_PERMISSION_DENIED;
}
- GVariant* capability_list_variant = NULL;
+ GVariant *capability_list_variant = NULL;
bool is_success = account_manager_call_account_query_capability_by_account_id_sync(acc_mgr, account_id, (int)getuid(), &capability_list_variant, NULL, &error);
int error_code = _account_get_error_code(is_success, error);
g_clear_error(&error);
if (error_code != ACCOUNT_ERROR_NONE)
- {
return error_code;
- }
- _INFO("before unmarshal_capability_list");
- GSList* capability_list = unmarshal_capability_list(capability_list_variant);
- _INFO("after unmarshal_capability_list");
+ GSList *capability_list = unmarshal_capability_list(capability_list_variant);
+
if (capability_list == NULL)
- {
return ACCOUNT_ERROR_NO_DATA;
- }
- GSList* iter;
+ GSList *iter;
- for (iter = capability_list; iter != NULL; iter = g_slist_next(iter))
- {
+ for (iter = capability_list; iter != NULL; iter = g_slist_next(iter)) {
_INFO("iterating received account_list");
account_capability_s *capability = NULL;
- capability = (account_capability_s*)iter->data;
- _INFO("");
- if (callback(capability->type, capability->value, user_data) == false)
- {
+ capability = (account_capability_s *)iter->data;
+ if (callback(capability->type, capability->value, user_data) == false) {
_INFO("application callback requested to discontinue.");
break;
}
- _INFO("");
}
_account_gslist_capability_free(capability_list);
{
_INFO("account_get_total_count_from_db starting");
- if (!count)
- {
+ if (!count) {
ACCOUNT_SLOGE("(%s)-(%d) count is NULL.\n", __FUNCTION__, __LINE__);
return ACCOUNT_ERROR_INVALID_PARAMETER;
}
GError *error = NULL;
- if (count == NULL)
- {
+ if (count == NULL) {
_INFO("Invalid input");
return -1;
}
- AccountManager* acc_mgr = _account_manager_get_instance();
- if (acc_mgr == NULL)
- {
+ AccountManager *acc_mgr = _account_manager_get_instance();
+ if (acc_mgr == NULL) {
_ERR("g_bus_get_sync failed");
return ACCOUNT_ERROR_PERMISSION_DENIED;
}
int error_code = _account_get_error_code(is_success, error);
g_clear_error(&error);
if (error_code != ACCOUNT_ERROR_NONE)
- {
return error_code;
- }
*count = temp_count;
_INFO("account_get_total_count_from_db end");
int error_code = ACCOUNT_ERROR_NONE;
ACCOUNT_RETURN_VAL((account_db_id > 0), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("ACCOUNT INDEX IS LESS THAN 0"));
- if ( ((int)sync_status < 0) || (sync_status > ACCOUNT_SYNC_STATUS_RUNNING)) {
+ if (((int)sync_status < 0) || (sync_status > ACCOUNT_SYNC_STATUS_RUNNING)) {
ACCOUNT_SLOGE("(%s)-(%d) sync_status is less than 0 or more than enum max.\n", __FUNCTION__, __LINE__);
return ACCOUNT_ERROR_INVALID_PARAMETER;
}
GError *error = NULL;
- AccountManager* acc_mgr = _account_manager_get_instance();
- if (acc_mgr == NULL)
- {
+ AccountManager *acc_mgr = _account_manager_get_instance();
+ if (acc_mgr == NULL) {
_ERR("g_bus_get_sync failed");
return ACCOUNT_ERROR_PERMISSION_DENIED;
}
return error_code;
}
-/*
-static int _account_type_free_label_items(label_s *data)
-{
- if(!data) {
- return ACCOUNT_ERROR_INVALID_PARAMETER;
- }
-
- _ACCOUNT_FREE(data->app_id);
- _ACCOUNT_FREE(data->label);
- _ACCOUNT_FREE(data->locale);
-
- return ACCOUNT_ERROR_NONE;
-}
-
-static int _account_type_label_gslist_free(GSList* list)
-{
- ACCOUNT_RETURN_VAL((list != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("GSlist is NULL"));
-
- GSList* iter;
-
- for (iter = list; iter != NULL; iter = g_slist_next(iter)) {
- label_s *label_data = (label_s*)iter->data;
- _account_type_free_label_items(label_data);
- _ACCOUNT_FREE(label_data);
- }
-
- g_slist_free(list);
- list = NULL;
-
- return ACCOUNT_ERROR_NONE;
-}
-
-static int _account_type_free_provider_feature_items(provider_feature_s *data)
-{
- if(!data) {
- return ACCOUNT_ERROR_INVALID_PARAMETER;
- }
-
- _ACCOUNT_FREE(data->key);
- _ACCOUNT_FREE(data->app_id);
-
- return ACCOUNT_ERROR_NONE;
-}
-
-static int _account_type_provider_feature_gslist_free(GSList* list)
-{
- ACCOUNT_RETURN_VAL((list != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("GSlist is NULL"));
-
- GSList* iter;
-
- for (iter = list; iter != NULL; iter = g_slist_next(iter)) {
- provider_feature_s *feature_data = (provider_feature_s*)iter->data;
- _account_type_free_provider_feature_items(feature_data);
- _ACCOUNT_FREE(feature_data);
- }
-
- g_slist_free(list);
- list = NULL;
-
- return ACCOUNT_ERROR_NONE;
-}
-
-static int _account_type_free_account_type_items(account_type_s *data)
-{
- if(!data) {
- return ACCOUNT_ERROR_INVALID_PARAMETER;
- }
-
- _ACCOUNT_FREE(data->app_id);
- _ACCOUNT_FREE(data->service_provider_id);
- _ACCOUNT_FREE(data->icon_path);
- _ACCOUNT_FREE(data->small_icon_path);
-
- _account_type_label_gslist_free(data->label_list);
- _account_type_provider_feature_gslist_free(data->provider_feature_list);
-// _account_type_glist_free(data->account_type_list);
-
- return ACCOUNT_ERROR_NONE;
-}
-
-static int _account_type_gslist_free(GSList* list)
-{
- ACCOUNT_RETURN_VAL((list != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("Glist is NULL"));
-
- GSList* iter;
-
- for (iter = list; iter != NULL; iter = g_slist_next(iter)) {
- account_type_s *account_type_record = (account_type_s*)iter->data;
- _account_type_free_account_type_items(account_type_record);
- _ACCOUNT_FREE(account_type_record);
- }
-
- g_slist_free(list);
- list = NULL;
-
- return ACCOUNT_ERROR_NONE;
-}
-*/
-
-/*
-static int _account_type_glist_free(GList* list)
-{
- ACCOUNT_RETURN_VAL((list != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("Glist is NULL"));
-
- GList* iter;
-
- for (iter = list; iter != NULL; iter = g_list_next(iter)) {
- account_type_s *account_type_record = (account_type_s*)iter->data;
- _account_type_free_account_type_items(account_type_record);
- _ACCOUNT_FREE(account_type_record);
- }
-
- g_list_free(list);
- list = NULL;
-
- return ACCOUNT_ERROR_NONE;
-}
-*/
ACCOUNT_API int account_type_create(account_type_h *account_type)
{
return ACCOUNT_ERROR_INVALID_PARAMETER;
}
- account_type_s *data = (account_type_s*)malloc(sizeof(account_type_s));
+ account_type_s *data = (account_type_s *)malloc(sizeof(account_type_s));
if (data == NULL) {
ACCOUNT_FATAL("Memory Allocation Failed");
return ACCOUNT_ERROR_OUT_OF_MEMORY;
data->small_icon_path = NULL;
data->multiple_account_support = false;
data->label_list = NULL;
-// data->account_type_list = NULL;
data->provider_feature_list = NULL;
*account_type = (account_type_h)data;
{
_INFO("account_type_destroy");
- account_type_s *data = (account_type_s*)account_type;
+ account_type_s *data = (account_type_s *)account_type;
- if (data == NULL)
- {
+ if (data == NULL) {
_ERR("Account type handle is null!");
return ACCOUNT_ERROR_INVALID_PARAMETER;
}
return ACCOUNT_ERROR_INVALID_PARAMETER;
}
- account_type_s *data = (account_type_s*)account_type;
+ account_type_s *data = (account_type_s *)account_type;
_ACCOUNT_FREE(data->app_id);
data->app_id = _account_get_text(app_id);
ACCOUNT_INTERNAL_API int account_type_set_service_provider_id(account_type_h account_type, const char *service_provider_id)
{
- if (!account_type) {
+ if (!account_type)
return ACCOUNT_ERROR_INVALID_PARAMETER;
- }
- if (!service_provider_id) {
+ if (!service_provider_id)
return ACCOUNT_ERROR_INVALID_PARAMETER;
- }
- account_type_s *data = (account_type_s*)account_type;
+ account_type_s *data = (account_type_s *)account_type;
_ACCOUNT_FREE(data->service_provider_id);
data->service_provider_id = _account_get_text(service_provider_id);
ACCOUNT_INTERNAL_API int account_type_set_icon_path(account_type_h account_type, const char *icon_path)
{
- if (!account_type) {
+ if (!account_type)
return ACCOUNT_ERROR_INVALID_PARAMETER;
- }
- if (!icon_path) {
+ if (!icon_path)
return ACCOUNT_ERROR_INVALID_PARAMETER;
- }
- account_type_s *data = (account_type_s*)account_type;
+ account_type_s *data = (account_type_s *)account_type;
_ACCOUNT_FREE(data->icon_path);
data->icon_path = _account_get_text(icon_path);
ACCOUNT_INTERNAL_API int account_type_set_small_icon_path(account_type_h account_type, const char *small_icon_path)
{
- if (!account_type) {
+ if (!account_type)
return ACCOUNT_ERROR_INVALID_PARAMETER;
- }
- if (!small_icon_path) {
+ if (!small_icon_path)
return ACCOUNT_ERROR_INVALID_PARAMETER;
- }
- account_type_s *data = (account_type_s*)account_type;
+ account_type_s *data = (account_type_s *)account_type;
_ACCOUNT_FREE(data->small_icon_path);
data->small_icon_path = _account_get_text(small_icon_path);
return ACCOUNT_ERROR_NONE;
}
-ACCOUNT_INTERNAL_API int account_type_set_multiple_account_support(account_type_h account_type, const bool multiple_account_support)
+ACCOUNT_INTERNAL_API int account_type_set_multiple_account_support(account_type_h account_type, bool multiple_account_support)
{
ACCOUNT_RETURN_VAL((account_type != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("(%s)-(%d) account handle is NULL.\n", __FUNCTION__, __LINE__));
- account_type_s *data = (account_type_s*)account_type;
+ account_type_s *data = (account_type_s *)account_type;
data->multiple_account_support = multiple_account_support;
return ACCOUNT_ERROR_NONE;
}
-ACCOUNT_INTERNAL_API int account_type_set_label(account_type_h account_type, const char* label, const char* locale)
+ACCOUNT_INTERNAL_API int account_type_set_label(account_type_h account_type, const char *label, const char *locale)
{
if (!account_type) {
ACCOUNT_SLOGE("(%s)-(%d) account_type handle is NULL.\n", __FUNCTION__, __LINE__);
return ACCOUNT_ERROR_INVALID_PARAMETER;
}
- if(!label || !locale) {
+ if (!label || !locale)
return ACCOUNT_ERROR_INVALID_PARAMETER;
- }
- account_type_s *data = (account_type_s*)account_type;
- label_s *label_data = (label_s*)malloc(sizeof(label_s));
+ account_type_s *data = (account_type_s *)account_type;
+ label_s *label_data = (label_s *)malloc(sizeof(label_s));
if (label_data == NULL) {
ACCOUNT_FATAL("Memory Allocation Failed");
return ACCOUNT_ERROR_OUT_OF_MEMORY;
return ACCOUNT_ERROR_NONE;
}
-ACCOUNT_INTERNAL_API int account_type_set_provider_feature(account_type_h account_type, const char* provider_feature)
+ACCOUNT_INTERNAL_API int account_type_set_provider_feature(account_type_h account_type, const char *provider_feature)
{
ACCOUNT_RETURN_VAL((account_type != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("account type handle is null"));
ACCOUNT_RETURN_VAL((provider_feature != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("provider_feature is null"));
- account_type_s *data = (account_type_s*)account_type;
+ account_type_s *data = (account_type_s *)account_type;
GSList *iter = NULL;
bool b_is_new = TRUE;
- for(iter = data->provider_feature_list; iter != NULL; iter = g_slist_next(iter)) {
+ for (iter = data->provider_feature_list; iter != NULL; iter = g_slist_next(iter)) {
provider_feature_s *feature_data = NULL;
- feature_data = (provider_feature_s*)iter->data;
+ feature_data = (provider_feature_s *)iter->data;
- if(!strcmp(feature_data->key, provider_feature)) {
+ if (!strcmp(feature_data->key, provider_feature)) {
b_is_new = FALSE;
break;
}
}
- if(b_is_new) {
- provider_feature_s* feature_data = (provider_feature_s*)malloc(sizeof(provider_feature_s));
+ if (b_is_new) {
+ provider_feature_s* feature_data = (provider_feature_s *)malloc(sizeof(provider_feature_s));
if (feature_data == NULL) {
ACCOUNT_FATAL("Memory Allocation Failed");
return ACCOUNT_ERROR_OUT_OF_MEMORY;
return ACCOUNT_ERROR_NONE;
}
-ACCOUNT_API int account_type_query_provider_feature_by_app_id(provider_feature_cb callback, const char* app_id, void *user_data )
+ACCOUNT_API int account_type_query_provider_feature_by_app_id(provider_feature_cb callback, const char *app_id, void *user_data)
{
_INFO("account_type_query_provider_feature_by_app_id start");
GError *error = NULL;
gint error_code = ACCOUNT_ERROR_NONE;
- AccountManager* acc_mgr = _account_manager_get_instance();
- if (acc_mgr == NULL)
- {
+ AccountManager *acc_mgr = _account_manager_get_instance();
+ if (acc_mgr == NULL) {
_ERR("g_bus_get_sync failed");
return ACCOUNT_ERROR_PERMISSION_DENIED;
}
- GVariant* feature_list_variant = NULL;
+ GVariant *feature_list_variant = NULL;
bool is_success = account_manager_call_account_type_query_provider_feature_by_app_id_sync(acc_mgr, app_id, (int)getuid(), &feature_list_variant, NULL, &error);
_INFO("account_manager_call_account_type_query_provider_feature_by_app_id_sync end=[%d]", is_success);
- if (!is_success)
- {
+ if (!is_success) {
error_code = _account_get_error_code(is_success, error);
g_clear_error(&error);
_ERR("Account IPC call returned error[%d]", error_code);
}
g_clear_error(&error);
- GSList* provider_feature_list = variant_to_provider_feature_list(feature_list_variant);
- if (provider_feature_list == NULL)
- {
+ GSList *provider_feature_list = variant_to_provider_feature_list(feature_list_variant);
+ if (provider_feature_list == NULL) {
error_code = ACCOUNT_ERROR_NO_DATA;
_ERR("[%d]", error_code);
return error_code;
for (iter = provider_feature_list; iter != NULL; iter = g_slist_next(iter)) {
provider_feature_s *feature_data = NULL;
- feature_data = (provider_feature_s*)iter->data;
+ feature_data = (provider_feature_s *)iter->data;
- if(callback(feature_data->app_id, feature_data->key, user_data)!=TRUE) {
+ if (callback(feature_data->app_id, feature_data->key, user_data) != TRUE) {
ACCOUNT_DEBUG("Callback func returs FALSE, its iteration is stopped!!!!\n");
return ACCOUNT_ERROR_NONE;
}
return error_code;
}
-ACCOUNT_API bool account_type_query_supported_feature(const char* app_id, const char* capability)
+ACCOUNT_API bool account_type_query_supported_feature(const char *app_id, const char *capability)
{
_INFO("account_type_query_supported_feature start");
- if (app_id == NULL || capability == NULL)
- {
+ if (app_id == NULL || capability == NULL) {
set_last_result(ACCOUNT_ERROR_INVALID_PARAMETER);
return false;
}
GError *error = NULL;
gint ret = ACCOUNT_ERROR_NONE;
- AccountManager* acc_mgr = _account_manager_get_instance();
- if (acc_mgr == NULL)
- {
+ AccountManager *acc_mgr = _account_manager_get_instance();
+ if (acc_mgr == NULL) {
_ERR("g_bus_get_sync failed");
set_last_result(ACCOUNT_ERROR_PERMISSION_DENIED);
return false;
_INFO("account_manager_call_account_type_query_supported_feature_sync end=[%d]", is_success);
- if (!is_success)
- {
+ if (!is_success) {
ret = _account_get_error_code(is_success, error);
g_clear_error(&error);
_ERR("Account IPC call returned error[%d]", ret);
ACCOUNT_API int account_type_get_app_id(account_type_h account_type, char **app_id)
{
- if (!account_type) {
+ if (!account_type)
return ACCOUNT_ERROR_INVALID_PARAMETER;
- }
- if (!app_id) {
+ if (!app_id)
return ACCOUNT_ERROR_INVALID_PARAMETER;
- }
- account_type_s *data = (account_type_s*)account_type;
+ account_type_s *data = (account_type_s *)account_type;
(*app_id) = NULL;
*app_id = _account_get_text(data->app_id);
ACCOUNT_API int account_type_get_service_provider_id(account_type_h account_type, char **service_provider_id)
{
- if (!account_type) {
+ if (!account_type)
return ACCOUNT_ERROR_INVALID_PARAMETER;
- }
- if (!service_provider_id) {
+ if (!service_provider_id)
return ACCOUNT_ERROR_INVALID_PARAMETER;
- }
- account_type_s *data = (account_type_s*)account_type;
+ account_type_s *data = (account_type_s *)account_type;
(*service_provider_id) = NULL;
*service_provider_id = _account_get_text(data->service_provider_id);
ACCOUNT_API int account_type_get_icon_path(account_type_h account_type, char **icon_path)
{
- if (!account_type) {
+ if (!account_type)
return ACCOUNT_ERROR_INVALID_PARAMETER;
- }
- if (!icon_path) {
+ if (!icon_path)
return ACCOUNT_ERROR_INVALID_PARAMETER;
- }
- account_type_s *data = (account_type_s*)account_type;
+ account_type_s *data = (account_type_s *)account_type;
(*icon_path) = NULL;
*icon_path = _account_get_text(data->icon_path);
ACCOUNT_API int account_type_get_small_icon_path(account_type_h account_type, char **small_icon_path)
{
- if (!account_type) {
+ if (!account_type)
return ACCOUNT_ERROR_INVALID_PARAMETER;
- }
- if (!small_icon_path) {
+ if (!small_icon_path)
return ACCOUNT_ERROR_INVALID_PARAMETER;
- }
- account_type_s *data = (account_type_s*)account_type;
+ account_type_s *data = (account_type_s *)account_type;
(*small_icon_path) = NULL;
*small_icon_path = _account_get_text(data->small_icon_path);
ACCOUNT_API int account_type_get_multiple_account_support(account_type_h account_type, int *multiple_account_support)
{
- if (!account_type) {
+ if (!account_type)
return ACCOUNT_ERROR_INVALID_PARAMETER;
- }
- if (!multiple_account_support) {
+
+ if (!multiple_account_support)
return ACCOUNT_ERROR_INVALID_PARAMETER;
- }
- account_type_s *data = (account_type_s*)account_type;
+ account_type_s *data = (account_type_s *)account_type;
*multiple_account_support = data->multiple_account_support;
return ACCOUNT_ERROR_NONE;
}
-ACCOUNT_API int account_type_get_provider_feature_all(account_type_h account_type, provider_feature_cb callback, void* user_data)
+ACCOUNT_API int account_type_get_provider_feature_all(account_type_h account_type, provider_feature_cb callback, void *user_data)
{
ACCOUNT_RETURN_VAL((account_type != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("ACCOUNT HANDLE IS NULL"));
ACCOUNT_RETURN_VAL((callback != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("NO CALLBACK FUNCTION"));
GSList *iter;
- account_type_s *data = (account_type_s*)account_type;
+ account_type_s *data = (account_type_s *)account_type;
for (iter = data->provider_feature_list; iter != NULL; iter = g_slist_next(iter)) {
provider_feature_s *feature_data = NULL;
- feature_data = (provider_feature_s*)iter->data;
+ feature_data = (provider_feature_s *)iter->data;
- if(callback(feature_data->app_id, feature_data->key, user_data)!=TRUE) {
+ if (callback(feature_data->app_id, feature_data->key, user_data) != TRUE) {
ACCOUNT_DEBUG("Callback func returs FALSE, its iteration is stopped!!!!\n");
return ACCOUNT_ERROR_NONE;
}
return ACCOUNT_ERROR_NONE;
}
-ACCOUNT_API int account_type_get_label_by_locale(account_type_h account_type, const char* locale, char** label)
+ACCOUNT_API int account_type_get_label_by_locale(account_type_h account_type, const char *locale, char **label)
{
ACCOUNT_RETURN_VAL((account_type != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("ACCOUNT HANDLE IS NULL"));
ACCOUNT_RETURN_VAL((label != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("INVALID PARAMETER"));
GSList *iter;
- account_type_s *data = (account_type_s*)account_type;
+ account_type_s *data = (account_type_s *)account_type;
for (iter = data->label_list; iter != NULL; iter = g_slist_next(iter)) {
label_s *label_data = NULL;
- label_data = (label_s*)iter->data;
+ label_data = (label_s *)iter->data;
*label = NULL;
- if(!strcmp(locale, label_data->locale)) {
+ if (!strcmp(locale, label_data->locale)) {
*label = _account_get_text(label_data->label);
if (*label == NULL) {
ACCOUNT_FATAL("OUT OF MEMORY\n");
return ACCOUNT_ERROR_NONE;
}
- gchar** tokens = g_strsplit(locale, "-", 2);
+ gchar **tokens = g_strsplit(locale, "-", 2);
- if(tokens != NULL) {
- if((char*)(tokens[1]) != NULL) {
- char* upper_token = g_ascii_strup(tokens[1], strlen(tokens[1]));
+ if (tokens != NULL) {
+ if ((char *)(tokens[1]) != NULL) {
+ char *upper_token = g_ascii_strup(tokens[1], strlen(tokens[1]));
if (upper_token == NULL) {
ACCOUNT_FATAL("Memory Allocation Failed");
g_strfreev(tokens);
return ACCOUNT_ERROR_OUT_OF_MEMORY;
}
- if(upper_token != NULL) {
- char* converted_locale = g_strdup_printf("%s_%s", tokens[0], upper_token);
+ if (upper_token != NULL) {
+ char *converted_locale = g_strdup_printf("%s_%s", tokens[0], upper_token);
if (converted_locale == NULL) {
ACCOUNT_FATAL("Memory Allocation Failed");
_ACCOUNT_FREE(upper_token);
return ACCOUNT_ERROR_OUT_OF_MEMORY;
}
- if(!strcmp(converted_locale, label_data->locale)) {
+ if (!strcmp(converted_locale, label_data->locale)) {
_ACCOUNT_FREE(converted_locale);
_ACCOUNT_FREE(upper_token);
g_strfreev(tokens);
ACCOUNT_RETURN_VAL((callback != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("NO CALLBACK FUNCTION"));
GSList *iter;
- account_type_s *data = (account_type_s*)account_type;
+ account_type_s *data = (account_type_s *)account_type;
for (iter = data->label_list; iter != NULL; iter = g_slist_next(iter)) {
label_s *label_data = NULL;
- label_data = (label_s*)iter->data;
+ label_data = (label_s *)iter->data;
- if(callback(label_data->app_id, label_data->label, label_data->locale, user_data)!=TRUE) {
+ if (callback(label_data->app_id, label_data->label, label_data->locale, user_data) != TRUE) {
ACCOUNT_DEBUG("Callback func returs FALSE, its iteration is stopped!!!!\n");
return ACCOUNT_ERROR_NONE;
}
return ACCOUNT_ERROR_NONE;
}
-ACCOUNT_INTERNAL_API int account_type_insert_to_db(account_type_h account_type, int* account_type_id)
+ACCOUNT_INTERNAL_API int account_type_insert_to_db(account_type_h account_type, int *account_type_id)
{
_INFO("account_type_insert_to_db starting");
GError *error = NULL;
- AccountManager* acc_mgr = _account_manager_get_instance();
- if (acc_mgr == NULL)
- {
+ AccountManager *acc_mgr = _account_manager_get_instance();
+ if (acc_mgr == NULL) {
_ERR("g_bus_get_sync failed");
return ACCOUNT_ERROR_PERMISSION_DENIED;
}
int db_id = -1;
- GVariant* account_type_serialized = marshal_account_type((account_type_s*) account_type);
+ GVariant *account_type_serialized = marshal_account_type((account_type_s *)account_type);
bool is_success = account_manager_call_account_type_add_sync(acc_mgr, account_type_serialized, (int)getuid(), &db_id, NULL, &error);
int ret = _account_get_error_code(is_success, error);
g_clear_error(&error);
if (ret != ACCOUNT_ERROR_NONE)
- {
return ret;
- }
_INFO("account_type_insert_to_db end id=[%d]", db_id);
*account_type_id = db_id;
- account_type_s* account_type_data = (account_type_s*)account_type;
+ account_type_s *account_type_data = (account_type_s *)account_type;
account_type_data->id = db_id;
return ACCOUNT_ERROR_NONE;
}
-ACCOUNT_INTERNAL_API int account_type_update_to_db_by_app_id(const account_type_h account_type, const char* app_id)
+ACCOUNT_INTERNAL_API int account_type_update_to_db_by_app_id(const account_type_h account_type, const char *app_id)
{
_INFO("account_type_update_to_db_by_app_id starting");
int error_code = ACCOUNT_ERROR_NONE;
GError *error = NULL;
- AccountManager* acc_mgr = _account_manager_get_instance();
- if (acc_mgr == NULL)
- {
+ AccountManager *acc_mgr = _account_manager_get_instance();
+ if (acc_mgr == NULL) {
_ERR("g_bus_get_sync failed");
return ACCOUNT_ERROR_PERMISSION_DENIED;
}
- GVariant* account_type_variant = marshal_account_type((account_type_s*) account_type);
- if (account_type_variant == NULL)
- {
+ GVariant *account_type_variant = marshal_account_type((account_type_s *)account_type);
+ if (account_type_variant == NULL) {
_ERR("Failed to serialize");
return ACCOUNT_ERROR_INVALID_PARAMETER;
}
return error_code;
}
-ACCOUNT_INTERNAL_API int account_type_delete_by_app_id(const char* app_id)
+ACCOUNT_INTERNAL_API int account_type_delete_by_app_id(const char *app_id)
{
_INFO("account_type_delete_by_app_id starting");
int error_code = ACCOUNT_ERROR_NONE;
GError *error = NULL;
- AccountManager* acc_mgr = _account_manager_get_instance();
- if (acc_mgr == NULL)
- {
+ AccountManager *acc_mgr = _account_manager_get_instance();
+ if (acc_mgr == NULL) {
_ERR("g_bus_get_sync failed");
return ACCOUNT_ERROR_PERMISSION_DENIED;
}
return error_code;
}
-ACCOUNT_API int account_type_query_label_by_app_id(account_label_cb callback, const char* app_id, void *user_data )
+ACCOUNT_API int account_type_query_label_by_app_id(account_label_cb callback, const char *app_id, void *user_data)
{
_INFO("account_type_query_label_by_app_id starting");
GError *error = NULL;
- AccountManager* acc_mgr = _account_manager_get_instance();
- if (acc_mgr == NULL)
- {
+ AccountManager *acc_mgr = _account_manager_get_instance();
+ if (acc_mgr == NULL) {
_ERR("g_bus_get_sync failed");
return ACCOUNT_ERROR_PERMISSION_DENIED;
}
- GVariant* label_list_variant = NULL;
+ GVariant *label_list_variant = NULL;
bool is_success = account_manager_call_account_type_query_label_by_app_id_sync(acc_mgr, app_id, (int)getuid(), &label_list_variant, NULL, &error);
int ret = _account_get_error_code(is_success, error);
g_clear_error(&error);
if (ret != ACCOUNT_ERROR_NONE)
- {
return ret;
- }
- _INFO("before variant_to_label_list");
- GSList* label_list = variant_to_label_list (label_list_variant);
- _INFO("after variant_to_label_list");
+ GSList *label_list = variant_to_label_list(label_list_variant);
if (label_list == NULL)
- {
return ACCOUNT_ERROR_NO_DATA;
- }
- GSList* iter;
+ GSList *iter;
- for (iter = label_list; iter != NULL; iter = g_slist_next(iter))
- {
+ for (iter = label_list; iter != NULL; iter = g_slist_next(iter)) {
_INFO("iterating received account_list");
label_s *label_record = NULL;
- label_record = (label_s*)iter->data;
- _INFO("");
- if (callback(label_record->app_id, label_record->label, label_record->locale, user_data) == false)
- {
+ label_record = (label_s *)iter->data;
+ if (callback(label_record->app_id, label_record->label, label_record->locale, user_data) == false) {
_INFO("application callback requested to discontinue.");
break;
}
- _INFO("");
}
_account_type_gslist_label_free(label_list);
return ACCOUNT_ERROR_NONE;
}
-ACCOUNT_API int account_type_query_by_app_id(const char* app_id, account_type_h *account_type)
+ACCOUNT_API int account_type_query_by_app_id(const char *app_id, account_type_h *account_type)
{
_INFO("account_type_query_by_app_id starting");
GError *error = NULL;
- AccountManager* acc_mgr = _account_manager_get_instance();
- if (acc_mgr == NULL)
- {
+ AccountManager *acc_mgr = _account_manager_get_instance();
+ if (acc_mgr == NULL) {
_ERR("g_bus_get_sync failed");
return ACCOUNT_ERROR_PERMISSION_DENIED;
}
- GVariant* account_type_variant = NULL;
- account_type_s *in_data = (account_type_s*) (*account_type);
+ GVariant *account_type_variant = NULL;
+ account_type_s *in_data = (account_type_s *)*account_type;
bool is_success = account_manager_call_account_type_query_by_app_id_sync(acc_mgr, app_id, (int)getuid(), &account_type_variant, NULL, &error);
g_clear_error(&error);
if (ret != ACCOUNT_ERROR_NONE)
- {
return ret;
- }
- account_type_s* received_account_type = umarshal_account_type (account_type_variant);
+ account_type_s *received_account_type = umarshal_account_type(account_type_variant);
ACCOUNT_RETURN_VAL((received_account_type != NULL), {}, ACCOUNT_ERROR_DB_FAILED, ("INVALID DATA RECEIVED FROM SVC"));
in_data->id = received_account_type->id;
GError *error = NULL;
- AccountManager* acc_mgr = _account_manager_get_instance();
- if (acc_mgr == NULL)
- {
+ AccountManager *acc_mgr = _account_manager_get_instance();
+ if (acc_mgr == NULL) {
_ERR("g_bus_get_sync failed");
return ACCOUNT_ERROR_PERMISSION_DENIED;
}
- GVariant* account_type_list_variant = NULL;
+ GVariant *account_type_list_variant = NULL;
_INFO("before account_type_query_all_sync()");
bool is_success = account_manager_call_account_type_query_all_sync(acc_mgr, (int)getuid(), &account_type_list_variant, NULL, &error);
g_clear_error(&error);
if (ret != ACCOUNT_ERROR_NONE)
- {
return ret;
- }
- GSList* account_type_list = unmarshal_account_type_list(account_type_list_variant);
+ GSList *account_type_list = unmarshal_account_type_list(account_type_list_variant);
g_variant_unref(account_type_list_variant);
if (account_type_list == NULL)
- {
return ACCOUNT_ERROR_NO_DATA;
- }
- GSList* iter;
+ GSList *iter;
- for (iter = account_type_list; iter != NULL; iter = g_slist_next(iter))
- {
+ for (iter = account_type_list; iter != NULL; iter = g_slist_next(iter)) {
_INFO("iterating received account_list");
account_type_s *account_type = NULL;
- account_type = (account_type_s*)iter->data;
+ account_type = (account_type_s *)iter->data;
- if (callback((account_type_h)account_type, user_data) == false)
- {
+ if (callback((account_type_h)account_type, user_data) == false) {
_INFO("application callback requested to discontinue.");
break;
}
return ACCOUNT_ERROR_NONE;
}
-ACCOUNT_API int account_type_query_label_by_locale(const char* app_id, const char* locale, char** label)
+ACCOUNT_API int account_type_query_label_by_locale(const char *app_id, const char *locale, char **label)
{
_INFO("account_type_query_label_by_locale starting");
GError *error = NULL;
- AccountManager* acc_mgr = _account_manager_get_instance();
- if (acc_mgr == NULL)
- {
+ AccountManager *acc_mgr = _account_manager_get_instance();
+ if (acc_mgr == NULL) {
_ERR("g_bus_get_sync failed");
return ACCOUNT_ERROR_PERMISSION_DENIED;
}
- char* label_temp = NULL;
+ char *label_temp = NULL;
_INFO("before account_type_query_label_by_locale_sync()");
bool is_success = account_manager_call_account_type_query_label_by_locale_sync(acc_mgr, app_id, locale, (int)getuid(), &label_temp, NULL, &error);
g_clear_error(&error);
if (ret != ACCOUNT_ERROR_NONE)
- {
return ret;
- }
if (label_temp == NULL)
- {
return ACCOUNT_ERROR_NO_DATA;
- }
*label = NULL;
*label = _account_get_text(label_temp);
}
-ACCOUNT_API int account_type_query_by_provider_feature(account_type_cb callback, const char* key, void* user_data)
+ACCOUNT_API int account_type_query_by_provider_feature(account_type_cb callback, const char *key, void *user_data)
{
_INFO("account_type_query_by_provider_feature starting");
GError *error = NULL;
- AccountManager* acc_mgr = _account_manager_get_instance();
- if (acc_mgr == NULL)
- {
+ AccountManager *acc_mgr = _account_manager_get_instance();
+ if (acc_mgr == NULL) {
_ERR("g_bus_get_sync failed");
return ACCOUNT_ERROR_PERMISSION_DENIED;
}
- GVariant* account_type_list_variant = NULL;
+ GVariant *account_type_list_variant = NULL;
bool is_success = account_manager_call_account_type_query_by_provider_feature_sync(acc_mgr, key, (int)getuid(), &account_type_list_variant, NULL, &error);
int ret = _account_get_error_code(is_success, error);
g_clear_error(&error);
if (ret != ACCOUNT_ERROR_NONE)
- {
return ret;
- }
_INFO("before unmarshal_account_type_list");
- GSList* account_type_list = unmarshal_account_type_list(account_type_list_variant);
+ GSList *account_type_list = unmarshal_account_type_list(account_type_list_variant);
g_variant_unref(account_type_list_variant);
if (account_type_list == NULL)
- {
return ACCOUNT_ERROR_NO_DATA;
- }
- GSList* iter;
+ GSList *iter;
- for (iter = account_type_list; iter != NULL; iter = g_slist_next(iter))
- {
+ for (iter = account_type_list; iter != NULL; iter = g_slist_next(iter)) {
_INFO("iterating received account_type_list");
account_type_s *account_type = NULL;
- account_type = (account_type_s*)iter->data;
+ account_type = (account_type_s *)iter->data;
_INFO("");
- if (callback((account_type_h)account_type, user_data) == false)
- {
+ if (callback((account_type_h)account_type, user_data) == false) {
_INFO("Application callback requested not to continue");
break;
}
return ACCOUNT_ERROR_NONE;
}
-ACCOUNT_API int account_type_query_app_id_exist(const char* app_id)
+ACCOUNT_API int account_type_query_app_id_exist(const char *app_id)
{
_INFO("account_type_query_app_id_exist starting");
int error_code = ACCOUNT_ERROR_NONE;
GError *error = NULL;
- AccountManager* acc_mgr = _account_manager_get_instance();
- if (acc_mgr == NULL)
- {
+ AccountManager *acc_mgr = _account_manager_get_instance();
+ if (acc_mgr == NULL) {
_ERR("g_bus_get_sync failed");
return ACCOUNT_ERROR_PERMISSION_DENIED;
}
static void _account_subscribe_vconf_callback(keynode_t *key, void *user_data)
{
- account_subscribe_s* tmp = (account_subscribe_s*)user_data;
+ account_subscribe_s *tmp = (account_subscribe_s *)user_data;
char *msg = NULL, *vconf_key = NULL;
const char *key_name = NULL;
- char event_msg[256] ={0, };
+ char event_msg[256] = {0, };
int account_id = -1;
- if(!key) {
+ if (!key) {
ACCOUNT_ERROR("No subscribtion msg !!!!!\n");
return;
}
- if(!tmp) {
+ if (!tmp) {
ACCOUNT_ERROR("user data required\n");
return;
}
key_name = vconf_keynode_get_name(key);
- if ( key_name == NULL ) {
+ if (key_name == NULL) {
ACCOUNT_ERROR("vconf_keynode_get_name(key) fail\n");
return;
}
- if(!memcmp(key_name, VCONFKEY_ACCOUNT_MSG_STR, strlen(VCONFKEY_ACCOUNT_MSG_STR)))
- {
+ if (!memcmp(key_name, VCONFKEY_ACCOUNT_MSG_STR, strlen(VCONFKEY_ACCOUNT_MSG_STR))) {
vconf_key = vconf_keynode_get_str(key);
- if( vconf_key == NULL){
+ if (vconf_key == NULL) {
ACCOUNT_ERROR("vconf key is NULL.\n");
return;
}
return;
}
- char* event_type = NULL;
- char* id = NULL;
- char* ptr = NULL;
+ char *event_type = NULL;
+ char *id = NULL;
+ char *ptr = NULL;
event_type = strtok_r(msg, ":", &ptr);
id = strtok_r(NULL, ":", &ptr);
ACCOUNT_SLOGD("msg(%s), event_type(%s), id(%s)", msg, event_type, id);
- ACCOUNT_SNPRINTF(event_msg,sizeof(event_msg),"%s", event_type);
+ ACCOUNT_SNPRINTF(event_msg, sizeof(event_msg), "%s", event_type);
account_id = atoi(id);
- if(tmp->account_subscription_callback)
+ if (tmp->account_subscription_callback)
tmp->account_subscription_callback(event_msg, account_id, tmp->user_data);
_ACCOUNT_FREE(msg);
}
}
-ACCOUNT_API int account_subscribe_create(account_subscribe_h* account_subscribe)
+ACCOUNT_API int account_subscribe_create(account_subscribe_h *account_subscribe)
{
if (!account_subscribe) {
ACCOUNT_SLOGE("account is NULL.\n", __FUNCTION__, __LINE__);
return ACCOUNT_ERROR_INVALID_PARAMETER;
}
- account_subscribe_s *data = (account_subscribe_s*)calloc(1,sizeof(account_subscribe_s));
- if(!data) {
+ account_subscribe_s *data = (account_subscribe_s *)calloc(1, sizeof(account_subscribe_s));
+ if (!data) {
ACCOUNT_FATAL("OUT OF MEMORY\n");
return ACCOUNT_ERROR_OUT_OF_MEMORY;
}
return ACCOUNT_ERROR_NONE;
}
-ACCOUNT_API int account_subscribe_notification(account_subscribe_h account_subscribe, account_event_cb callback, void* user_data)
+ACCOUNT_API int account_subscribe_notification(account_subscribe_h account_subscribe, account_event_cb callback, void *user_data)
{
ACCOUNT_RETURN_VAL((account_subscribe != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("(%s)-(%d) account subscribe handle is NULL.\n", __FUNCTION__, __LINE__));
- account_subscribe_s* tmp =(account_subscribe_s*)account_subscribe;
+ account_subscribe_s *tmp = (account_subscribe_s *)account_subscribe;
tmp->account_subscription_callback = callback;
tmp->user_data = user_data;
int ret = -1;
ret = vconf_notify_key_changed(VCONFKEY_ACCOUNT_MSG_STR,
(vconf_callback_fn)_account_subscribe_vconf_callback,
- (void*)tmp);
+ (void *)tmp);
ACCOUNT_SLOGI("vconf_notify_key_changed ret = %d", ret);
- if(ret != VCONF_OK) {
+ if (ret != VCONF_OK) {
ACCOUNT_ERROR("Vconf Subscription Failed ret = %d", ret);
return ACCOUNT_ERROR_EVENT_SUBSCRIPTION_FAIL;
}
{
ACCOUNT_RETURN_VAL((account_subscribe != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("(%s)-(%d) account subscribe handle is NULL.\n", __FUNCTION__, __LINE__));
- account_subscribe_s* tmp =(account_subscribe_s*)account_subscribe;
+ account_subscribe_s *tmp = (account_subscribe_s *)account_subscribe;
_ACCOUNT_FREE(tmp);
static void _account_subscribe_vconf_callback_ex(keynode_t *key, void *user_data)
{
- account_subscribe_s* tmp = (account_subscribe_s*)user_data;
+ account_subscribe_s *tmp = (account_subscribe_s *)user_data;
char *msg = NULL, *vconf_key = NULL;
- char event_msg[256] ={0, };
+ char event_msg[256] = {0, };
int account_id = -1;
const char *key_name = NULL;
- if(!key) {
+ if (!key) {
ACCOUNT_ERROR("No subscribtion msg !!!!!\n");
return;
}
- if(!tmp) {
+ if (!tmp) {
ACCOUNT_ERROR("user data required\n");
return;
}
key_name = vconf_keynode_get_name(key);
- if ( key_name == NULL ) {
+ if (key_name == NULL) {
ACCOUNT_ERROR("vconf_keynode_get_name(key) fail\n");
return;
}
- if(!memcmp(key_name, VCONFKEY_ACCOUNT_MSG_STR, strlen(VCONFKEY_ACCOUNT_MSG_STR)))
- {
+ if (!memcmp(key_name, VCONFKEY_ACCOUNT_MSG_STR, strlen(VCONFKEY_ACCOUNT_MSG_STR))) {
vconf_key = vconf_keynode_get_str(key);
- if( vconf_key == NULL){
+ if (vconf_key == NULL) {
ACCOUNT_ERROR("vconf key is NULL.\n");
return;
}
return;
}
- char* event_type = NULL;
- char* id = NULL;
- char* ptr = NULL;
+ char *event_type = NULL;
+ char *id = NULL;
+ char *ptr = NULL;
event_type = strtok_r(msg, ":", &ptr);
id = strtok_r(NULL, ":", &ptr);
ACCOUNT_SLOGD("msg(%s), event_type(%s), id(%s)", msg, event_type, id);
- ACCOUNT_SNPRINTF(event_msg,sizeof(event_msg),"%s", event_type);
+ ACCOUNT_SNPRINTF(event_msg, sizeof(event_msg), "%s", event_type);
account_id = atoi(id);
- if(tmp->account_subscription_callback)
+ if (tmp->account_subscription_callback)
tmp->account_subscription_callback(event_msg, account_id, tmp->user_data);
}
{
ACCOUNT_RETURN_VAL((account_subscribe != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("(%s)-(%d) account subscribe handle is NULL.\n", __FUNCTION__, __LINE__));
- account_subscribe_s* tmp =(account_subscribe_s*)account_subscribe;
+ account_subscribe_s *tmp = (account_subscribe_s *)account_subscribe;
_ACCOUNT_FREE(tmp);
return ACCOUNT_ERROR_NONE;
}
-ACCOUNT_API int account_subscribe_notification_ex(account_subscribe_h account_subscribe, account_event_cb callback, void* user_data)
+ACCOUNT_API int account_subscribe_notification_ex(account_subscribe_h account_subscribe, account_event_cb callback, void *user_data)
{
ACCOUNT_RETURN_VAL((account_subscribe != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("(%s)-(%d) account subscribe handle is NULL.\n", __FUNCTION__, __LINE__));
- account_subscribe_s* tmp =(account_subscribe_s*)account_subscribe;
+ account_subscribe_s *tmp = (account_subscribe_s *)account_subscribe;
tmp->account_subscription_callback = callback;
tmp->user_data = user_data;
int ret = -1;
ret = vconf_notify_key_changed(VCONFKEY_ACCOUNT_MSG_STR,
(vconf_callback_fn)_account_subscribe_vconf_callback_ex,
- (void*)tmp);
+ (void *)tmp);
ACCOUNT_SLOGI("vconf_notify_key_changed ret = %d", ret);
- if(ret != VCONF_OK) {
+ if (ret != VCONF_OK) {
ACCOUNT_ERROR("Vconf Subscription Failed ret = %d", ret);
return ACCOUNT_ERROR_EVENT_SUBSCRIPTION_FAIL;
}