#ifdef __FEATURE_KEEP_CONNECTION__
/* emcore_reset_streams(); */
- emcore_remove_connection_info(account_id);
+ if (emcore_remove_connection_info(account_id) != EMAIL_ERROR_NONE)
+ EM_DEBUG_EXCEPTION("emcore_remove_connection_info failed \n");
#endif
if ((err = emcore_delete_all_mails_of_acount(multi_user_name, account_id)) != EMAIL_ERROR_NONE) {
}
emcore_display_unread_in_badge(multi_user_name);
- emcore_delete_notification_by_account(multi_user_name, account_id, true, true, true);
+ if (emcore_delete_notification_by_account(multi_user_name, account_id, true, true, true) != EMAIL_ERROR_NONE)
+ EM_DEBUG_EXCEPTION("emcore_delete_notification_by_account failed \n");
ret = true;
-#include "email-core-mail.h"\r
-#include "email-internal-types.h"\r
-#include "email-types.h"\r
-#include "email-debug-log.h"\r
-#include "email-core-dpm.h"\r
-\r
-static int g_dpm_policy_status = 0;\r
-\r
-\r
-#include <dpm/restriction.h>\r
-\r
-\r
-void on_restriction(const char* policy, const char* value, void* user_data)\r
-{\r
- int is_allowed = strcmp(value, "allowed") == 0 ? 1 : 0;\r
- /* true = 1;\r
- false = 0; */\r
-\r
- EM_DEBUG_LOG("dpm_cb_status : %d", is_allowed);\r
- g_dpm_policy_status = is_allowed;\r
-}\r
-\r
-static int callback_id;\r
-static device_policy_manager_h dpm;\r
-\r
-void emcore_dpm_instance_create()\r
-{\r
-\r
-\r
- #ifdef TIZEN_FEATURE_EMAIL_DPM\r
-\r
- EM_DEBUG_LOG("dpm_instance_create");\r
- dpm = dpm_manager_create();\r
- int allowed;\r
- void *user_data = NULL;\r
- int ret = dpm_restriction_get_popimap_email_state(dpm, &allowed);\r
- if (ret != DPM_ERROR_NONE) {\r
- EM_DEBUG_LOG("dpm_error : %d", ret);\r
- //TODO add error routin\r
- }\r
-\r
- EM_DEBUG_LOG("dpm_policy : %d", allowed);\r
- if (allowed == false) {\r
-\r
- /* OPERATION IS RESTRICTED */\r
- g_dpm_policy_status = false;\r
-\r
- } else if (allowed == true) {\r
-\r
- /* OPERATION IS ALLOWED */\r
- g_dpm_policy_status = true;\r
-\r
- } else {\r
- EM_DEBUG_LOG("dpm wrong status : %d", allowed);\r
-\r
- //TODO add error routin\r
- }\r
-\r
- // Callback will be called when policy is changed\r
- dpm_add_policy_changed_cb(dpm , "popimap_email", on_restriction, user_data, &callback_id);\r
-\r
- #else\r
-\r
- EM_DEBUG_LOG("dpm_off");\r
-\r
- #endif /* TIZEN_FEATURE_EMAIL_DPM */\r
-\r
-}\r
-int emcore_get_dpm_status()\r
-{\r
-\r
- EM_DEBUG_LOG("get_dpm_status()");\r
- #ifdef TIZEN_FEATURE_EMAIL_DPM\r
- return g_dpm_policy_status;\r
- #else\r
- return true;\r
- #endif /* TIZEN_FEATURE_EMAIL_DPM */\r
-\r
-}\r
-\r
-void dpm_interface_destroy()\r
-{\r
- dpm_remove_policy_changed_cb(dpm, callback_id);\r
- dpm_manager_destroy(dpm);\r
-}\r
-\r
+#include "email-core-mail.h"
+#include "email-internal-types.h"
+#include "email-types.h"
+#include "email-debug-log.h"
+#include "email-core-dpm.h"
+
+static int g_dpm_policy_status = 0;
+
+
+#include <dpm/restriction.h>
+
+
+void on_restriction(const char* policy, const char* value, void* user_data)
+{
+ int is_allowed = strcmp(value, "allowed") == 0 ? 1 : 0;
+ /* true = 1;
+ false = 0; */
+
+ EM_DEBUG_LOG("dpm_cb_status : %d", is_allowed);
+ g_dpm_policy_status = is_allowed;
+}
+
+static int callback_id;
+static device_policy_manager_h dpm;
+
+void emcore_dpm_instance_create()
+{
+
+
+ #ifdef TIZEN_FEATURE_EMAIL_DPM
+
+ EM_DEBUG_LOG("dpm_instance_create");
+ dpm = dpm_manager_create();
+ int allowed;
+ void *user_data = NULL;
+ int ret = dpm_restriction_get_popimap_email_state(dpm, &allowed);
+ if (ret != DPM_ERROR_NONE) {
+ EM_DEBUG_LOG("dpm_error : %d", ret);
+ //TODO add error routin
+ }
+
+ EM_DEBUG_LOG("dpm_policy : %d", allowed);
+ if (allowed == false) {
+
+ /* OPERATION IS RESTRICTED */
+ g_dpm_policy_status = false;
+
+ } else if (allowed == true) {
+
+ /* OPERATION IS ALLOWED */
+ g_dpm_policy_status = true;
+
+ } else {
+ EM_DEBUG_LOG("dpm wrong status : %d", allowed);
+
+ //TODO add error routin
+ }
+
+ // Callback will be called when policy is changed
+ if (dpm_add_policy_changed_cb(dpm , "popimap_email", on_restriction, user_data, &callback_id) != 0)
+ EM_DEBUG_LOG("dpm_add_policy_changed_cb failed /n");
+
+ #else
+
+ EM_DEBUG_LOG("dpm_off");
+
+ #endif /* TIZEN_FEATURE_EMAIL_DPM */
+
+}
+int emcore_get_dpm_status()
+{
+
+ EM_DEBUG_LOG("get_dpm_status()");
+ #ifdef TIZEN_FEATURE_EMAIL_DPM
+ return g_dpm_policy_status;
+ #else
+ return true;
+ #endif /* TIZEN_FEATURE_EMAIL_DPM */
+
+}
+
+void dpm_interface_destroy()
+{
+ dpm_remove_policy_changed_cb(dpm, callback_id);
+ dpm_manager_destroy(dpm);
+}
+
if (disposition_header) g_object_unref(disposition_header);
}
- if (buf) g_remove(buf);
+ if (buf) {
+ if (g_remove(buf) != 0)
+ EM_DEBUG_LOG_DEV("Fail to Remove buffer \n");
+ }
EM_SAFE_FREE(buf);
} else if ((tag_position = g_strrstr(response, tag))) /* end of response */ {
if (!strncmp(tag_position + EM_SAFE_STRLEN(tag) + 1, "OK", 2)) {
if (!auto_download) {
if (ret == TRUE)
- emcore_notify_network_event(NOTI_DOWNLOAD_ATTACH_FINISH, mail_id, NULL, nth, 0);
+ if (emcore_notify_network_event(NOTI_DOWNLOAD_ATTACH_FINISH, mail_id, NULL, nth, 0) != 1)
+ EM_DEBUG_LOG(">>>>>>emcore_notify_network_event failed \n ");
else {
if (err != EMAIL_ERROR_CANCELLED)
- emcore_notify_network_event(NOTI_DOWNLOAD_ATTACH_FAIL, mail_id, NULL, nth, err);
+ if (emcore_notify_network_event(NOTI_DOWNLOAD_ATTACH_FAIL, mail_id, NULL, nth, err) != 1)
+ EM_DEBUG_LOG(">>>>>>emcore_notify_network_event failed \n ");
}
}
if (!auto_download) {
if (ret == TRUE)
- emcore_notify_network_event(NOTI_DOWNLOAD_BODY_FINISH, mail_id, NULL, event_handle, 0);
+ if (emcore_notify_network_event(NOTI_DOWNLOAD_BODY_FINISH, mail_id, NULL, event_handle, 0) != 0)
+ EM_DEBUG_LOG(">>>>> emcore_notify_network_event failed \n ");
else
- emcore_notify_network_event(NOTI_DOWNLOAD_BODY_FAIL, mail_id, NULL, event_handle, err);
+ if (emcore_notify_network_event(NOTI_DOWNLOAD_BODY_FAIL, mail_id, NULL, event_handle, err) != 0)
+ EM_DEBUG_LOG(">>>>> emcore_notify_network_event failed \n ");
}
if (err_code != NULL)
EM_SAFE_FREE(body->sparep);
EM_SAFE_CLOSE(fd); /*prevent 34498*/
EM_SAFE_FREE(p);
- if (tmp_file_path)
- g_remove(tmp_file_path);
+ if (tmp_file_path) {
+ if (g_remove(tmp_file_path) != 0)
+ EM_DEBUG_EXCEPTION(" Fail to remove tmp_file_path \n");
+ }
EM_SAFE_FREE(tmp_file_path);
if (fp_html)
fclose(fp_html);
if (!file_exist)
*data = EM_SAFE_STRDUP(fname);
} else if (fname != NULL) {
- remove(fname);
+ if (remove(fname) != 0)
+ EM_DEBUG_EXCEPTION("Fail to remove fname \n");
}
EM_SAFE_FREE(fname);
_delete_temp_file(buf);
EM_SAFE_FREE(prefix_path);
} else {
- mkdir(DATA_PATH, DIRECTORY_PERMISSION);
- mkdir(EMAIL_PATH, DIRECTORY_PERMISSION);
- mkdir(MAIL_HOME, DIRECTORY_PERMISSION);
- mkdir(MAIL_TEMP, DIRECTORY_PERMISSION);
+ if (mkdir(DATA_PATH, DIRECTORY_PERMISSION) != 0)
+ EM_DEBUG_EXCEPTION("Fail to create the directory \n");
+ if (mkdir(EMAIL_PATH, DIRECTORY_PERMISSION) != 0)
+ EM_DEBUG_EXCEPTION("Fail to create the directory \n");
+ if (mkdir(MAIL_HOME, DIRECTORY_PERMISSION) != 0)
+ EM_DEBUG_EXCEPTION("Fail to create the directory \n");
+ if (mkdir(MAIL_TEMP, DIRECTORY_PERMISSION) != 0)
+ EM_DEBUG_EXCEPTION("Fail to create the directory \n");
_delete_temp_file(MAIL_TEMP);
}
email_uid = UID_DEFAULT;
- chmod(EMAIL_SERVICE_DB_FILE_PATH, 0660);
- chmod(EMAIL_SERVICE_DB_JOURNAL_FILE_PATH, 0660);
- chmod(EMAIL_SQL_PATH, 0660);
+ if (chmod(EMAIL_SERVICE_DB_FILE_PATH, 0660) != 0)
+ EM_DEBUG_EXCEPTION("Fail to change the permission \n");
+ if (chmod(EMAIL_SERVICE_DB_JOURNAL_FILE_PATH, 0660) != 0)
+ EM_DEBUG_EXCEPTION("Fail to change the permission \n");
+ if (chmod(EMAIL_SQL_PATH, 0660) != 0)
+ EM_DEBUG_EXCEPTION("Fail to change the permission \n");
ret = chown(EMAIL_SERVICE_DB_FILE_PATH, email_uid, email_gid);
if (0 != ret)
goto FINISH_OFF;
}
- mkdir(MAIL_HOME, DIRECTORY_PERMISSION);
- mkdir(MAIL_TEMP, DIRECTORY_PERMISSION);
- chmod(MAIL_TEMP, 0777);
+ if (mkdir(MAIL_HOME, DIRECTORY_PERMISSION) != 0)
+ EM_DEBUG_EXCEPTION("Fail to create the directory \n");
+ if (mkdir(MAIL_TEMP, DIRECTORY_PERMISSION) != 0)
+ EM_DEBUG_EXCEPTION("Fail to create the directory \n");
+ if (chmod(MAIL_TEMP, 0777) != 0)
+ EM_DEBUG_EXCEPTION("Fail to change the permission \n");
/* first clear index. */
while (indexes->object_name) {
}
if (account_id == EML_FOLDER)
- chmod(buf, 0777);
+ if (chmod(buf, 0777) != 0)
+ EM_DEBUG_EXCEPTION("Fail to change the permission \n");
}
}
{
EM_DEBUG_FUNC_BEGIN();
- mkdir(DATA_PATH, DIRECTORY_PERMISSION);
- mkdir(EMAIL_PATH, DIRECTORY_PERMISSION);
- mkdir(MAIL_HOME, DIRECTORY_PERMISSION);
- mkdir(MAIL_TEMP, DIRECTORY_PERMISSION);
- chmod(MAIL_TEMP, 0777);
+ if (mkdir(DATA_PATH, DIRECTORY_PERMISSION) != 0)
+ EM_DEBUG_EXCEPTION("Fail to create the directory \n");
+ if (mkdir(EMAIL_PATH, DIRECTORY_PERMISSION) != 0)
+ EM_DEBUG_EXCEPTION("Fail to create the directory \n");
+ if (mkdir(MAIL_HOME, DIRECTORY_PERMISSION) != 0)
+ EM_DEBUG_EXCEPTION("Fail to create the directory \n");
+ if (mkdir(MAIL_TEMP, DIRECTORY_PERMISSION) != 0)
+ EM_DEBUG_EXCEPTION("Fail to create the directory \n");
+ if (chmod(MAIL_TEMP, 0777) != 0)
+ EM_DEBUG_EXCEPTION("Fail to change the permission \n");
EM_DEBUG_FUNC_END();
}
if (mail)
emstorage_free_mail(&mail, 1, NULL);
- emcore_notify_network_event(NOTI_DOWNLOAD_BODY_FAIL, mail_id, NULL, handle_to_be_published, err);
-
+ if (emcore_notify_network_event(NOTI_DOWNLOAD_BODY_FAIL, mail_id, NULL, handle_to_be_published, err) != 0)
+ EM_DEBUG_EXCEPTION(">>>>> emcore_notify_network_event failed \n ");
goto FINISH_OFF;
}
/* So in event update again the DB field */
if (err != EMAIL_ERROR_NONE) {
/* If the emcore_sync_flags_field_with_server is failed, rollback the db */
- emcore_set_flags_field(multi_user_name, account_id, mail_ids, num, field_type, value ? 0 : 1, NULL);
+ if (emcore_set_flags_field(multi_user_name, account_id, mail_ids, num, field_type, value ? 0 : 1, NULL) != 0)
+ EM_DEBUG_EXCEPTION("emcore_set_flags_field failed \n");
}
if (error)
*error = err;
if (0 >= scanf("%d", &mailbox_id))
testapp_print("Invalid input. ");
- email_get_mailbox_by_mailbox_id(mailbox_id, &mailbox_data);
+ if (email_get_mailbox_by_mailbox_id(mailbox_id, &mailbox_data) != EMAIL_ERROR_NONE)
+ testapp_print("email_get_mailbox_by_mailbox_id failed ");
test_mail_data = malloc(sizeof(email_mail_data_t));
memset(test_mail_data, 0x00, sizeof(email_mail_data_t));
if (0 >= scanf("%d", &mail_id))
testapp_print("Invalid input. ");
- email_get_mail_data(mail_id, &test_mail_data);
+ if (email_get_mail_data(mail_id, &test_mail_data) != EMAIL_ERROR_NONE)
+ testapp_print("email_get_mail_data Failed \n ");
if (!test_mail_data) {
testapp_print("email_get_mail_data() failed\n");
testapp_add_mail_for_sending(&added_mail_id);
if (added_mail_id) {
- email_get_mail_data(added_mail_id, &result_mail_data);
+ if (email_get_mail_data(added_mail_id, &result_mail_data) != EMAIL_ERROR_NONE)
+ testapp_print("email_get_mail_data Failed \n ");
testapp_print("Calling email_send_mail...\n");