diff options
author | jk7744.park <jk7744.park@samsung.com> | 2015-10-24 16:21:08 +0900 |
---|---|---|
committer | jk7744.park <jk7744.park@samsung.com> | 2015-10-24 16:21:08 +0900 |
commit | faa94893427af38a34019b69f585f6e2062d45cd (patch) | |
tree | 8b70180ff6423f6dc51f27e3f413f74e43bffb4d | |
parent | c821767cc8132601c13243dd8f4cf205c8202dcb (diff) | |
download | account-parser-faa94893427af38a34019b69f585f6e2062d45cd.tar.gz account-parser-faa94893427af38a34019b69f585f6e2062d45cd.tar.bz2 account-parser-faa94893427af38a34019b69f585f6e2062d45cd.zip |
tizen 2.4 releasetizen_2.4_mobile_releasesubmit/tizen_2.4/20151028.063450accepted/tizen/2.4/mobile/20151029.035048
-rwxr-xr-x | CMakeLists.txt | 1 | ||||
-rw-r--r-- | packaging/account-parser.spec | 4 | ||||
-rwxr-xr-x | src/account.c | 70 |
3 files changed, 31 insertions, 44 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 57fc332..361354a 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,6 +4,7 @@ PROJECT(account C) INCLUDE(FindPkgConfig) pkg_check_modules(account_pkgs REQUIRED dlog + capi-base-common libxml-2.0 pkgmgr-info glib-2.0 diff --git a/packaging/account-parser.spec b/packaging/account-parser.spec index 3523fa9..30f09a0 100644 --- a/packaging/account-parser.spec +++ b/packaging/account-parser.spec @@ -1,11 +1,13 @@ Name: account-parser Summary: account parser library -Version: 0.0.11 +Version: 0.0.13 Release: 0 Group: TO_BE/FILLED_IN License: Apache-2.0 Source0: %{name}-%{version}.tar.gz + BuildRequires: cmake +BuildRequires: pkgconfig(capi-base-common) BuildRequires: pkgconfig(accounts-svc) BuildRequires: pkgconfig(dlog) BuildRequires: pkgconfig(libxml-2.0) diff --git a/src/account.c b/src/account.c index ee42d6e..1e007e0 100755 --- a/src/account.c +++ b/src/account.c @@ -21,6 +21,7 @@ #include <libxml/tree.h> #include <account.h> #include <account-types.h> +#include <account_internal.h> #include <pkgmgr-info.h> #include <app_manager.h> @@ -39,6 +40,7 @@ static const xmlChar _NODE_CAPABILITY[] = "capability"; static const xmlChar _ATTRIBUTE_APP_ID[] = "appid"; static const xmlChar _ATTRIBUTE_MULTIPLE_ACCOUNTS_SUPPORT[] = "multiple-accounts-support"; +static const xmlChar _ATTRIBUTE_SERVICE_PROVIDER_ID[] = "providerid"; static const xmlChar _ATTRIBUTE_SECTION[] = "section"; static const xmlChar _ATTRIBUTE_TYPE[] = "type"; static const xmlChar _ATTRIBUTE_XML_LANG[] = "xml:lang"; @@ -69,11 +71,11 @@ bool _on_account_received_cb(account_h account, void* user_data) retvm_if(ret != ACCOUNT_ERROR_NONE, false, "[%d] Failed to perform account_set_package_name().", ret); // Update the account - ret = account_update_to_db_by_id_ex(account, account_db_id); + ret = account_update_to_db_by_id_without_permission(account, account_db_id); retvm_if(ret == ACCOUNT_ERROR_NOT_REGISTERED_PROVIDER, false, "[%d] The application does not register the account provider.", ret); retvm_if(ret == ACCOUNT_ERROR_PERMISSION_DENIED, false, "[%d] The application has no permission to update this account.", ret); retvm_if(ret == ACCOUNT_ERROR_RECORD_NOT_FOUND, false, "[%d] The account does not exist.", ret); - retvm_if(ret != ACCOUNT_ERROR_NONE, false, "[%d] Failed to perform account_update_to_db_by_id_ex().", ret); + retvm_if(ret != ACCOUNT_ERROR_NONE, false, "[%d] Failed to perform account_update_to_db_by_id_without_permssion().", ret); return true; } @@ -83,10 +85,9 @@ int _register_account_provider(xmlDocPtr docPtr, char* account_provider_app_id) ENTER(); _D("Registering the Account Provider."); - int ret = account_connect(); - retvm_if(ret != ACCOUNT_ERROR_NONE, ret, "[%d]A system error has occurred.", ret); + int ret = ACCOUNT_ERROR_NONE; - int ret2 = 0; + int ret2 = ACCOUNT_ERROR_NONE; account_type_h account_type_handle = NULL; ret = account_type_create(&account_type_handle); @@ -134,6 +135,20 @@ int _register_account_provider(xmlDocPtr docPtr, char* account_provider_app_id) goto CATCH; } + // Attribute: providerid + xmlChar* attribute_provider_id = xmlGetProp(cur_ptr, _ATTRIBUTE_SERVICE_PROVIDER_ID); + if(attribute_provider_id != NULL) { + ret = -1; + _E("Failed to get the attribute(providerid)."); + + _SECURE_D("Attribute: appid - %s", attribute_provider_id); + + ret = account_type_set_service_provider_id(account_type_handle, (char*)attribute_provider_id); + if(ret != ACCOUNT_ERROR_NONE) { + _E("Failed to set the service provider id."); + } + } + // Attribute: multiple-accounts-support xmlChar* multiple_accounts_support = xmlGetProp(cur_ptr, _ATTRIBUTE_MULTIPLE_ACCOUNTS_SUPPORT); if(multiple_accounts_support == NULL) { @@ -427,7 +442,7 @@ int _register_account_provider(xmlDocPtr docPtr, char* account_provider_app_id) // Insert the account type to the account DB { int account_type_db_id = 0; - ret = account_type_insert_to_db(account_type_handle, &account_type_db_id); + ret = account_type_insert_to_db_offline(account_type_handle, &account_type_db_id); if(ret != ACCOUNT_ERROR_NONE) { _E("[%d]Failed to perform account_type_insert_to_db().", ret); goto CATCH; @@ -440,21 +455,12 @@ int _register_account_provider(xmlDocPtr docPtr, char* account_provider_app_id) goto CATCH; } - ret = account_disconnect(); - if(ret != ACCOUNT_ERROR_NONE) { - _E("[%d]Failed to perform account_disconnect().", ret); - goto CATCH; - } - return 0; CATCH: ret2 = account_type_destroy(account_type_handle); retvm_if(ret2 != ACCOUNT_ERROR_NONE, ret2, "[%d]Failed to perform account_type_destroy().", ret2); - ret2 = account_disconnect(); - retvm_if(ret2 != ACCOUNT_ERROR_NONE, ret2, "[%d]Failed to perform account_disconnect().", ret2); - return ret; } @@ -467,32 +473,25 @@ int _unregister_account_provider(pkgmgrinfo_appinfo_h package_info_handle, void* pkgmgrinfo_appinfo_get_appid(package_info_handle, &app_id); _D("appid : %s", app_id); - int ret = account_connect(); - retvm_if(ret != ACCOUNT_ERROR_NONE, ret, "[%d]Failed to account_connect().", ret); + int ret = ACCOUNT_ERROR_NONE; - int ret2 = 0; + int ret2 = ACCOUNT_ERROR_NONE; - ret = account_delete_from_db_by_package_name((char*)app_id); + ret = account_delete_from_db_by_package_name_offline(app_id); if((ret != ACCOUNT_ERROR_NONE) && (ret != ACCOUNT_ERROR_RECORD_NOT_FOUND)) { - _E("Failed to perform account_delete_from_db_by_package_name()."); + _E("Failed to perform account_delete_from_db_by_package_name_offline()."); goto CATCH; } - ret = account_type_delete_by_app_id((char*)app_id); + ret = account_type_delete_by_app_id_offline(app_id); if(ret != ACCOUNT_ERROR_NONE) { _E("Failed to perform account_type_delete_by_app_id()."); goto CATCH; } - ret = account_disconnect(); - retvm_if(ret != ACCOUNT_ERROR_NONE, ret, "[%d]Failed to account_disconnect().", ret); - return PMINFO_R_OK; CATCH: - ret2 = account_disconnect(); - retvm_if(ret2 != ACCOUNT_ERROR_NONE, ret, "[%d]Failed to account_disconnect().", ret2); - return ret; } @@ -505,10 +504,7 @@ int _on_package_app_list_received_cb(pkgmgrinfo_appinfo_h handle, void *user_dat pkgmgrinfo_appinfo_get_appid(handle, &app_id); _D("appid : %s", app_id); - int ret = account_connect(); - retvm_if(ret != ACCOUNT_ERROR_NONE, ret, "[%d]Failed to account_connect().", ret); - - ret = account_type_delete_by_app_id((char*)app_id); + int ret = account_type_delete_by_app_id_offline((char*)app_id); if(ret == ACCOUNT_ERROR_NONE) { _D("PKGMGR_PARSER_PLUGIN_PRE_UPGRADE: app ID - %s", app_id); strncpy(__old_account_provider_app_id, app_id, 128); @@ -516,9 +512,6 @@ int _on_package_app_list_received_cb(pkgmgrinfo_appinfo_h handle, void *user_dat return 0; } - ret = account_disconnect(); - retvm_if(ret != ACCOUNT_ERROR_NONE, ret, "[%d]Failed to account_disconnect().", ret); - return 0; } @@ -594,9 +587,6 @@ int PKGMGR_PARSER_PLUGIN_UPGRADE(xmlDocPtr docPtr, const char* packageId) int ret = _register_account_provider(docPtr, account_provider_app_id); retvm_if(ret != 0, ret, "[%d]Failed to register the account provider.", ret); - ret = account_connect(); - retvm_if(ret != ACCOUNT_ERROR_NONE, ret, "[%d]Failed to perfrom account_connect().", ret); - int ret2 = 0; ret = account_query_account_by_package_name(_on_account_received_cb, __old_account_provider_app_id, (void*)account_provider_app_id); @@ -605,14 +595,8 @@ int PKGMGR_PARSER_PLUGIN_UPGRADE(xmlDocPtr docPtr, const char* packageId) goto CATCH; } - ret = account_disconnect(); - retvm_if(ret != ACCOUNT_ERROR_NONE, ret, "[%d]Failed to perfrom account_disconnect().", ret); - return 0; CATCH: - ret2 = account_disconnect(); - retvm_if(ret2 != ACCOUNT_ERROR_NONE, ret2, "[%d]Failed to perfrom account_disconnect().", ret2); - return ret; } |