From: jiseob.jang Date: Tue, 15 Dec 2015 08:12:07 +0000 (+0900) Subject: add "out of memory" exception handling and "remove unnecessary file" X-Git-Tag: submit/tizen_mobile/20151228.112115~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4048cf8f8b15015791f8e10a87c038050555682f;p=platform%2Fcore%2Fapi%2Flibaccount-service.git add "out of memory" exception handling and "remove unnecessary file" Change-Id: I4b296d0e428583ea675492e025e7c1b9fa75d8fb Signed-off-by: jiseob.jang --- diff --git a/include/account.h b/include/account.h deleted file mode 100644 index 700b107..0000000 --- a/include/account.h +++ /dev/null @@ -1,1857 +0,0 @@ -/* - * - * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#ifndef __ACCOUNT_H__ -#define __ACCOUNT_H__ - -#include -#include - -#ifdef __cplusplus -extern "C" -{ -#endif - -#ifndef ACCOUNT_API -#define ACCOUNT_API __attribute__ ((visibility("default"))) -#endif - -/** - * @file account.h - * @brief This file contains the Account API for account management. - */ - -/** - * @addtogroup CAPI_ACCOUNT_MANAGER_MODULE - * @{ - */ - -/** - * @brief Called once for each account from the database. - * - * @since_tizen 2.3 - * @param[in] account The account handle - * @param[in] user_data The user data passed from the foreach function - * - * @return @c true to continue with the next iteration of the loop, \n - * otherwise @c false to break out of the loop - * - * @pre account_foreach_account_from_db(), account_query_account_by_account_id(), account_query_account_by_user_name() or account_query_account_by_package_name() must be called. - * - * @see account_foreach_account_from_db() - * @see account_query_account_by_account_id() - * @see account_query_account_by_user_name() - * @see account_query_account_by_package_name() - */ -typedef bool (*account_cb)(account_h account, void *user_data); - -/** - * @brief Called once for each capability of an account in the database. - * - * @since_tizen 2.3 - * @param[in] capability_type The capability type - * @param[in] capability_state The capability state - * @param[in] user_data The user data passed from the foreach function - * - * @return @c true to continue with the next iteration of the loop, \n - * otherwise @c false to break out of the loop - * - * @pre account_query_capability_by_account_id() must be called. - * - * @see account_query_capability_by_account_id() - */ -typedef bool (*capability_cb)(const char* capability_type, account_capability_state_e capability_state, void *user_data); - -/** - * @brief Called once for each custom data of an account in the database. - * - * @since_tizen 2.3 - * @param[in] key The user custom key - * @param[in] value The user custom value of the specific key - * @param[in] user_data The user data passed - * - * @return @c true to continue with the next iteration of the loop, \n - * otherwise @c false to break out of the loop - * - * @pre account_query_capability_by_account_id() must be called. - * - * @see account_query_capability_by_account_id() - */ -typedef bool (*account_custom_cb)(char* key, char* value, void *user_data); - - -/** - * @brief Called once for each account provider in the database. - * - * @since_tizen 2.3 - * @param[in] account_type The account provider handle - * @param[in] user_data The user data passed - * - * @return @c true to continue with the next iteration of the loop, \n - * otherwise @c false to break out of the loop - * - * @pre account_type_foreach_account_type_from_db(), account_type_query_by_provider_feature() must be called. - * - * @see account_type_foreach_account_type_from_db() - * @see account_type_query_by_provider_feature() - */ -typedef bool (*account_type_cb)(account_type_h account_type, void *user_data); - - -/** - * @brief Called once for each account label. - * - * @since_tizen 2.3 - * @param[in] app_id The application ID - * @param[in] label The name of the account depends on the specified locale - * @param[in] locale The locale is specified as an ISO 3166 alpha-2 two letter country-code followed by ISO 639-1 for the two-letter language code.\n - * For example, "ko_KR" for Korean, "en_US" for American English. - * @param[in] user_data The user data passed - * - * @return @c true to continue with the next iteration of the loop, \n - * otherwise @c false to break out of the loop - * - * @pre account_type_get_label(), account_type_query_label_by_app_id() must be called. - * - * @see account_type_get_label() - * @see account_type_query_label_by_app_id() - */ -typedef bool (*account_label_cb)(char* app_id, char* label, char* locale, void *user_data); - - -/** - * @brief Called once for each capability of an account provider in the database. - * - * @since_tizen 2.3 - * @param[in] app_id The application ID - * @param[in] key The user custom key - * @param[in] user_data The user data passed - * - * @return @c true to continue with the next iteration of the loop, \n - * otherwise @c false to break out of the loop - * - * @pre account_type_query_provider_feature_by_app_id(), account_type_get_provider_feature_all() must be called. - * - * @see account_type_query_provider_feature_by_app_id() - * @see account_type_get_provider_feature_all() - */ -typedef bool (*provider_feature_cb)(char* app_id, char* key, void* user_data); - - -/** - * @brief Called once when an event occurs. - * - * @since_tizen 2.3 - * @param[in] event_type The account event type - * @param[in] account_id The account ID to update - * @param[in] user_data The user data passed - * - * @return @c true to continue with the next iteration of the loop, \n - * otherwise @c false to break out of the loop - * - * @pre account_subscribe_notification() must be called. - * - * @see account_subscribe_notification() - */ -typedef bool (*account_event_cb)(const char* event_type, int account_id, void* user_data); - - -/** - * @deprecated Deprecated since Tizen 2.4.\n - * This API is not necessary to use since Tizen 2.4. - * @brief Connects to the account database by readwrite mode. - * - * @since_tizen 2.3 - * @privlevel public - * @privilege %http://tizen.org/privilege/account.read \n - * %http://tizen.org/privilege/account.wirte - * @remarks This API need both privileges - * @return @c 0 on success, - * otherwise a negative error value - * @retval #ACCOUNT_ERROR_NONE Successful - * @retval #ACCOUNT_ERROR_DB_NOT_OPENED DB is not connected - * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission - */ -int account_connect(void); - - -/** - * @deprecated Deprecated since Tizen 2.4.\n - * This API is not necessary to use since Tizen 2.4. - * @brief Connects to the account database by readonly mode. - * - * @since_tizen 2.3 - * @return @c 0 on success, - * otherwise a negative error value - * @retval #ACCOUNT_ERROR_NONE Successful - * @retval #ACCOUNT_ERROR_DB_NOT_OPENED DB is not connected - * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission - */ -int account_connect_readonly(void); - - -/** - * @deprecated Deprecated since Tizen 2.4.\n - * This API is not necessary to use since Tizen 2.4. - * @brief Disconnects from the account database. - * - * @since_tizen 2.3 - * @return @c 0 on success, - * otherwise a negative error value - * @retval #ACCOUNT_ERROR_NONE Successful - * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission - * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite busy handler exprired - */ -int account_disconnect(void); - -/** - * @brief Creates a handle to the account. - * - * @since_tizen 2.3 - * @remarks Release @a account using account_destroy(). - * @remarks The created handle is not added to the account database until account_insert_to_db() is called. - * - * @param[in] account The account handle - * - * @return @c 0 on success, - * otherwise a negative error value - * @retval #ACCOUNT_ERROR_NONE Successful - * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of Memory - * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter - * - * @see account_destroy() - */ -int account_create(account_h *account); - - -/** - * @brief Destroys the account handle and releases all its resources. - * - * @since_tizen 2.3 - * @param[in] account The account handle - * - * @return @c 0 on success, - * otherwise a negative error value - * @retval #ACCOUNT_ERROR_NONE Successful - * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter - * - * @see account_create() - */ -int account_destroy(account_h account); - - -/** - * @brief Inserts the account details to the account database. - * - * @since_tizen 2.3 - * @privlevel public - * @privilege %http://tizen.org/privilege/account.read \n - * %http://tizen.org/privilege/account.write - * @remarks This API need both privileges - * @param[in] account The account handle - * @param[out] account_db_id The account ID to be assigned to an account - * - * @return @c 0 on success, - * otherwise a negative error value - * @retval #ACCOUNT_ERROR_NONE Successful - * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of Memory - * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed - * @retval #ACCOUNT_ERROR_DUPLICATED Same user name exists in your application - * @retval #ACCOUNT_ERROR_NOT_ALLOW_MULTIPLE Tried to add an account in spite of multiple false accounts - * @retval #ACCOUNT_ERROR_NOT_REGISTERED_PROVIDER Tried to add an account though you did not register the account type in manifest - * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission - * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy - * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened - * - * @pre This function requires an open connection to an account service by account_connect() on tizen 2.3.\n - * But the account_connect() is not required to use this function since tizen 2.4. - * - * @see account_delete_from_db_by_id() - * @see account_delete_from_db_by_user_name() - * @see account_delete_from_db_by_package_name() - * @see account_update_to_db_by_id() - * @see account_update_to_db_by_user_name() - */ -int account_insert_to_db(account_h account, int *account_db_id); - - -/** - * @brief Deletes an account from the account database by account DB ID. - * - * @since_tizen 2.3 - * @privlevel public - * @privilege %http://tizen.org/privilege/account.read \n - * %http://tizen.org/privilege/account.write - * @remarks This API need both privileges \n - * Only can delete an account which was added by same package applications - * @param[in] account_db_id The account ID to delete - * - * @return @c 0 on success, - * otherwise a negative error value - * @retval #ACCOUNT_ERROR_NONE Successful - * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of Memory - * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed - * @retval #ACCOUNT_ERROR_PERMISSION_DENIED The account owner is different from the caller or DB Access fail by permission - * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy - * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened - * - * @pre This function requires an open connection to an account service by account_connect() on tizen 2.3.\n - * But the account_connect() is not required to use this function since tizen 2.4. - * - * @see account_insert_to_db() - * @see account_delete_from_db_by_user_name() - * @see account_delete_from_db_by_package_name() - * @see account_update_to_db_by_id() - * @see account_update_to_db_by_user_name() - */ -int account_delete_from_db_by_id(int account_db_id); - - -/** - * @brief Deletes an account from the account database by user name. - * - * @since_tizen 2.3 - * @privlevel public - * @privilege %http://tizen.org/privilege/account.read \n - * %http://tizen.org/privilege/account.write - * @remarks This API need both privileges \n - * Only can delete accounts which were added by same package applications - * @param[in] user_name The user name of the account to delete - * @param[in] package_name The package name of the account to delete - * - * @return @c 0 on success, - * otherwise a negative error value - * @retval #ACCOUNT_ERROR_NONE Successful - * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of Memory - * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed - * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission - * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy - * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened - * - * @pre This function requires an open connection to an account service by account_connect() on tizen 2.3.\n - * But the account_connect() is not required to use this function since tizen 2.4. - * - * @see account_insert_to_db() - * @see account_delete_from_db_by_id() - * @see account_delete_from_db_by_package_name() - * @see account_update_to_db_by_id() - * @see account_update_to_db_by_user_name() - */ -int account_delete_from_db_by_user_name(char *user_name, char *package_name); - - -/** - * @brief Deletes an account from the account database by package name. - * - * @since_tizen 2.3 - * @privlevel public - * @privilege %http://tizen.org/privilege/account.read \n - * %http://tizen.org/privilege/account.write - * @remarks This API need both privileges \n - * Only can delete accounts which was added by same package applications - * @param[in] package_name The package name of account(s) to delete - * - * @return @c 0 on success, - * otherwise a negative error value - * @retval #ACCOUNT_ERROR_NONE Successful - * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed - * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission - * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy - * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened - * - * @pre This function requires an open connection to an account service by account_connect() on tizen 2.3.\n - * But the account_connect() is not required to use this function since tizen 2.4. - * - * @see account_insert_to_db() - * @see account_delete_from_db_by_id() - * @see account_delete_from_db_by_user_name() - * @see account_update_to_db_by_id() - * @see account_update_to_db_by_user_name() - */ -int account_delete_from_db_by_package_name(const char *package_name); - -/** - * @brief Updates the account details to the account database. - * - * @since_tizen 2.3 - * @privlevel public - * @privilege %http://tizen.org/privilege/account.read \n - * %http://tizen.org/privilege/account.write - * @remarks This API need both privileges \n - * Only can update an account which was added by same package applications - * @param[in] account The account handle - * @param[in] account_id The account ID to update - * - * @return @c 0 on success, - * otherwise a negative error value - * @retval #ACCOUNT_ERROR_NONE Successful - * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed - * @retval #ACCOUNT_ERROR_RECORD_NOT_FOUND The account to update does not exist - * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission - * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy - * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened - * - * @pre This function requires an open connection to an account service by account_connect() on tizen 2.3.\n - * But the account_connect() is not required to use this function since tizen 2.4. - * - * @see account_insert_to_db() - * @see account_delete_from_db_by_id() - * @see account_delete_from_db_by_user_name() - * @see account_delete_from_db_by_package_name() - * @see account_update_to_db_by_user_name() - */ -int account_update_to_db_by_id(account_h account, int account_id); - -/** - * @brief Updates the account details to the account database. - * The provider permission check has been added since tizen 2.4. - * - * @since_tizen 2.3 - * @privlevel public - * @privilege %http://tizen.org/privilege/account.read \n - * %http://tizen.org/privilege/account.write - * @remarks This API need both privileges \n - * Only can update an account which was added by same package applications - * @param[in] account The account handle - * @param[in] account_id The account ID to update - * - * @return @c 0 on success, - * otherwise a negative error value - * @retval #ACCOUNT_ERROR_NONE Successful - * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of Memory - * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed - * @retval #ACCOUNT_ERROR_RECORD_NOT_FOUND The account to update does not exist - * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission - * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy - * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened - * - * @pre This function requires an open connection to an account service by account_connect() on tizen 2.3.\n - * But the account_connect() is not required to use this function since tizen 2.4. - * - * @see account_insert_to_db() - * @see account_delete_from_db_by_id() - * @see account_delete_from_db_by_user_name() - * @see account_delete_from_db_by_package_name() - * @see account_update_to_db_by_user_name() - */ -int account_update_to_db_by_id_ex(account_h account, int account_id); - -/** - * @brief Updates the account details to the account database. - * - * @since_tizen 2.3 - * @privlevel public - * @privilege %http://tizen.org/privilege/account.read \n - * %http://tizen.org/privilege/account.write - * @remarks This API need both privileges \n - * Only can update accounts which were added by same package applications - * @param[in] account The account handle - * @param[in] user_name The user name of the account to update - * @param[in] package_name The package name for the user name - * - * @return @c 0 on success, - * otherwise a negative error value - * @retval #ACCOUNT_ERROR_NONE Successful - * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed - * @retval #ACCOUNT_ERROR_RECORD_NOT_FOUND The account to update does not exist - * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission - * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy - * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened - * - * @pre This function requires an open connection to an account service by account_connect() on tizen 2.3.\n - * But the account_connect() is not required to use this function since tizen 2.4. - * - * @see account_insert_to_db() - * @see account_delete_from_db_by_id() - * @see account_delete_from_db_by_user_name() - * @see account_delete_from_db_by_package_name() - * @see account_update_to_db_by_id() - * - */ -int account_update_to_db_by_user_name(account_h account, const char *user_name, const char *package_name); - -/** - * @brief Gets the ID of an account. - * - * @since_tizen 2.3 - * @param[in] account The account handle - * @param[out] account_id The account ID - * - * @return @c 0 on success, - * otherwise a negative error value - * @retval #ACCOUNT_ERROR_NONE Successful - * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter - * - */ -int account_get_account_id(account_h account, int *account_id); - -/** - * @brief Gets the user name of an account. - * - * @since_tizen 2.3 - * @remarks You must release @a user_name using free(). - * - * @param[in] account The account handle - * @param[out] user_name The user name of the account - * - * @return @c 0 on success, - * otherwise a negative error value - * @retval #ACCOUNT_ERROR_NONE Successful - * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of memory - * - * @see account_set_user_name() - */ -int account_get_user_name(account_h account, char **user_name); - - -/** - * @brief Sets the user name of an account. - * - * @since_tizen 2.3 - * @param[in] account The account handle - * @param[in] user_name The string to set as user name - * - * @return @c 0 on success, - * otherwise a negative error value - * @retval #ACCOUNT_ERROR_NONE Successful - * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter - * - * @see account_get_user_name() - */ -int account_set_user_name(account_h account, const char *user_name); - - -/** - * @brief Gets the display name of an account. - * - * @since_tizen 2.3 - * @remarks You must release @a display_name using free(). - * - * @param[in] account The account handle - * @param[out] display_name The display name of the account - * - * @return @c 0 on success, - * otherwise a negative error value - * @retval #ACCOUNT_ERROR_NONE Successful - * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of memory - * - * @see account_get_display_name() - */ -int account_get_display_name(account_h account, char **display_name); - - -/** - * @brief Sets the display name of an account. - * - * @since_tizen 2.3 - * @param[in] account The account handle - * @param[in] display_name The text string to set as the display name - * - * @return @c 0 on success, - * otherwise a negative error value - * @retval #ACCOUNT_ERROR_NONE Successful - * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter - * - * @see account_get_display_name() - */ -int account_set_display_name(account_h account, const char *display_name); - -/** - * @brief Gets the capability detail of an account. - * - * @since_tizen 2.3 - * @param[in] account The account handle - * @param[in] capability_type The capability type to get the capability value - * @param[out] capability_value The capability value (on/off) of the specified capability_type - * - * @return @c 0 on success, - * otherwise a negative error value - * @retval #ACCOUNT_ERROR_NONE Successful - * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #ACCOUNT_ERROR_RECORD_NOT_FOUND There is no given capability_type in the account - * - * @see account_set_capability() - */ -int account_get_capability(account_h account, const char* capability_type, account_capability_state_e* capability_value); - -/** - * @brief Gets all the capabilities of an account. - * - * @since_tizen 2.3 - * @param[in] account The account handle - * @param[in] callback The callback function - * @param[in] user_data The user data to be passed to the callback function - * - * @return @c 0 on success, - * otherwise a negative error value - * @retval #ACCOUNT_ERROR_NONE Successful - * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter - * - * @see account_set_capability() - */ -int account_get_capability_all(account_h account, capability_cb callback, void *user_data); - -/** - * @brief Sets the capability. - * - * @since_tizen 2.3 - * @param[in] account The account handle - * @param[in] capability_type The capability type - * @param[in] capability_state The capability state - * - * @return @c 0 on success, - * otherwise a negative error value - * @retval #ACCOUNT_ERROR_NONE Successful - * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter - * - * @see account_get_capability() - */ -int account_set_capability(account_h account, const char* capability_type, account_capability_state_e capability_state); - - -/** - * @brief Gets the icon path. - * - * @since_tizen 2.3 - * @remarks You must release @a icon_path using free(). - * - * @param[in] account The account handle - * @param[out] icon_path The icon path - * - * @return @c 0 on success, - * otherwise a negative error value - * @retval #ACCOUNT_ERROR_NONE Successful - * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of memory - * - * @see account_set_icon_path() - */ -int account_get_icon_path(account_h account, char **icon_path); - - -/** - * @brief Sets the icon path. - * - * @since_tizen 2.3 - * @param[in] account The account handle - * @param[in] icon_path The text string to set as the icon path - * - * @return @c 0 on success, - * otherwise a negative error value - * @retval #ACCOUNT_ERROR_NONE Successful - * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter - * - * @see account_get_icon_path() - */ -int account_set_icon_path(account_h account, const char *icon_path); - - -/** - * @brief Gets the domain name. - * - * @since_tizen 2.3 - * @remarks You must release @a domain_name using free(). - * - * @param[in] account The account handle - * @param[out] domain_name The domain name - * - * @return @c 0 on success, - * otherwise a negative error value - * @retval #ACCOUNT_ERROR_NONE Successful - * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of memory - * - * @see account_set_domain_name() - */ -int account_get_domain_name(account_h account, char **domain_name); - - -/** - * @brief Sets the domain name. - * - * @since_tizen 2.3 - * @param[in] account The account handle - * @param[in] domain_name The text string to set as the domain name - * - * @return @c 0 on success, - * otherwise a negative error value - * @retval #ACCOUNT_ERROR_NONE Successful - * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter - * - * @see account_get_domain_name() - */ -int account_set_domain_name(account_h account, const char *domain_name); - - -/** - * @brief Gets the email address. - * - * @since_tizen 2.3 - * @remarks You must release @a email_address using free(). - * - * @param[in] account The account handle - * @param[out] email_address The email address - * - * @return @c 0 on success, - * otherwise a negative error value - * @retval #ACCOUNT_ERROR_NONE Successful - * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of memory - * - * @see account_set_email_address() - */ -int account_get_email_address(account_h account, char **email_address); - - -/** - * @brief Sets the email address. - * - * @since_tizen 2.3 - * @param[in] account The account handle - * @param[in] email_address The text string to set as the email address - * - * @return @c 0 on success, - * otherwise a negative error value - * @retval #ACCOUNT_ERROR_NONE Successful - * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter - * - * @see account_get_email_address() - */ -int account_set_email_address(account_h account, const char *email_address); - - -/** - * @brief Gets the package name. - * - * @since_tizen 2.3 - * @remarks You must release @a package_name using free(). - * - * @param[in] account The account handle - * @param[out] package_name The package name - * - * @return @c 0 on success, - * otherwise a negative error value - * @retval #ACCOUNT_ERROR_NONE Successful - * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of memory - * - * @see account_set_package_name() - */ -int account_get_package_name(account_h account, char **package_name); - - -/** - * @brief Sets the package name. - * - * @since_tizen 2.3 - * @param[in] account The account handle - * @param[in] package_name The text string to set as the package name - * - * @return @c 0 on success, - * otherwise a negative error value - * @retval #ACCOUNT_ERROR_NONE Successful - * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter - * - * @see account_get_email_address() - */ -int account_set_package_name(account_h account, const char *package_name); - - -/** - * @brief Gets the access token. Access token field is used to store account secrets (such as password or master token). - * - * @since_tizen 2.3 - * @remarks You must release @a access_token using free(). - * - * @param[in] account The account handle - * @param[out] access_token The access token - * - * @return @c 0 on success, - * otherwise a negative error value - * @retval #ACCOUNT_ERROR_NONE Successful - * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of memory - * - * @remarks Access token field is used for storing account secret (password / master token etc) - * Only account owner application can retrieve account password / access_token. For others this field will be null. - * @see account_set_access_token() - */ -int account_get_access_token(account_h account, char **access_token); - - -/** - * @brief Sets the access token. Access token field is used to store account secrets (such as password or master token). - * - * @since_tizen 2.3 - * @param[in] account The account handle - * @param[in] access_token The text string to set as the access token - * - * @return @c 0 on success, - * otherwise a negative error value - * @retval #ACCOUNT_ERROR_NONE Successful - * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter - * @remarks Only account owner application can retrieve account password / access_token. For others this field will be null. - * @see account_get_access_token() - */ -int account_set_access_token(account_h account, const char *access_token); - - -/** - * @brief Gets the user text. - * - * @since_tizen 2.3 - * @remarks You must release @a user_text using free(). - * - * @param[in] account The account handle - * @param[in] user_text_index The index of the user text (range: 0 ~ 4) - * @param[out] user_text The user text - * - * @return @c 0 on success, - * otherwise a negative error value - * @retval #ACCOUNT_ERROR_NONE Successful - * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of memory - * - * @see account_set_user_text() - */ -int account_get_user_text(account_h account, int user_text_index, char **user_text); - - -/** - * @brief Sets the user text. - * - * @since_tizen 2.3 - * @param[in] account The account handle - * @param[in] user_text_index The index of the user text (must be in range from @c 0 to @c 4) - * @param[in] user_text The text string to set as the user text - * - * @return @c 0 on success, - * otherwise a negative error value - * @retval #ACCOUNT_ERROR_NONE Successful - * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter - * - * @see account_get_user_text() - */ -int account_set_user_text(account_h account, int user_text_index, const char *user_text); - - -/** - * @brief Gets the user integer. - * - * @since_tizen 2.3 - * @param[in] account The account handle - * @param[in] user_int_index The index of the user integer (must be in range from @c 0 to @c 4) - * @param[out] user_integer The user integer - * - * @return @c 0 on success, - * otherwise a negative error value - * @retval #ACCOUNT_ERROR_NONE Successful - * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter - * - * @see account_set_user_int() - */ -int account_get_user_int(account_h account, int user_int_index, int *user_integer); - - -/** - * @brief Sets the user integer. - * - * @since_tizen 2.3 - * @param[in] account The account handle - * @param[in] user_int_index The index of the user integer (must be in range from @c 0 to @c 4) - * @param[in] user_integer The integer to set as the user integer - * - * @return @c 0 on success, - * otherwise a negative error value - * @retval #ACCOUNT_ERROR_NONE Successful - * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter - * - * @see account_get_user_int() - */ -int account_set_user_int(account_h account, int user_int_index, int user_integer); - - -/** - * @brief Gets the auth type. - * - * @since_tizen 2.3 - * @param[in] account The account handle - * @param[out] auth_type The auth type - * - * @return @c 0 on success, - * otherwise a negative error value - * @retval #ACCOUNT_ERROR_NONE Successful - * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter - * - * @see account_set_auth_type() - */ -int account_get_auth_type(account_h account, account_auth_type_e *auth_type); - - -/** - * @brief Sets the auth type. - * - * @since_tizen 2.3 - * @param[in] account The account handle - * @param[in] auth_type The integer to be set as the auth type - * - * @return @c 0 on success, - * otherwise a negative error value - * @retval #ACCOUNT_ERROR_NONE Successful - * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter - * - * @see account_get_auth_type() - */ -int account_set_auth_type(account_h account, const account_auth_type_e auth_type); - - -/** - * @brief Gets the secret. - * - * @since_tizen 2.3 - * @param[in] account The account handle - * @param[out] secret The secret - * - * @return @c 0 on success, - * otherwise a negative error value - * @retval #ACCOUNT_ERROR_NONE Successful - * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter - * - * @see account_set_secret() - */ -int account_get_secret(account_h account, account_secrecy_state_e *secret); - - -/** - * @brief Sets the secret. - * - * @since_tizen 2.3 - * @param[in] account The account handle - * @param[in] secret The secrecy to be set - * - * @return @c 0 on success, - * otherwise a negative error value - * @retval #ACCOUNT_ERROR_NONE Successful - * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter - * - * @see account_get_secret() - */ -int account_set_secret(account_h account, const account_secrecy_state_e secret); - -/** - * @brief Gets the sync support. - * - * @since_tizen 2.3 - * @param[in] account The account handle - * @param[out] sync_support The sync support - * - * @return @c 0 on success, - * otherwise a negative error value - * @retval #ACCOUNT_ERROR_NONE Successful - * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter - * - * @see account_set_sync_support() - */ -int account_get_sync_support(account_h account, account_sync_state_e *sync_support); - - -/** - * @brief Sets the sync support. - * - * @since_tizen 2.3 - * @param[in] account The account handle - * @param[in] sync_support The sync state to be set - * - * @return @c 0 on success, - * otherwise a negative error value - * @retval #ACCOUNT_ERROR_NONE Successful - * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter - * - * @see account_get_sync_support() - */ -int account_set_sync_support(account_h account, const account_sync_state_e sync_support); - - -/** - * @brief Gets the source. - * - * @since_tizen 2.3 - * @remarks You must release @a user_text using free(). - * - * @param[in] account The account handle - * @param[out] source The source - * - * @return @c 0 on success, - * otherwise a negative error value - * @retval #ACCOUNT_ERROR_NONE Successful - * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of memory - * - * @see account_set_source() - */ -int account_get_source(account_h account, char **source); - - -/** - * @brief Sets the source. - * - * @since_tizen 2.3 - * @param[in] account The account handle - * @param[in] source The text string to set as the source - * - * @return @c 0 on success, - * otherwise a negative error value - * @retval #ACCOUNT_ERROR_NONE Successful - * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter - * - * @see account_get_source() - */ -int account_set_source(account_h account, const char *source); - -/** - * @brief Sets the custom. - * - * @since_tizen 2.3 - * @param[in] account The account handle - * @param[in] key The user custom key for the specific value - * @param[in] value The user custom value about the given key - * - * @return @c 0 on success, - * otherwise a negative error value - * @retval #ACCOUNT_ERROR_NONE Successful - * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter - * - * @see account_get_custom() - */ -int account_set_custom(account_h account, const char* key, const char* value); - -/** - * @brief Gets the user specific custom text of an account key. - * - * @since_tizen 2.3 - * @param[in] account The account handle - * @param[in] key The key to retrieve custom text - * @param[out] value The text of the given key - * - * @return @c 0 on success, - * otherwise a negative error value - * @retval #ACCOUNT_ERROR_NONE Successful - * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #ACCOUNT_ERROR_RECORD_NOT_FOUND There is no given capability type in the account - * - * @see account_set_custom() - */ -int account_get_custom(account_h account, const char* key, char** value); - - -/** - * @brief Gets all the user custom texts of an account. - * - * @since_tizen 2.3 - * @param[in] account The account handle - * @param[in] callback The callback function to retrieve all custom text \n - * The callback function gives the key and value. - * @param[in] user_data The user data to be passed to the callback function - * - * @return @c 0 on success, - * otherwise a negative error value - * @retval #ACCOUNT_ERROR_NONE Successful - * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter - * - * @see account_set_custom() - */ -int account_get_custom_all(account_h account, account_custom_cb callback, void* user_data); - -/** - * @brief Retrieves all accounts details by invoking the given callback function iteratively. - * - * @since_tizen 2.3 - * @privlevel public - * @privilege %http://tizen.org/privilege/account.read - * @param[in] callback The callback function to invoke - * @param[in] user_data The user data to be passed to the callback function - * - * @return @c 0 on success, - * otherwise a negative error value - * @retval #ACCOUNT_ERROR_NONE Successful - * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed - * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission - * @retval #ACCOUNT_ERROR_RECORD_NOT_FOUND Related record does not exist - * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy - * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened - * - * @pre This function requires an open connection to an account service by account_connect() on tizen 2.3.\n - * But the account_connect() is not required to use this function since tizen 2.4. - * @post This function invokes account_cb(). - * - * @see account_query_account_by_account_id() - * @see account_query_account_by_user_name() - * @see account_query_account_by_package_name() - * @see account_query_account_by_capability() - */ -int account_foreach_account_from_db(account_cb callback, void *user_data); - - -/** - * @brief Retrieve an account with the account ID. - * - * @since_tizen 2.3 - * @privlevel public - * @privilege %http://tizen.org/privilege/account.read - * @param[in] account_db_id The account database ID to search - * @param[out] account The account handle \n - * Must be allocated by account_create() and freed after using by account_destroy(). - * - * @return @c 0 on success, - * otherwise a negative error value - * @retval #ACCOUNT_ERROR_NONE Successful - * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of Memory - * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed - * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission - * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy - * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened - * - * @pre This function requires an open connection to an account service by account_connect() on tizen 2.3.\n - * But the account_connect() is not required to use this function since tizen 2.4. - * - * @see account_query_account_by_user_name() - * @see account_query_account_by_package_name() - * @see account_query_account_by_capability() - */ -int account_query_account_by_account_id(int account_db_id, account_h *account); - -/** - * @brief Retrieves all accounts with the user name. - * - * @since_tizen 2.3 - * @privlevel public - * @privilege %http://tizen.org/privilege/account.read - * @param[in] callback The callback function to invoke - * @param[in] user_name The user name to search - * @param[in] user_data The user data to be passed to the callback function - * - * @return @c 0 on success, - * otherwise a negative error value - * @retval #ACCOUNT_ERROR_NONE Successful - * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of Memory - * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed - * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission - * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy - * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened - * - * @pre This function requires an open connection to an account service by account_connect() on tizen 2.3.\n - * But the account_connect() is not required to use this function since tizen 2.4. - * @post This function invokes account_cb(). - * - * @see account_foreach_account_from_db() - * @see account_query_account_by_account_id() - * @see account_query_account_by_package_name() - * @see account_query_account_by_capability() - * - */ -int account_query_account_by_user_name(account_cb callback, const char* user_name, void* user_data); - -/** - * @brief Retrieves all accounts with the package name. - * - * @since_tizen 2.3 - * @privlevel public - * @privilege %http://tizen.org/privilege/account.read - * @param[in] callback The callback function to invoke - * @param[in] package_name The package name to search - * @param[in] user_data The user data to be passed to the callback function - * - * @return @c 0 on success, - * otherwise a negative error value - * @retval #ACCOUNT_ERROR_NONE Successful - * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of Memory - * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed - * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission - * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy - * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened - * - * @pre This function requires an open connection to an account service by account_connect() on tizen 2.3.\n - * But the account_connect() is not required to use this function since tizen 2.4. - * @post This function invokes account_cb(). - * - * @see account_foreach_account_from_db() - * @see account_query_account_by_account_id() - * @see account_query_account_by_user_name() - * @see account_query_account_by_capability() - */ -int account_query_account_by_package_name(account_cb callback, const char *package_name, void *user_data); - -/** - * @brief Retrieves all accounts with the capability type and capability value. - * - * @since_tizen 2.3 - * @privlevel public - * @privilege %http://tizen.org/privilege/account.read - * @param[in] callback The callback function to invoke - * @param[in] capability_type The capability type to search - * @param[in] capability_value The capability value to search - * @param[in] user_data The user data to be passed to the callback function - * - * @return @c 0 on success, - * otherwise a negative error value - * @retval #ACCOUNT_ERROR_NONE Successful - * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of Memory - * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed - * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission - * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy - * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened - * - * @pre This function requires an open connection to an account service by account_connect() on tizen 2.3.\n - * But the account_connect() is not required to use this function since tizen 2.4. - * @post This function invokes account_cb(). - * - * @see account_foreach_account_from_db() - * @see account_query_account_by_account_id() - * @see account_query_account_by_user_name() - * @see account_query_account_by_package_name() - */ -int account_query_account_by_capability(account_cb callback, const char* capability_type, account_capability_state_e capability_value, void *user_data); - -/** - * @brief Retrieves all accounts with the capability type. - * - * @since_tizen 2.3 - * @privlevel public - * @privilege %http://tizen.org/privilege/account.read - * @param[in] callback The callback function to invoke - * @param[in] capability_type The capability type to search - * @param[in] user_data The user data to be passed to the callback function - * - * @return @c 0 on success, - * otherwise a negative error value - * @retval #ACCOUNT_ERROR_NONE Successful - * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of Memory - * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed - * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission - * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy - * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened - * - * @pre This function requires an open connection to an account service by account_connect() on tizen 2.3.\n - * But the account_connect() is not required to use this function since tizen 2.4. - * @post This function invokes account_cb(). - * - * @see account_foreach_account_from_db() - * @see account_query_account_by_account_id() - * @see account_query_account_by_user_name() - * @see account_query_account_by_package_name() - */ -int account_query_account_by_capability_type(account_cb callback, const char* capability_type, void* user_data); - -/** - * @brief Retrieves all capabilities with the account database ID. - * - * @since_tizen 2.3 - * @privlevel public - * @privilege %http://tizen.org/privilege/account.read - * @param[in] callback The callback function to invoke - * @param[in] account_db_id The account database ID to search - * @param[in] user_data The user data to be passed to the callback function - * - * @return @c 0 on success, - * otherwise a negative error value - * @retval #ACCOUNT_ERROR_NONE Successful - * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of Memory - * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed - * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission - * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy - * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened - * - * @pre This function requires an open connection to an account service by account_connect() on tizen 2.3.\n - * But the account_connect() is not required to use this function since tizen 2.4. - * @post This function invokes capability_cb(). - * - * @see account_get_capability() - * @see account_set_capability() - */ -int account_query_capability_by_account_id(capability_cb callback, int account_db_id, void *user_data); - - -/** - * @brief Gets the count of accounts in the account database. - * - * @since_tizen 2.3 - * @privlevel public - * @privilege %http://tizen.org/privilege/account.read - * @param[out] count The out parameter for count of all accounts - * - * @return @c 0 on success, - * otherwise a negative error value - * @retval #ACCOUNT_ERROR_NONE Successful - * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed - * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission - * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy - * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened - * - * @pre This function requires an open connection to an account service by account_connect() on tizen 2.3.\n - * But the account_connect() is not required to use this function since tizen 2.4. - */ -int account_get_total_count_from_db(int *count); - -/** - * @brief Updates the sync status of an account with the given account ID. - * - * @since_tizen 2.3 - * @privlevel public - * @privilege %http://tizen.org/privilege/account.read \n - * %http://tizen.org/privilege/account.write - * @remarks This API need both privileges \n - * Only can update an account which was added by same package applications - * @param[in] account_db_id The account ID for which sync status needs to be changed - * @param[in] sync_status The new sync status - * - * @return @c 0 on success, - * otherwise a negative error value - * @retval #ACCOUNT_ERROR_NONE Successful - * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of Memory - * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed - * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission - * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy - * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened - * - * @pre This function requires an open connection to an account service by account_connect() on tizen 2.3.\n - * But the account_connect() is not required to use this function since tizen 2.4. - */ -int account_update_sync_status_by_id(int account_db_id, const account_sync_state_e sync_status); - - -/* Account type API */ - - -/** - * @brief Creates a handle to the account provider. - * - * @since_tizen 2.3 - * @remarks You must release @a account_type handle using account_type_destroy().\n - * - * @param[in] account_type The account provider handle - * - * @return @c 0 on success, - * otherwise a negative error value - * @retval #ACCOUNT_ERROR_NONE Successful - * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of Memory - * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter - * - * @see account_type_destroy() - */ -int account_type_create(account_type_h *account_type); - -/** - * @brief Destroys the account provider handle and releases all its resources. - * - * @since_tizen 2.3 - * - * @remarks When you get @a account_type_h using account_type_create(), you must release the handle using account_destroy() to avoid the memory leak. - * - * @param[in] account_type The account provider handle - * - * @return @c 0 on success, - * otherwise a negative error value - * @retval #ACCOUNT_ERROR_NONE Successful - * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter - * - * @see account_type_create() - */ -int account_type_destroy(account_type_h account_type); - -/** - * @brief Retrieves capability information with your application ID. - * - * @since_tizen 2.3 - * @privlevel public - * @privilege %http://tizen.org/privilege/account.read - * @param[in] callback The callback function carries the capability name of an app ID - * @param[in] app_id The application ID to search - * @param[in] user_data The user data \n - * If you have your private data to carry into callback function, then you can use it. - * - * @return @c 0 on success, - * otherwise a negative error value - * @retval #ACCOUNT_ERROR_NONE Successful - * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed - * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission - * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy - * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened - * - * @pre This function requires an open connection to an account service by account_connect() on tizen 2.3.\n - * But the account_connect() is not required to use this function since tizen 2.4. - */ -int account_type_query_provider_feature_by_app_id(provider_feature_cb callback, const char* app_id, void *user_data ); - -/** - * @brief Checks whether the given application ID supports the capability. - * - * @since_tizen 2.3 - * @privlevel public - * @privilege %http://tizen.org/privilege/account.read - * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section. - * @param[in] app_id The application ID - * @param[in] capability The capability \n - * For example, ACCOUNT_SUPPORTS_CAPABILITY_CONTACT or "http://tizen.org/account/capability/contact" - * - * @return @c TRUE if the application supports the given capability, \n - * otherwise @c FALSE if the application does not support the given capability - * @retval @c TRUE means the application supports the given capability - * @retval @c FALSE means the application does not support the given capability - * @exception #ACCOUNT_ERROR_NONE Successful - * @exception #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter - * @exception #ACCOUNT_ERROR_RECORD_NOT_FOUND Related record does not exist - * @excaption #ACCOUNT_ERROR_DB_FAILED Database operation failed - * @exception #ACCOUNT_ERROR_PERMISSION_DENIED DB access fail by permission - * @excaption #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy - * @excaption #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened - * - * @pre This function requires an open connection to an account service by account_connect() on tizen 2.3.\n - * But the account_connect() is not required to use this function since tizen 2.4. - */ -bool account_type_query_supported_feature(const char* app_id, const char* capability); - -/** - * @brief Gets the application ID of an account provider. - * - * @since_tizen 2.3 - * @remarks You must release @a app_id using free(). - * - * @param[in] account_type The account provider handle \n - * It should be given by account_type_query_* functions or account_type_foreach_account_type_from_db(). - * @param[out] app_id The application ID of an account provider item - * - * @return @c 0 on success, - * otherwise a negative error value - * @retval #ACCOUNT_ERROR_NONE Successful - * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of memory - * - * @see account_type_foreach_account_type_from_db() - * @see account_type_query_by_app_id() - */ -int account_type_get_app_id(account_type_h account_type, char **app_id); - -/** - * @brief Gets the service provider ID of an account provider. - * - * @since_tizen 2.3 - * @remarks You must release @a service_provider_id using free(). - * - * @param[in] account_type The account provider handle \n - * It should be given by account_type_query_* functions or account_type_foreach_account_type_from_db(). - * @param[out] service_provider_id The service provider text ID of an account provider item - * - * @return @c 0 on success, - * otherwise a negative error value - * @retval #ACCOUNT_ERROR_NONE Successful - * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of memory - * - * @see account_type_foreach_account_type_from_db() - * @see account_type_query_by_app_id() - */ -int account_type_get_service_provider_id(account_type_h account_type, char **service_provider_id); - -/** - * @brief Gets the icon path of an account provider. - * - * @since_tizen 2.3 - * @remarks You must release @a icon_path using free(). - * - * @param[in] account_type The account provider handle \n - * It should be given by account_type_query_* functions or account_type_foreach_account_type_from_db(). - * @param[out] icon_path The icon path of the account provider item - * - * @return @c 0 on success, - * otherwise a negative error value - * @retval #ACCOUNT_ERROR_NONE Successful - * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of memory - * - * @see account_type_foreach_account_type_from_db() - * @see account_type_query_by_app_id() - */ -int account_type_get_icon_path(account_type_h account_type, char **icon_path); - -/** - * @brief Gets the small icon path of an account provider. - * - * @since_tizen 2.3 - * @remarks You must release @a small_icon_path using free(). - * - * @param[in] account_type The account provider handle\n - * It should be given by account_type_query_* functions or account_type_foreach_account_type_from_db(). - * @param[out] small_icon_path The small icon path of the account provider item - * - * @return @c 0 on success, - * otherwise a negative error value - * @retval #ACCOUNT_ERROR_NONE Successful - * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of memory - * - * @see account_type_foreach_account_type_from_db() - * @see account_type_query_by_app_id() - */ -int account_type_get_small_icon_path(account_type_h account_type, char **small_icon_path); - -/** - * @brief Checks whether the given account provider supports multiple accounts. - * - * @since_tizen 2.3 - * @param[in] account_type The account provider handle \n - * It should be given by account_type_query_* functions or account_type_foreach_account_type_from_db. - * @param[out] multiple_account_support The flag indicating support for multiple accounts accounts\n - * TRUE or FALSE. - * - * @return @c 0 on success, - * otherwise a negative error value - * @retval #ACCOUNT_ERROR_NONE Successful - * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of memory - * - * @see account_type_foreach_account_type_from_db() - * @see account_type_query_by_app_id() - */ -int account_type_get_multiple_account_support(account_type_h account_type, int *multiple_account_support); - -/** - * @brief Gets capability information with the given account provider handle. - * - * @since_tizen 2.3 - * @param[in] account_type The account provider handle\n - * It should be given by account_type_query_* functions or account_type_foreach_account_type_from_db(). - * @param[in] callback The callback function that carries the capability name of the app ID - * @param[in] user_data The user data \n - * If you have your private data to carry into callback function, then you can use it. - * - * @return @c 0 on success, - * otherwise a negative error value - * @retval #ACCOUNT_ERROR_NONE Successful - * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed - * - * @pre This function requires an open connection to an account service by account_connect() on tizen 2.3.\n - * But the account_connect() is not required to use this function since tizen 2.4. - */ -int account_type_get_provider_feature_all(account_type_h account_type, provider_feature_cb callback, void* user_data); - -/** - * @brief Gets the specific label information detail of an account provider. - * - * @since_tizen 2.3 - * @param[in] account_type The account provider handle\n - * It should be given by account_type_query_* functions or account_type_foreach_account_type_from_db(). - * @param[in] locale The locale is specified as an ISO 3166 alpha-2 two letter country-code followed by ISO 639-1 for the two-letter language code.\n - * For example, "ko_KR" or "ko-kr" for Korean, "en_US" or "en-us" for American English. - * @param[out] label The label text given for the locale - * - * @return @c 0 on success, - * otherwise a negative error value - * @retval #ACCOUNT_ERROR_NONE Successful - * @retval #ACCOUNT_ERROR_RECORD_NOT_FOUND No label for the given locale - * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter - * - * @see account_type_foreach_account_type_from_db() - * @see account_type_query_by_app_id() - */ - -int account_type_get_label_by_locale(account_type_h account_type, const char* locale, char** label); - -/** - * @brief Gets the label information detail of an account provider. - * - * @since_tizen 2.3 - * @param[in] account_type The account provider handle\n - * It should be given by account_type_query_* functions or account_type_foreach_account_type_from_db(). - * @param[in] callback The callback function carrying the label information - * @param[in] user_data The user data to be passed to the callback function - * - * @return @c 0 on success, - * otherwise a negative error value - * @retval #ACCOUNT_ERROR_NONE Successful - * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter - * - * @see account_type_foreach_account_type_from_db() - * @see account_type_query_by_app_id() - */ -int account_type_get_label(account_type_h account_type, account_label_cb callback, void *user_data); - -/** - * @brief Retrieves the label information with your application ID. - * - * @since_tizen 2.3 - * @privlevel public - * @privilege %http://tizen.org/privilege/account.read - * @param[in] callback The callback function that carries label_h for label information \n - * label_h contains label info as parameter. - * @param[in] app_id The application ID to search - * @param[in] user_data The user data \n - * If you have your private data to carry into callback function, then you can use it. - * - * @return @c 0 on success, - * otherwise a negative error value - * @retval #ACCOUNT_ERROR_NONE Successful - * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed - * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission - * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy - * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened - * - * @pre This function requires an open connection to an account service by account_connect() on tizen 2.3.\n - * But the account_connect() is not required to use this function since tizen 2.4. - * - * @see account_type_query_by_app_id() - * @see account_type_foreach_account_type_from_db() - */ -int account_type_query_label_by_app_id(account_label_cb callback, const char* app_id, void *user_data ); - -/** - * @brief Retrieves the account provider information with your application ID. - * - * @since_tizen 2.3 - * @privlevel public - * @privilege %http://tizen.org/privilege/account.read - * @param[in] app_id The application ID to search - * @param[in/out] account_type The account handle which has to be created by account_type_create() before calling this function and released by account_type_destroy() after calling this function. - * - * @return @c 0 on success, - * otherwise a negative error value - * @retval #ACCOUNT_ERROR_NONE Successful - * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed - * @retval #ACCOUNT_ERROR_RECORD_NOT_FOUND Queried data does not exist - * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission - * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy - * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened - * - * @pre This function requires an open connection to an account service by account_connect() on tizen 2.3.\n - * But the account_connect() is not required to use this function since tizen 2.4. - * - * @see account_type_create() - * @see account_type_get_app_id() - * @see account_type_get_service_provider_id() - * @see account_type_get_icon_path() - * @see account_type_get_small_icon_path() - * @see account_type_get_multiple_account_support() - * @see account_type_get_label() - * @see account_type_destroy() - */ -int account_type_query_by_app_id(const char* app_id, account_type_h *account_type); - -/** - * @brief Retrieves all account priovider information. - * - * @since_tizen 2.3 - * @privlevel public - * @privilege %http://tizen.org/privilege/account.read - * @param[in] callback The account provider information \n - * You can get the account information through account_type_get_* with the carried account_type_handle. - * @param[in] user_data The user data \n - * It will be carried through your callback function. - * - * @return @c 0 on success, - * otherwise a negative error value - * @retval #ACCOUNT_ERROR_NONE Successful - * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed - * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission - * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy - * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened - * - * @pre This function requires an open connection to an account service by account_connect() on tizen 2.3.\n - * But the account_connect() is not required to use this function since tizen 2.4. - * - * @see account_type_create() - * @see account_type_get_app_id() - * @see account_type_get_service_provider_id() - * @see account_type_get_icon_path() - * @see account_type_get_small_icon_path() - * @see account_type_get_multiple_account_support() - * @see account_type_get_label() - * @see account_type_destroy() - */ -int account_type_foreach_account_type_from_db(account_type_cb callback, void *user_data); - -/** - * @brief Retrieves the label information with the given application ID and locale. - * - * @since_tizen 2.3 - * @privlevel public - * @privilege %http://tizen.org/privilege/account.read - * @param[in] app_id The application ID - * @param[in] locale The locale is specified as an ISO 3166 alpha-2 two letter country-code followed by ISO 639-1 for the two-letter language code.\n - * For example, "ko_KR" or "ko-kr" for Korean, "en_US" or "en-us" for American English. - * @param[out] label The label text corresponding app_id and locale \n - * It must be free text. - * - * @return @c 0 on success, - * otherwise a negative error value - * @retval #ACCOUNT_ERROR_NONE Successful - * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed - * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission - * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy - * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened - * - * @pre This function requires an open connection to an account service by account_connect() on tizen 2.3.\n - * But the account_connect() is not required to use this function since tizen 2.4. - */ -int account_type_query_label_by_locale(const char* app_id, const char* locale, char** label); - -/** - * @brief Retrieves account provider information with the capability name. - * - * @since_tizen 2.3 - * @privlevel public - * @privilege %http://tizen.org/privilege/account.read - * @param[in] callback The callback function to retrieve account provider information - * @param[in] key The capability value to search account provider \n - * For example, ACCOUNT_SUPPORTS_CAPABILITY_CONTACT or "http://tizen.org/account/capability/contact" - * @param[in] user_data If you have your private data to carry into callback function, then you can use it - * - * @return @c 0 on success, - * otherwise a negative error value - * @retval #ACCOUNT_ERROR_NONE Successful - * @retval #ACCOUNT_ERROR_RECORD_NOT_FOUND Record not found - * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed - * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission - * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy - * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened - * - * @pre This function requires an open connection to an account service by account_connect() on tizen 2.3.\n - * But the account_connect() is not required to use this function since tizen 2.4. - */ -int account_type_query_by_provider_feature(account_type_cb callback, const char* key, void* user_data); - -/** - * @brief Checks whether the given app_id exists in the account provider DB. - * - * @since_tizen 2.3 - * @privlevel public - * @privilege %http://tizen.org/privilege/account.read - * @param[in] app_id The application ID to check - * - * @return @c 0 on success, - * otherwise a negative error value - * @retval #ACCOUNT_ERROR_NONE Successful - * @retval #ACCOUNT_ERROR_RECORD_NOT_FOUND Record not found - * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid app ID - * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed - * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission - * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy - * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened - * - * @pre This function requires an open connection to an account service by account_connect() on tizen 2.3.\n - * But the account_connect() is not required to use this function since tizen 2.4. - * - * @see account_type_query_by_app_id() - */ -int account_type_query_app_id_exist(const char* app_id); - - - -/* End of account provider API */ - -/** - * @brief Creates a handle for the account event subscription. - * - * @since_tizen 2.3 - * @remarks You must release @a account_subscribe handle using account_unsubscribe_notification(). - * - * @param[in] account_subscribe The account subscription handle - * - * @return @c 0 on success, - * otherwise a negative error value - * @retval #ACCOUNT_ERROR_NONE Successful - * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of Memory - * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter - * - * @see account_unsubscribe_notification() - * @see account_subscribe_notification() - */ -int account_subscribe_create(account_subscribe_h* account_subscribe); - -/** - * @brief Starts to subscribe account event through the given callback function. - * - * @since_tizen 2.3 - * @privlevel public - * @privilege %http://tizen.org/privilege/account.read \n - * @param[in] account_subscribe The account subscription handle - * @param[in] callback The callback function that is called when an account is removed and a data of account is updated from the account database \n - * It will be called with event message and account ID. - * @param[in] user_data The user_data that is delivered to callback - * - * @return @c 0 on success, - * otherwise a negative error value - * @retval #ACCOUNT_ERROR_NONE Successful - * @retval #ACCOUNT_ERROR_EVENT_SUBSCRIPTION_FAIL Subscription fail - * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter - * - * @pre account_subscribe_create() - * - * @see account_unsubscribe_notification() - * @see account_subscribe_notification() - */ -int account_subscribe_notification(account_subscribe_h account_subscribe, account_event_cb callback, void* user_data); - -/** - * @brief Destroys the account subscribe handle and releases all its resources. - * - * @since_tizen 2.3 - * @privlevel public - * @privilege %http://tizen.org/privilege/account.read \n - * @remarks You must call @a account_unsubscribe_notification when you do not need to subscribe account event. - * - * @param[in] account_subscribe The account subscription handle - * - * @return @c 0 on success, - * otherwise a negative error value - * @retval #ACCOUNT_ERROR_NONE Successful - * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #ACCOUNT_ERROR_EVENT_SUBSCRIPTION_FAIL Unsubscription failed - * - * @see account_create() - */ -int account_unsubscribe_notification(account_subscribe_h account_subscribe); - -#ifdef __cplusplus -} -#endif - - -#endif //__ACCOUNT_H_ diff --git a/include/mobile/account.h b/include/mobile/account.h index b60c511..700b107 100644 --- a/include/mobile/account.h +++ b/include/mobile/account.h @@ -1642,10 +1642,10 @@ int account_type_query_label_by_app_id(account_label_cb callback, const char* ap * @brief Retrieves the account provider information with your application ID. * * @since_tizen 2.3 - * @privlevel public - * @privilege %http://tizen.org/privilege/account.read - * @param[in] app_id The application ID to search - * @param[out] account_type The account handle which is created by account_type_create() + * @privlevel public + * @privilege %http://tizen.org/privilege/account.read + * @param[in] app_id The application ID to search + * @param[in/out] account_type The account handle which has to be created by account_type_create() before calling this function and released by account_type_destroy() after calling this function. * * @return @c 0 on success, * otherwise a negative error value diff --git a/include/wearable/account.h b/include/wearable/account.h index cb92acc..e8e1ee1 100644 --- a/include/wearable/account.h +++ b/include/wearable/account.h @@ -1544,10 +1544,11 @@ int account_type_query_label_by_app_id(account_label_cb callback, const char* ap * @brief Retrieves the account provider information with your application ID. * * @since_tizen 2.4 - * @privlevel public - * @privilege %http://tizen.org/privilege/account.read - * @param[in] app_id The application ID to search - * @param[out] account_type The account handle which is created by account_type_create() + * @privlevel public + * @privilege %http://tizen.org/privilege/account.read + * @param[in] app_id The application ID to search + * @param[in/out] account_type The account handle which has to be created by account_type_create() before calling this function and released by account_type_destroy() after calling this function. + * * @return @c 0 on success, * otherwise a negative error value diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index d879ed8..4e829a1 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -5,6 +5,12 @@ SET(SRCS ) INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include) +IF(FEATURE_PROFILE_MOBILE) +INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include/mobile) +ELSE(FEATURE_PROFILE_MOBILE) +INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include/wearable) +ENDIF(FEATURE_PROFILE_MOBILE) + INCLUDE(FindPkgConfig) pkg_check_modules(clientpkgs REQUIRED diff --git a/src/account.c b/src/account.c index 313ebf2..b11f4d6 100644 --- a/src/account.c +++ b/src/account.c @@ -383,12 +383,6 @@ ACCOUNT_API int account_delete_from_db_by_package_name(const char *package_name) return _account_delete_from_db_by_package_name(package_name, true); } -ACCOUNT_INTERNAL_API int account_delete_from_db_by_package_name_without_permission(const char *package_name) -{ - _INFO("account_delete_from_db_by_package_name starting without permission"); - return _account_delete_from_db_by_package_name(package_name, false); -} - ACCOUNT_API int account_update_to_db_by_id(account_h account, int account_id) { //First we will update account db @@ -559,11 +553,11 @@ ACCOUNT_API int account_create(account_h *account) } 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*/ @@ -615,6 +609,10 @@ ACCOUNT_API int account_set_user_name(account_h account, const char *user_name) _ACCOUNT_FREE(data->user_name); data->user_name = _account_get_text(user_name); + if (data->user_name == NULL) { + ACCOUNT_FATAL("OUT OF MEMORY\n"); + return ACCOUNT_ERROR_OUT_OF_MEMORY; + } return ACCOUNT_ERROR_NONE; } @@ -635,6 +633,10 @@ ACCOUNT_API int account_set_display_name(account_h account, const char *display_ _ACCOUNT_FREE(data->display_name); data->display_name = _account_get_text(display_name); + if (data->display_name == NULL) { + ACCOUNT_FATAL("OUT OF MEMORY\n"); + return ACCOUNT_ERROR_OUT_OF_MEMORY; + } return ACCOUNT_ERROR_NONE; } @@ -655,6 +657,10 @@ ACCOUNT_API int account_set_email_address(account_h account, const char *email_a _ACCOUNT_FREE(data->email_address); data->email_address = _account_get_text(email_address); + if (data->email_address == NULL) { + ACCOUNT_FATAL("OUT OF MEMORY\n"); + return ACCOUNT_ERROR_OUT_OF_MEMORY; + } return ACCOUNT_ERROR_NONE; } @@ -675,6 +681,10 @@ ACCOUNT_API int account_set_icon_path(account_h account, const char *icon_path) _ACCOUNT_FREE(data->icon_path); data->icon_path = _account_get_text(icon_path); + if (data->icon_path == NULL) { + ACCOUNT_FATAL("OUT OF MEMORY\n"); + return ACCOUNT_ERROR_OUT_OF_MEMORY; + } return ACCOUNT_ERROR_NONE; } @@ -694,6 +704,10 @@ ACCOUNT_API int account_set_source(account_h account, const char *source) _ACCOUNT_FREE(data->source); data->source = _account_get_text(source); + if (data->source == NULL) { + ACCOUNT_FATAL("OUT OF MEMORY\n"); + return ACCOUNT_ERROR_OUT_OF_MEMORY; + } return ACCOUNT_ERROR_NONE; } @@ -714,6 +728,10 @@ ACCOUNT_API int account_set_package_name(account_h account, const char *package_ _ACCOUNT_FREE(data->package_name); data->package_name = _account_get_text(package_name); + if (data->package_name == NULL) { + ACCOUNT_FATAL("OUT OF MEMORY\n"); + return ACCOUNT_ERROR_OUT_OF_MEMORY; + } return ACCOUNT_ERROR_NONE; } @@ -733,6 +751,10 @@ ACCOUNT_API int account_set_domain_name(account_h account, const char *domain_na _ACCOUNT_FREE(data->domain_name); data->domain_name = _account_get_text(domain_name); + if (data->domain_name == NULL) { + ACCOUNT_FATAL("OUT OF MEMORY\n"); + return ACCOUNT_ERROR_OUT_OF_MEMORY; + } return ACCOUNT_ERROR_NONE; } @@ -753,6 +775,10 @@ ACCOUNT_API int account_set_access_token(account_h account, const char *access_t _ACCOUNT_FREE(data->access_token); data->access_token = _account_get_text(access_token); + if (data->access_token == NULL) { + ACCOUNT_FATAL("OUT OF MEMORY\n"); + return ACCOUNT_ERROR_OUT_OF_MEMORY; + } return ACCOUNT_ERROR_NONE; } @@ -777,6 +803,10 @@ ACCOUNT_API int account_set_user_text(account_h account, int idx, const char *us _ACCOUNT_FREE(data->user_data_txt[idx]); data->user_data_txt[idx] = _account_get_text(user_txt); + if (data->user_data_txt[idx] == NULL) { + ACCOUNT_FATAL("OUT OF MEMORY\n"); + return ACCOUNT_ERROR_OUT_OF_MEMORY; + } return ACCOUNT_ERROR_NONE; } @@ -810,23 +840,59 @@ ACCOUNT_API int account_set_custom(account_h account, const char* key, const cha 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)) { + char *new_value = NULL; + new_value = _account_get_text(value); + if (new_value == NULL) { + ACCOUNT_FATAL("OUT OF MEMORY\n"); + return ACCOUNT_ERROR_OUT_OF_MEMORY; + } + _ACCOUNT_FREE(custom_data->value); - custom_data->value = _account_get_text(value); + custom_data->value = new_value; + b_is_new = FALSE; } } if(b_is_new) { - account_custom_s* custom_data = (account_custom_s*)malloc(sizeof(account_custom_s)); + int error_code = ACCOUNT_ERROR_NONE; + 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_MEMSET(custom_data, 0, sizeof(account_custom_s)); custom_data->account_id = data->id; - custom_data->app_id = _account_get_text(data->package_name); + + /* custom's app_id field will be automatically filled by account-svc daemon. */ +/* custom_data->app_id = _account_get_text(data->package_name); + if (data->package_name != NULL && custom_data->app_id == NULL) { + ACCOUNT_FATAL("OUT OF MEMORY\n"); + error_code = ACCOUNT_ERROR_OUT_OF_MEMORY; + } +*/ custom_data->key = _account_get_text(key); + if (custom_data->key == NULL) { + ACCOUNT_FATAL("OUT OF MEMORY\n"); + error_code = ACCOUNT_ERROR_OUT_OF_MEMORY; + } + custom_data->value = _account_get_text(value); + if (custom_data->value == NULL) { + ACCOUNT_FATAL("OUT OF MEMORY\n"); + error_code = ACCOUNT_ERROR_OUT_OF_MEMORY; + } + + if (error_code != ACCOUNT_ERROR_NONE) { + _ACCOUNT_FREE(custom_data->app_id); + _ACCOUNT_FREE(custom_data->key); + _ACCOUNT_FREE(custom_data->value); + _ACCOUNT_FREE(custom_data); + return error_code; + } + data->custom_list = g_slist_append(data->custom_list, (gpointer)custom_data); } @@ -922,12 +988,21 @@ ACCOUNT_API int account_set_capability(account_h account, const char* capability if(b_is_new) { account_capability_s* cap_data = (account_capability_s*)malloc(sizeof(account_capability_s)); - - if (cap_data == NULL) + if (cap_data == NULL) { + ACCOUNT_FATAL("Memory Allocation Failed"); return ACCOUNT_ERROR_OUT_OF_MEMORY; + } + ACCOUNT_MEMSET(cap_data, 0, sizeof(account_capability_s)); cap_data->type = _account_get_text(capability_type); + if (cap_data->type == NULL) { + ACCOUNT_FATAL("OUT OF MEMORY\n"); + _ACCOUNT_FREE(cap_data->type); + _ACCOUNT_FREE(cap_data); + return ACCOUNT_ERROR_OUT_OF_MEMORY; + } + cap_data->value = capability_value; data->capablity_list = g_slist_append(data->capablity_list, (gpointer)cap_data); } @@ -949,6 +1024,10 @@ ACCOUNT_API int account_get_user_name(account_h account, char **user_name) (*user_name) = NULL; *user_name = _account_get_text(data->user_name); + if (data->user_name != NULL && *user_name == NULL) { + ACCOUNT_FATAL("OUT OF MEMORY\n"); + return ACCOUNT_ERROR_OUT_OF_MEMORY; + } return ACCOUNT_ERROR_NONE; } @@ -968,6 +1047,11 @@ ACCOUNT_API int account_get_display_name(account_h account, char **display_name) (*display_name) = NULL; *display_name = _account_get_text(data->display_name); + if (data->display_name != NULL && *display_name == NULL) { + ACCOUNT_FATAL("OUT OF MEMORY\n"); + return ACCOUNT_ERROR_OUT_OF_MEMORY; + } + return ACCOUNT_ERROR_NONE; } @@ -987,6 +1071,10 @@ ACCOUNT_API int account_get_email_address(account_h account,char **email_address (*email_address) = NULL; *email_address = _account_get_text(data->email_address); + if (data->email_address != NULL && *email_address == NULL) { + ACCOUNT_FATAL("OUT OF MEMORY\n"); + return ACCOUNT_ERROR_OUT_OF_MEMORY; + } return ACCOUNT_ERROR_NONE; } @@ -1006,6 +1094,10 @@ ACCOUNT_API int account_get_icon_path(account_h account, char **icon_path) (*icon_path) = NULL; *icon_path = _account_get_text(data->icon_path); + if (data->icon_path != NULL && *icon_path == NULL) { + ACCOUNT_FATAL("OUT OF MEMORY\n"); + return ACCOUNT_ERROR_OUT_OF_MEMORY; + } return ACCOUNT_ERROR_NONE; } @@ -1025,6 +1117,10 @@ ACCOUNT_API int account_get_source(account_h account, char **source) (*source) = NULL; *source = _account_get_text(data->source); + if (data->source != NULL && *source == NULL) { + ACCOUNT_FATAL("OUT OF MEMORY\n"); + return ACCOUNT_ERROR_OUT_OF_MEMORY; + } return ACCOUNT_ERROR_NONE; } @@ -1044,6 +1140,11 @@ ACCOUNT_API int account_get_package_name(account_h account, char **package_name) (*package_name) = NULL; *package_name = _account_get_text(data->package_name); + if (data->package_name != NULL && *package_name == NULL) { + ACCOUNT_FATAL("OUT OF MEMORY\n"); + return ACCOUNT_ERROR_OUT_OF_MEMORY; + } + return ACCOUNT_ERROR_NONE; } @@ -1063,6 +1164,10 @@ ACCOUNT_API int account_get_domain_name(account_h account, char **domain_name) (*domain_name) = NULL; *domain_name = _account_get_text(data->domain_name); + if (data->domain_name != NULL && *domain_name == NULL) { + ACCOUNT_FATAL("OUT OF MEMORY\n"); + return ACCOUNT_ERROR_OUT_OF_MEMORY; + } return ACCOUNT_ERROR_NONE; } @@ -1082,6 +1187,10 @@ ACCOUNT_API int account_get_access_token(account_h account, char **access_token) (*access_token) = NULL; *access_token = _account_get_text(data->access_token); + if (data->access_token != NULL && *access_token == NULL) { + ACCOUNT_FATAL("OUT OF MEMORY\n"); + return ACCOUNT_ERROR_OUT_OF_MEMORY; + } return ACCOUNT_ERROR_NONE; } @@ -1095,6 +1204,7 @@ ACCOUNT_API int account_get_user_text(account_h account, int user_text_index, ch 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_s *data = (account_s*)account; @@ -1102,6 +1212,10 @@ ACCOUNT_API int account_get_user_text(account_h account, int user_text_index, ch (*text) = NULL; *text = _account_get_text(data->user_data_txt[user_text_index]); + if (data->user_data_txt[user_text_index] != NULL && *text == NULL) { + ACCOUNT_FATAL("OUT OF MEMORY\n"); + return ACCOUNT_ERROR_OUT_OF_MEMORY; + } return ACCOUNT_ERROR_NONE; } @@ -1250,6 +1364,11 @@ ACCOUNT_API int account_get_custom(account_h account, const char* key, char** va if(!strcmp(key, custom_data->key)) { (*value) = NULL; *value = _account_get_text(custom_data->value); + if (custom_data->value != NULL && *value == NULL) { + ACCOUNT_FATAL("OUT OF MEMORY\n"); + return ACCOUNT_ERROR_OUT_OF_MEMORY; + } + return ACCOUNT_ERROR_NONE; } } @@ -1859,10 +1978,8 @@ ACCOUNT_API int account_type_create(account_type_h *account_type) } account_type_s *data = (account_type_s*)malloc(sizeof(account_type_s)); - - if (data == NULL) - { - ACCOUNT_ERROR("Memory Allocation Failed"); + if (data == NULL) { + ACCOUNT_FATAL("Memory Allocation Failed"); return ACCOUNT_ERROR_OUT_OF_MEMORY; } @@ -1916,6 +2033,10 @@ ACCOUNT_INTERNAL_API int account_type_set_app_id(account_type_h account_type, co _ACCOUNT_FREE(data->app_id); data->app_id = _account_get_text(app_id); + if (data->app_id == NULL) { + ACCOUNT_FATAL("OUT OF MEMORY\n"); + return ACCOUNT_ERROR_OUT_OF_MEMORY; + } return ACCOUNT_ERROR_NONE; } @@ -1934,6 +2055,10 @@ ACCOUNT_INTERNAL_API int account_type_set_service_provider_id(account_type_h acc _ACCOUNT_FREE(data->service_provider_id); data->service_provider_id = _account_get_text(service_provider_id); + if (data->service_provider_id == NULL) { + ACCOUNT_FATAL("OUT OF MEMORY\n"); + return ACCOUNT_ERROR_OUT_OF_MEMORY; + } return ACCOUNT_ERROR_NONE; } @@ -1952,6 +2077,10 @@ ACCOUNT_INTERNAL_API int account_type_set_icon_path(account_type_h account_type, _ACCOUNT_FREE(data->icon_path); data->icon_path = _account_get_text(icon_path); + if (data->icon_path == NULL) { + ACCOUNT_FATAL("OUT OF MEMORY\n"); + return ACCOUNT_ERROR_OUT_OF_MEMORY; + } return ACCOUNT_ERROR_NONE; } @@ -1970,6 +2099,10 @@ ACCOUNT_INTERNAL_API int account_type_set_small_icon_path(account_type_h account _ACCOUNT_FREE(data->small_icon_path); data->small_icon_path = _account_get_text(small_icon_path); + if (data->small_icon_path == NULL) { + ACCOUNT_FATAL("OUT OF MEMORY\n"); + return ACCOUNT_ERROR_OUT_OF_MEMORY; + } return ACCOUNT_ERROR_NONE; } @@ -1998,14 +2131,25 @@ ACCOUNT_INTERNAL_API int account_type_set_label(account_type_h account_type, con 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; } + ACCOUNT_MEMSET(label_data, 0, sizeof(label_s)); label_data->label = _account_get_text(label); + if (label_data->label == NULL) { + ACCOUNT_FATAL("OUT OF MEMORY\n"); + return ACCOUNT_ERROR_OUT_OF_MEMORY; + } + label_data->locale = _account_get_text(locale); + if (label_data->locale == NULL) { + ACCOUNT_FATAL("OUT OF MEMORY\n"); + _ACCOUNT_FREE(label_data->label); + return ACCOUNT_ERROR_OUT_OF_MEMORY; + } data->label_list = g_slist_append(data->label_list, (gpointer)label_data); @@ -2034,12 +2178,20 @@ ACCOUNT_INTERNAL_API int account_type_set_provider_feature(account_type_h accoun if(b_is_new) { provider_feature_s* feature_data = (provider_feature_s*)malloc(sizeof(provider_feature_s)); - - if (feature_data == NULL) + if (feature_data == NULL) { + ACCOUNT_FATAL("Memory Allocation Failed"); return ACCOUNT_ERROR_OUT_OF_MEMORY; + } + ACCOUNT_MEMSET(feature_data, 0, sizeof(provider_feature_s)); feature_data->key = _account_get_text(provider_feature); + if (feature_data->key == NULL) { + ACCOUNT_FATAL("OUT OF MEMORY\n"); + _ACCOUNT_FREE(feature_data); + return ACCOUNT_ERROR_OUT_OF_MEMORY; + } + data->provider_feature_list = g_slist_append(data->provider_feature_list, (gpointer)feature_data); } @@ -2157,6 +2309,10 @@ ACCOUNT_API int account_type_get_app_id(account_type_h account_type, char **app_ (*app_id) = NULL; *app_id = _account_get_text(data->app_id); + if (*app_id == NULL) { + ACCOUNT_FATAL("OUT OF MEMORY\n"); + return ACCOUNT_ERROR_OUT_OF_MEMORY; + } return ACCOUNT_ERROR_NONE; } @@ -2175,6 +2331,10 @@ ACCOUNT_API int account_type_get_service_provider_id(account_type_h account_type (*service_provider_id) = NULL; *service_provider_id = _account_get_text(data->service_provider_id); + if (*service_provider_id == NULL) { + ACCOUNT_FATAL("OUT OF MEMORY\n"); + return ACCOUNT_ERROR_OUT_OF_MEMORY; + } return ACCOUNT_ERROR_NONE; } @@ -2193,6 +2353,10 @@ ACCOUNT_API int account_type_get_icon_path(account_type_h account_type, char **i (*icon_path) = NULL; *icon_path = _account_get_text(data->icon_path); + if (*icon_path == NULL) { + ACCOUNT_FATAL("OUT OF MEMORY\n"); + return ACCOUNT_ERROR_OUT_OF_MEMORY; + } return ACCOUNT_ERROR_NONE; } @@ -2211,6 +2375,11 @@ ACCOUNT_API int account_type_get_small_icon_path(account_type_h account_type, ch (*small_icon_path) = NULL; *small_icon_path = _account_get_text(data->small_icon_path); + if (*small_icon_path == NULL) { + ACCOUNT_FATAL("OUT OF MEMORY\n"); + return ACCOUNT_ERROR_OUT_OF_MEMORY; + } + return ACCOUNT_ERROR_NONE; } @@ -2270,19 +2439,43 @@ ACCOUNT_API int account_type_get_label_by_locale(account_type_h account_type, co 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_OUT_OF_MEMORY; + } + return ACCOUNT_ERROR_NONE; } 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 (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 (converted_locale == NULL) { + ACCOUNT_FATAL("Memory Allocation Failed"); + _ACCOUNT_FREE(upper_token); + g_strfreev(tokens); + return ACCOUNT_ERROR_OUT_OF_MEMORY; + } + if(!strcmp(converted_locale, label_data->locale)) { _ACCOUNT_FREE(converted_locale); _ACCOUNT_FREE(upper_token); g_strfreev(tokens); *label = _account_get_text(label_data->label); + if (*label == NULL) { + ACCOUNT_FATAL("OUT OF MEMORY\n"); + return ACCOUNT_ERROR_OUT_OF_MEMORY; + } + return ACCOUNT_ERROR_NONE; } _ACCOUNT_FREE(converted_locale); @@ -2606,7 +2799,13 @@ ACCOUNT_API int account_type_query_label_by_locale(const char* app_id, const cha return ACCOUNT_ERROR_NO_DATA; } + *label = NULL; *label = _account_get_text(label_temp); + if (*label == NULL) { + ACCOUNT_FATAL("OUT OF MEMORY\n"); + return ACCOUNT_ERROR_OUT_OF_MEMORY; + } + _INFO("account_type_query_label_by_locale end"); return ACCOUNT_ERROR_NONE; @@ -2727,7 +2926,12 @@ static void _account_subscribe_vconf_callback(keynode_t *key, void *user_data) ACCOUNT_ERROR("vconf key is NULL.\n"); return; } + msg = strdup(vconf_key); + if (msg == NULL) { + ACCOUNT_FATAL("Memory Allocation Failed"); + return; + } char* event_type = NULL; char* id = NULL; @@ -2744,10 +2948,9 @@ static void _account_subscribe_vconf_callback(keynode_t *key, void *user_data) if(tmp->account_subscription_callback) tmp->account_subscription_callback(event_msg, account_id, tmp->user_data); - } - - _ACCOUNT_FREE(msg); + _ACCOUNT_FREE(msg); + } } ACCOUNT_API int account_subscribe_create(account_subscribe_h* account_subscribe) @@ -2758,7 +2961,6 @@ ACCOUNT_API int account_subscribe_create(account_subscribe_h* account_subscribe) } 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; @@ -2844,6 +3046,10 @@ static void _account_subscribe_vconf_callback_ex(keynode_t *key, void *user_data return; } msg = strdup(vconf_key); + if (msg == NULL) { + ACCOUNT_FATAL("Memory Allocation Failed"); + return; + } char* event_type = NULL; char* id = NULL;