summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYoungjae Shin <yj99.shin@samsung.com>2018-05-15 10:04:31 +0900
committerYoungjae Shin <yj99.shin@samsung.com>2018-05-15 10:04:31 +0900
commit04b258e30be9e320e21bef0cd5da57a44aeddc3f (patch)
tree45000e5483e0ff03da26f5d1e0f7c7252df01390
parent039afe763955de6937af437f1fec8621dc806ddd (diff)
downloademail-service-04b258e30be9e320e21bef0cd5da57a44aeddc3f.tar.gz
email-service-04b258e30be9e320e21bef0cd5da57a44aeddc3f.tar.bz2
email-service-04b258e30be9e320e21bef0cd5da57a44aeddc3f.zip
increase code quality(static analysis, coding rule)submit/tizen/20180515.023815accepted/tizen/unified/20180515.063831
Change-Id: I4c3d668b328f2093873d067a88c3750f6414c99c
-rwxr-xr-xemail-core/email-core-utils.c1036
-rw-r--r--test/testapp-mail.c70
2 files changed, 538 insertions, 568 deletions
diff --git a/email-core/email-core-utils.c b/email-core/email-core-utils.c
index 133842f..ac20679 100755
--- a/email-core/email-core-utils.c
+++ b/email-core/email-core-utils.c
@@ -1,23 +1,23 @@
/*
-* email-service
-*
-* Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
-*
-* Contact: Kyuho Jo <kyuho.jo@samsung.com>, Sunghyun Kwon <sh0701.kwon@samsung.com>
-*
-* 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.
-*
-*/
+ * email-service
+ *
+ * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Kyuho Jo <kyuho.jo@samsung.com>, Sunghyun Kwon <sh0701.kwon@samsung.com>
+ *
+ * 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.
+ *
+ */
/******************************************************************************
@@ -106,7 +106,7 @@
#define EMAIL_NOTI_ICON_PATH tzplatform_mkpath(TZ_SYS_RO_APP, "org.tizen.quickpanel/shared/res/noti_icons/E-mail/noti_email.png")
#define EMAIL_NOTI_INDICATOR_ICON_PATH tzplatform_mkpath(TZ_SYS_RO_APP, "org.tizen.indicator/res/icons/Event/B03_Event_email.png")
#define EMAIL_NOTI_MAX_MAIL_ID 100
-//#define TEST TZ_SYS_RO_APPS
+//#define TEST TZ_SYS_RO_APPS
typedef struct _em_transaction_info_type_t {
int mail_id;
@@ -153,23 +153,23 @@ INTERNAL_FUNC char *emcore_convert_mutf7_to_utf8(char *mailbox_name)
for (; *cursor; ++cursor)
switch (*cursor) {
- case '+':
- if (!is_base64) *cursor = '&';
- break;
+ case '+':
+ if (!is_base64) *cursor = '&';
+ break;
- case '&':
- *cursor = '+';
- is_base64 = 1;
- break;
+ case '&':
+ *cursor = '+';
+ is_base64 = 1;
+ break;
- case '-':
- is_base64 = 0;
- break;
+ case '-':
+ is_base64 = 0;
+ break;
- case ',':
- if (is_base64)
- *cursor = '/';
- break;
+ case ',':
+ if (is_base64)
+ *cursor = '/';
+ break;
}
cd = g_mime_iconv_open("UTF-8", "UTF-7");
@@ -183,11 +183,11 @@ INTERNAL_FUNC char *emcore_convert_mutf7_to_utf8(char *mailbox_name)
cursor = result_mailbox_name;
for (; *cursor; ++cursor) {
switch (*cursor) {
- case '&':
+ case '&':
*cursor = '+';
break;
- case '+':
+ case '+':
*cursor = '&';
break;
}
@@ -246,21 +246,21 @@ int emcore_get_long_encoded_path_with_account_info(char *multi_user_name, email_
/* ex:"{mai.test.com:143/imap} or {mai.test.com:143/imap/tls}my-mailbox" */
- if (multi_user_name) {
- SNPRINTF(p, long_enc_path_len, "{%s:%d/%s/user=%d%s%s",
- account->incoming_server_address,
- account->incoming_server_port_number,
- account->incoming_server_type == EMAIL_SERVER_TYPE_POP3 ? "pop3" : "imap",
- account->account_id,
- TOKEN_FOR_MULTI_USER,
- multi_user_name);
- } else {
- SNPRINTF(p, long_enc_path_len, "{%s:%d/%s/user=%d",
- account->incoming_server_address,
- account->incoming_server_port_number,
- account->incoming_server_type == EMAIL_SERVER_TYPE_POP3 ? "pop3" : "imap",
- account->account_id);
- }
+ if (multi_user_name) {
+ SNPRINTF(p, long_enc_path_len, "{%s:%d/%s/user=%d%s%s",
+ account->incoming_server_address,
+ account->incoming_server_port_number,
+ account->incoming_server_type == EMAIL_SERVER_TYPE_POP3 ? "pop3" : "imap",
+ account->account_id,
+ TOKEN_FOR_MULTI_USER,
+ multi_user_name);
+ } else {
+ SNPRINTF(p, long_enc_path_len, "{%s:%d/%s/user=%d",
+ account->incoming_server_address,
+ account->incoming_server_port_number,
+ account->incoming_server_type == EMAIL_SERVER_TYPE_POP3 ? "pop3" : "imap",
+ account->account_id);
+ }
if (account->incoming_server_secure_connection & 0x01) {
strncat(p, "/ssl", long_enc_path_len-(EM_SAFE_STRLEN(p)+1));
@@ -271,9 +271,8 @@ int emcore_get_long_encoded_path_with_account_info(char *multi_user_name, email_
authentication_method = account->incoming_server_authentication_method;
- if (account->incoming_server_requires_apop) {
+ if (account->incoming_server_requires_apop)
strncat(p, "/apop", long_enc_path_len-(EM_SAFE_STRLEN(p)+1));
- }
} else { /* smtp */
long_enc_path_len = EM_SAFE_STRLEN(account->outgoing_server_address) + 64;
@@ -289,24 +288,23 @@ int emcore_get_long_encoded_path_with_account_info(char *multi_user_name, email_
/* ex:"mail.test.com:25/smtp" */
SNPRINTF(p, long_enc_path_len, "%s:%d/%s",
- account->outgoing_server_address,
- account->outgoing_server_port_number,
- "smtp");
+ account->outgoing_server_address,
+ account->outgoing_server_port_number,
+ "smtp");
if (account->outgoing_server_need_authentication > 0) {
- if (multi_user_name) {
- SNPRINTF(p + EM_SAFE_STRLEN(p), long_enc_path_len-(EM_SAFE_STRLEN(p)), "/user=%d%s%s",
- account->account_id,
- TOKEN_FOR_MULTI_USER,
- multi_user_name);
- } else {
- SNPRINTF(p + EM_SAFE_STRLEN(p), long_enc_path_len-(EM_SAFE_STRLEN(p)), "/user=%d",
- account->account_id);
- }
-
- if (account->outgoing_server_need_authentication == EMAIL_AUTHENTICATION_METHOD_XOAUTH2) {
- strncat(p, "/xoauth2", long_enc_path_len-(EM_SAFE_STRLEN(p)+1));
+ if (multi_user_name) {
+ SNPRINTF(p + EM_SAFE_STRLEN(p), long_enc_path_len-(EM_SAFE_STRLEN(p)), "/user=%d%s%s",
+ account->account_id,
+ TOKEN_FOR_MULTI_USER,
+ multi_user_name);
+ } else {
+ SNPRINTF(p + EM_SAFE_STRLEN(p), long_enc_path_len-(EM_SAFE_STRLEN(p)), "/user=%d",
+ account->account_id);
}
+
+ if (account->outgoing_server_need_authentication == EMAIL_AUTHENTICATION_METHOD_XOAUTH2)
+ strncat(p, "/xoauth2", long_enc_path_len-(EM_SAFE_STRLEN(p)+1));
}
if (account->outgoing_server_secure_connection & 0x01) {
@@ -340,13 +338,12 @@ int emcore_get_long_encoded_path_with_account_info(char *multi_user_name, email_
if (path == NULL || (path && strncmp(path, ENCODED_PATH_SMTP, EM_SAFE_STRLEN(ENCODED_PATH_SMTP)) != 0)) {
strncat(p, "}", long_enc_path_len-(EM_SAFE_STRLEN(p)+1));
- if (path != NULL) {
+ if (path != NULL)
strncat(p, path, long_enc_path_len-(EM_SAFE_STRLEN(p)+1));
- }
}
if (*long_enc_path)
- EM_DEBUG_LOG_SEC("long_enc_path [%s]", *long_enc_path);
+ EM_DEBUG_LOG_SEC("long_enc_path [%s]", *long_enc_path);
ret = true;
@@ -585,7 +582,7 @@ int emcore_get_file_name(char *path, char **filename, int *err_code)
ret = true;
FINISH_OFF:
- if (err_code != NULL)
+ if (err_code != NULL)
*err_code = error;
EM_DEBUG_FUNC_END();
return ret;
@@ -744,8 +741,8 @@ int emcore_get_address_count(char *addr_str, int *count, int *err_code)
for (p_addr = addr, i = 0; p_addr; p_addr = p_addr->next, i++) {
if (p_addr->mailbox && p_addr->host) {
if (!strncmp(p_addr->mailbox, "UNEXPECTED_DATA_AFTER_ADDRESS", strlen("UNEXPECTED_DATA_AFTER_ADDRESS"))
- || !strncmp(p_addr->mailbox, "INVALID_ADDRESS", strlen("INVALID_ADDRESS"))
- || !strncmp(p_addr->host, ".SYNTAX-ERROR.", strlen(".SYNTAX-ERROR."))) { /*prevent 34356*/
+ || !strncmp(p_addr->mailbox, "INVALID_ADDRESS", strlen("INVALID_ADDRESS"))
+ || !strncmp(p_addr->host, ".SYNTAX-ERROR.", strlen(".SYNTAX-ERROR."))) { /*prevent 34356*/
EM_DEBUG_LOG("Invalid address ");
continue;
}
@@ -761,7 +758,7 @@ int emcore_get_address_count(char *addr_str, int *count, int *err_code)
*count = i;
if (error != EMAIL_ERROR_INVALID_ADDRESS)
- ret = true;
+ ret = true;
FINISH_OFF:
if (addr)
@@ -856,15 +853,13 @@ INTERNAL_FUNC int emcore_get_mail_count_by_query(char *multi_user_name, int acco
/* Make query for searching unread mail */
filter_count = 3; /* unseen field requires one filter, "flags_seen_field = 0"
- and "deleted_flag = 0" */
+ and "deleted_flag = 0" */
if (rule_count > 0)
filter_count += (rule_count * 2) + 2; /* one rule requires two filters,"A" "OR", plus two more operator "(" and ")" */
-
- if (account_id != ALL_ACCOUNT) {
+ if (account_id != ALL_ACCOUNT)
filter_count += 2; /* two filters, "AND" "account_id = x" */
- }
if (mailbox_type)
filter_count += 2; /* two filters, "AND" "mailbox_type = x" */
@@ -1050,9 +1045,9 @@ void emcore_display_unread_in_badge(void *data)
int unseen = 0;
if (!emcore_get_mail_count_by_query((char *)data, ALL_ACCOUNT,
- EMAIL_MAILBOX_TYPE_INBOX, 0,
- &total_mail_count, &total_unread_count,
- &err)) {
+ EMAIL_MAILBOX_TYPE_INBOX, 0,
+ &total_mail_count, &total_unread_count,
+ &err)) {
EM_DEBUG_EXCEPTION("emcore_get_mail_count_by_query failed");
goto FINISH_OFF;
}
@@ -1062,13 +1057,11 @@ void emcore_display_unread_in_badge(void *data)
FINISH_OFF:
if (unseen <= 0) {
- if ((err = emcore_display_badge_count((char *)data, 0)) != EMAIL_ERROR_NONE) {
+ if ((err = emcore_display_badge_count((char *)data, 0)) != EMAIL_ERROR_NONE)
EM_DEBUG_EXCEPTION("emcore_display_badge_count failed : [%d]", err);
- }
} else {
- if ((err = emcore_display_badge_count((char *)data, unseen)) != EMAIL_ERROR_NONE) {
+ if ((err = emcore_display_badge_count((char *)data, unseen)) != EMAIL_ERROR_NONE)
EM_DEBUG_EXCEPTION("emcore_display_badge_count failed : [%d]", err);
- }
}
EM_DEBUG_FUNC_END();
@@ -1086,9 +1079,10 @@ static int emcore_layout_multi_noti(notification_h noti, int unread_mail, char *
goto FINISH_OFF;
}
- if ((noti_err = notification_set_text_domain(noti, NATIVE_EMAIL_DOMAIN, tzplatform_mkpath(TZ_SYS_RO_APP,"org.tizen.email/res/locale"))) != NOTIFICATION_ERROR_NONE) {
- EM_DEBUG_EXCEPTION("notification_set_text_domain failed [%d]", noti_err);
- goto FINISH_OFF;
+ noti_err = notification_set_text_domain(noti, NATIVE_EMAIL_DOMAIN, tzplatform_mkpath(TZ_SYS_RO_APP, "org.tizen.email/res/locale"));
+ if (noti_err != NOTIFICATION_ERROR_NONE) {
+ EM_DEBUG_EXCEPTION("notification_set_text_domain failed [%d]", noti_err);
+ goto FINISH_OFF;
}
noti_err = notification_set_text(noti, NOTIFICATION_TEXT_TYPE_TITLE, "New emails", "IDS_EMAIL_MBODY_NEW_EMAILS_ABB", NOTIFICATION_VARIABLE_TYPE_NONE);
@@ -1155,12 +1149,12 @@ static int emcore_layout_single_noti(notification_h noti, char *account_name, in
goto FINISH_OFF;
}
- if ((noti_err = notification_set_text_domain(noti, NATIVE_EMAIL_DOMAIN, tzplatform_mkpath(TZ_SYS_RO_APP,"org.tizen.email/res/locale"))) != NOTIFICATION_ERROR_NONE) {
- EM_DEBUG_EXCEPTION("notification_set_text_domain failed [%d]", noti_err);
- goto FINISH_OFF;
+ noti_err = notification_set_text_domain(noti, NATIVE_EMAIL_DOMAIN, tzplatform_mkpath(TZ_SYS_RO_APP, "org.tizen.email/res/locale"));
+ if (noti_err != NOTIFICATION_ERROR_NONE) {
+ EM_DEBUG_EXCEPTION("notification_set_text_domain failed [%d]", noti_err);
+ goto FINISH_OFF;
}
-
if (ids)
noti_err = notification_set_text(noti, NOTIFICATION_TEXT_TYPE_TITLE, "Email", "IDS_ST_HEADER_EMAIL", NOTIFICATION_VARIABLE_TYPE_NONE);
else
@@ -1170,23 +1164,23 @@ static int emcore_layout_single_noti(notification_h noti, char *account_name, in
EM_DEBUG_EXCEPTION("notification_set_text TEXT_TYPE_TITLE failed");
goto FINISH_OFF;
}
-/*
- noti_err = notification_set_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT, account_name, NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
- if (noti_err != NOTIFICATION_ERROR_NONE) {
- EM_DEBUG_EXCEPTION("notification_set_text TEXT_TYPE_CONTENT failed");
- goto FINISH_OFF;
- }
+ /*
+ noti_err = notification_set_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT, account_name, NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
+ if (noti_err != NOTIFICATION_ERROR_NONE) {
+ EM_DEBUG_EXCEPTION("notification_set_text TEXT_TYPE_CONTENT failed");
+ goto FINISH_OFF;
+ }
- if (ids)
- noti_err = notification_set_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT, NULL, display_sender, NOTIFICATION_VARIABLE_TYPE_NONE);
- else
- noti_err = notification_set_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT, display_sender, NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
+ if (ids)
+ noti_err = notification_set_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT, NULL, display_sender, NOTIFICATION_VARIABLE_TYPE_NONE);
+ else
+ noti_err = notification_set_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT, display_sender, NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
- if (noti_err != NOTIFICATION_ERROR_NONE) {
- EM_DEBUG_EXCEPTION("notification_set_text TEXT_TYPE_CONTENT failed");
- goto FINISH_OFF;
- }
-*/
+ if (noti_err != NOTIFICATION_ERROR_NONE) {
+ EM_DEBUG_EXCEPTION("notification_set_text TEXT_TYPE_CONTENT failed");
+ goto FINISH_OFF;
+ }
+ */
if (display_status)
noti_err = notification_set_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT, subject, NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
else
@@ -1252,15 +1246,15 @@ static int emcore_get_alert_type(int vibrate_status)
if (global_sound_status || global_vibe_status) {
#ifdef __FEATURE_VOICERECORDER_STATUS_FOR_NOTI__
- if (vconf_get_int(VCONFKEY_VOICERECORDER_STATE, &voicerecoder_state) != 0) {
+ if (vconf_get_int(VCONFKEY_VOICERECORDER_STATE, &voicerecoder_state) != 0)
EM_DEBUG_LOG("vconf_get_int for VCONFKEY_VOICERECORDER_STATE failed");
- }
+
EM_DEBUG_LOG("voicerecoder_state [%d]", voicerecoder_state);
#endif /* __FEATURE_VOICERECORDER_STATUS_FOR_NOTI__ */
- if (vconf_get_int(VCONFKEY_CALL_STATE, &call_state) != 0) {
+ if (vconf_get_int(VCONFKEY_CALL_STATE, &call_state) != 0)
EM_DEBUG_LOG("vconf_get_int for VCONFKEY_CALL_STATE failed");
- }
+
EM_DEBUG_LOG("call_state [%d] ", call_state);
email_vibe_status = vibrate_status;
@@ -1271,7 +1265,7 @@ static int emcore_get_alert_type(int vibrate_status)
alert_type = EMAIL_ALERT_TYPE_VIB;
EM_DEBUG_LOG("voice recorder is on recording...");
}
-/* else if (call_state > VCONFKEY_CALL_OFF && call_state < VCONFKEY_CALL_STATE_MAX) { */
+ /*else if (call_state > VCONFKEY_CALL_OFF && call_state < VCONFKEY_CALL_STATE_MAX) */
#endif /* __FEATURE_VOICERECORDER_STATUS_FOR_NOTI__ */
if (call_state > VCONFKEY_CALL_OFF && call_state < VCONFKEY_CALL_STATE_MAX) {
@@ -1365,13 +1359,13 @@ INTERNAL_FUNC int emcore_show_toast_popup(char *input_popup_string)
FINISH_OFF:
- if (svc_handle) {
- ret = app_control_destroy(svc_handle);
- if (ret != APP_CONTROL_ERROR_NONE) {
- EM_DEBUG_LOG("app_control_destroy() failed! ret:[%d]", ret);
- err = EMAIL_ERROR_SYSTEM_FAILURE;
- }
- }
+ if (svc_handle) {
+ ret = app_control_destroy(svc_handle);
+ if (ret != APP_CONTROL_ERROR_NONE) {
+ EM_DEBUG_LOG("app_control_destroy() failed! ret:[%d]", ret);
+ err = EMAIL_ERROR_SYSTEM_FAILURE;
+ }
+ }
return err;
}
@@ -1397,7 +1391,8 @@ static int __emcore_show_new_mail_noti(void)
goto FINISH_OFF;
}
- if ((noti_err = notification_set_text_domain(noti, NATIVE_EMAIL_DOMAIN, tzplatform_mkpath(TZ_SYS_RO_APP,"org.tizen.email/res/locale"))) != NOTIFICATION_ERROR_NONE) {
+ noti_err = notification_set_text_domain(noti, NATIVE_EMAIL_DOMAIN, tzplatform_mkpath(TZ_SYS_RO_APP, "org.tizen.email/res/locale"));
+ if (noti_err != NOTIFICATION_ERROR_NONE) {
EM_DEBUG_EXCEPTION("notification_set_text_domain failed [%d]", noti_err);
err = EMAIL_ERROR_SYSTEM_FAILURE;
goto FINISH_OFF;
@@ -1496,12 +1491,11 @@ INTERNAL_FUNC int emcore_add_notification(char *multi_user_name, int account_id,
/* Load the previous noti */
SNPRINTF(vconf_private_id, sizeof(vconf_private_id), "%s/%d", VCONF_KEY_NOTI_PRIVATE_ID, account_id);
- if (vconf_get_int(vconf_private_id, &private_id) != 0) {
- EM_DEBUG_EXCEPTION("vconf_get_int failed");
- }
+ if (vconf_get_int(vconf_private_id, &private_id) != 0)
+ EM_DEBUG_EXCEPTION("vconf_get_int failed");
/* Turn display on to blink LED */
-// emdevice_change_display_state(DISPLAY_STATE_ON);
+ // emdevice_change_display_state(DISPLAY_STATE_ON);
if ((err = emcore_set_join_zone(multi_user_name, &join_zone)) != EMAIL_ERROR_NONE) {
EM_DEBUG_EXCEPTION("emcore_set_join_zone failed : [%d]", err);
@@ -1578,7 +1572,8 @@ INTERNAL_FUNC int emcore_add_notification(char *multi_user_name, int account_id,
goto FINISH_OFF;
}
- if ((noti_err = notification_set_text_domain(noti, NATIVE_EMAIL_DOMAIN, tzplatform_mkpath(TZ_SYS_RO_APP,"org.tizen.email/res/locale"))) != NOTIFICATION_ERROR_NONE) {
+ noti_err = notification_set_text_domain(noti, NATIVE_EMAIL_DOMAIN, tzplatform_mkpath(TZ_SYS_RO_APP, "org.tizen.email/res/locale"));
+ if (noti_err != NOTIFICATION_ERROR_NONE) {
EM_DEBUG_EXCEPTION("notification_set_text_domain failed [%d]", noti_err);
err = EMAIL_ERROR_SYSTEM_FAILURE;
goto FINISH_OFF;
@@ -1593,9 +1588,8 @@ INTERNAL_FUNC int emcore_add_notification(char *multi_user_name, int account_id,
/* set execution option to launch email-viewer when single incoming mail*/
app_control_create(&service);
- if (!service) {
+ if (!service)
EM_DEBUG_EXCEPTION("service create failed");
- }
if (unseen == 1) {
if (!emstorage_get_mail_by_id(multi_user_name, p_mail_id[0], &p_mail_data, false, &err)) {
@@ -1630,7 +1624,7 @@ INTERNAL_FUNC int emcore_add_notification(char *multi_user_name, int account_id,
goto FINISH_OFF;
}
} else if (unseen > 1) {
- EM_DEBUG_LOG_SEC("multi layout: unseen[%d], address[%s], account_name[%s]", unseen, account_tbl->user_email_address, account_tbl->account_name);
+ EM_DEBUG_LOG_SEC("multi layout: unseen[%d], address[%s], account_name[%s]", unseen, account_tbl->user_email_address, account_tbl->account_name);
if ((noti_err = emcore_layout_multi_noti(noti, unseen, account_tbl->user_email_address, account_tbl->account_name)) != NOTIFICATION_ERROR_NONE) {
EM_DEBUG_EXCEPTION("notification_layout_multi_noti failed [%d]", noti_err);
err = EMAIL_ERROR_SYSTEM_FAILURE;
@@ -1645,7 +1639,7 @@ INTERNAL_FUNC int emcore_add_notification(char *multi_user_name, int account_id,
app_control_add_extra_data(service, "NOTI_TYPE", buf);
if (unseen > EMAIL_NOTI_MAX_MAIL_ID)
- unseen = EMAIL_NOTI_MAX_MAIL_ID;
+ unseen = EMAIL_NOTI_MAX_MAIL_ID;
value = (char **)em_malloc(unseen * sizeof(char *));
if (value == NULL) {
EM_DEBUG_EXCEPTION("em_mallocfailed");
@@ -1674,18 +1668,16 @@ INTERNAL_FUNC int emcore_add_notification(char *multi_user_name, int account_id,
/* err = EMAIL_ERROR_PRIORITY_SENDER_MAIL_NOT_FOUND;*/ /*there is no mail for priority sender*/
}
- if ((noti_err = notification_set_display_applist(noti, NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY | NOTIFICATION_DISPLAY_APP_LOCK )) != NOTIFICATION_ERROR_NONE) {
+ noti_err = notification_set_display_applist(noti, NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY | NOTIFICATION_DISPLAY_APP_LOCK);
+ if (noti_err != NOTIFICATION_ERROR_NONE) {
EM_DEBUG_EXCEPTION("notification_insert failed [%d]", noti_err);
err = EMAIL_ERROR_SYSTEM_FAILURE;
goto FINISH_OFF;
}
- if ((err = __emcore_show_new_mail_noti()) != EMAIL_ERROR_NONE){
+ if ((err = __emcore_show_new_mail_noti()) != EMAIL_ERROR_NONE)
EM_DEBUG_EXCEPTION("notification new_mail ticker failed!!");
- }
-
-
if (new_noti) {
if ((noti_err = notification_insert(noti, &private_id)) != NOTIFICATION_ERROR_NONE) {
EM_DEBUG_EXCEPTION("notification_insert failed [%d]", noti_err);
@@ -1751,17 +1743,67 @@ FINISH_OFF:
return err;
}
-static gboolean __on_timer_delete_notification(gpointer userdata)
+static gboolean __on_timer_delete_notification(gpointer userdata)
{
int private_id = (int)userdata;
notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
- if ((noti_err = notification_delete_by_priv_id(NATIVE_EMAIL_APPLICATION_PKG, NOTIFICATION_TYPE_NOTI, private_id)) != NOTIFICATION_ERROR_NONE) {
+ noti_err = notification_delete_by_priv_id(NATIVE_EMAIL_APPLICATION_PKG, NOTIFICATION_TYPE_NOTI, private_id);
+ if (noti_err != NOTIFICATION_ERROR_NONE)
EM_DEBUG_EXCEPTION("notification delete fail!!");
- }
return false;
}
+static int __noti_set_text_sending_error(notification_h noti, int sending_error)
+{
+ notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
+
+ switch (sending_error) {
+ case EMAIL_ERROR_NONE:
+ notification_set_property(noti, NOTIFICATION_PROP_DISABLE_AUTO_DELETE);
+
+ if ((noti_err = notification_set_text(noti,
+ NOTIFICATION_TEXT_TYPE_CONTENT,
+ "Email Sent",
+ "IDS_EMAIL_TPOP_EMAIL_SENT",
+ NOTIFICATION_VARIABLE_TYPE_NONE)) != NOTIFICATION_ERROR_NONE) {
+ EM_DEBUG_EXCEPTION("notification_set_text failed [%d]", noti_err);
+ return EMAIL_ERROR_NOTI;
+ }
+ break;
+ case EMAIL_ERROR_SERVER_STORAGE_FULL:
+ if ((noti_err = notification_set_text(noti,
+ NOTIFICATION_TEXT_TYPE_CONTENT,
+ "Sending failed. Server storage full.",
+ "IDS_EMAIL_TPOP_SENDING_FAILED_SERVER_STORAGE_FULL_ABB",
+ NOTIFICATION_VARIABLE_TYPE_NONE)) != NOTIFICATION_ERROR_NONE) {
+ EM_DEBUG_EXCEPTION("notification_set_text failed [%d]", noti_err);
+ return EMAIL_ERROR_NOTI;
+ }
+ break;
+ case EMAIL_ERROR_SMTP_SEND_FAILURE_BY_OVERSIZE:
+ if ((noti_err = notification_set_text(noti,
+ NOTIFICATION_TEXT_TYPE_INFO_1,
+ "IDS_EMAIL_POP_THE_EMAIL_IS_TOO_LARGE",
+ NULL,
+ NOTIFICATION_VARIABLE_TYPE_NONE)) != NOTIFICATION_ERROR_NONE) {
+ EM_DEBUG_EXCEPTION("notification_set_text TEXT_TYPE_INFO_1 failed");
+ return EMAIL_ERROR_NOTI;
+ }
+ break;
+ default:
+ if ((noti_err = notification_set_text(noti,
+ NOTIFICATION_TEXT_TYPE_CONTENT,
+ "Sending failed",
+ "IDS_EMAIL_TPOP_SENDING_FAILED",
+ NOTIFICATION_VARIABLE_TYPE_NONE)) != NOTIFICATION_ERROR_NONE) {
+ EM_DEBUG_EXCEPTION("notification_set_text failed [%d]", noti_err);
+ return EMAIL_ERROR_NOTI;
+ }
+ }
+ return EMAIL_ERROR_NONE;
+}
+
INTERNAL_FUNC int emcore_add_notification_for_send(char *multi_user_name, int account_id, int mail_id, email_action_t action, int sending_error, unsigned long display)
{
EM_DEBUG_FUNC_BEGIN("account_id: %d, mail_id: %d, action:%d", account_id, mail_id, action);
@@ -1769,7 +1811,7 @@ INTERNAL_FUNC int emcore_add_notification_for_send(char *multi_user_name, int ac
#ifdef __FEATURE_NOTIFICATION_ENABLE__
void *join_zone = NULL;
char *mailbox_name = NULL;
-/* char *dgettext_string = NULL; */
+ /* char *dgettext_string = NULL; */
notification_h noti = NULL;
notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
emstorage_mail_tbl_t *p_mail_data = NULL;
@@ -1828,9 +1870,8 @@ INTERNAL_FUNC int emcore_add_notification_for_send(char *multi_user_name, int ac
app_control_create(&service);
- if (!service) {
+ if (!service)
EM_DEBUG_EXCEPTION("service create failed");
- }
/* Create service bundle */
if (sending_error != EMAIL_ERROR_NONE || action == EMAIL_ACTION_SENDING_MAIL) {
@@ -1869,118 +1910,73 @@ INTERNAL_FUNC int emcore_add_notification_for_send(char *multi_user_name, int ac
switch (action) {
case EMAIL_ACTION_SEND_MAIL:
-/*
- setlocale(LC_MESSAGES, vconf_get_str(VCONFKEY_LANGSET));
- bindtextdomain("sys_string", "/usr/share/locale");
- textdomain("sys_string");
-*/
+ /*
+ setlocale(LC_MESSAGES, vconf_get_str(VCONFKEY_LANGSET));
+ bindtextdomain("sys_string", "/usr/share/locale");
+ textdomain("sys_string");
+ */
setlocale(LC_MESSAGES, vconf_get_str(VCONFKEY_LANGSET));
- bindtextdomain(NATIVE_EMAIL_DOMAIN, tzplatform_mkpath(TZ_SYS_RO_APP,"org.tizen.email/res/locale"));
+ bindtextdomain(NATIVE_EMAIL_DOMAIN, tzplatform_mkpath(TZ_SYS_RO_APP, "org.tizen.email/res/locale"));
textdomain(NATIVE_EMAIL_DOMAIN);
- if ((noti_err = notification_set_text_domain(noti, NATIVE_EMAIL_DOMAIN, tzplatform_mkpath(TZ_SYS_RO_APP,"org.tizen.email/res/locale"))) != NOTIFICATION_ERROR_NONE) {
+ noti_err = notification_set_text_domain(noti, NATIVE_EMAIL_DOMAIN, tzplatform_mkpath(TZ_SYS_RO_APP, "org.tizen.email/res/locale"));
+ if (noti_err != NOTIFICATION_ERROR_NONE) {
EM_DEBUG_EXCEPTION("notification_set_text_domain failed [%d]", noti_err);
err = EMAIL_ERROR_NOTI;
goto FINISH_OFF;
}
-/*
- switch (sending_error) {
- case EMAIL_ERROR_NONE:
- dgettext_string = dgettext(NATIVE_EMAIL_DOMAIN, "IDS_EMAIL_TPOP_EMAIL_SENT");
- break;
- case EMAIL_ERROR_FLIGHT_MODE_ENABLE:
- dgettext_string = dgettext(NATIVE_EMAIL_DOMAIN, "IDS_EMAIL_TPOP_FAILED_TO_CONNECT_TO_NETWORK");
- break;
- case EMAIL_ERROR_NETWORK_NOT_AVAILABLE:
- case EMAIL_ERROR_NO_SIM_INSERTED:
- dgettext_string = dgettext(NATIVE_EMAIL_DOMAIN, "IDS_EMAIL_TPOP_NETWORK_NOT_AVAILABLE_EMAIL_WILL_BE_SENT_WHEN_CONNECTED_TO_NETWORK");
- break;
- case EMAIL_ERROR_SERVER_STORAGE_FULL:
- dgettext_string = dgettext(NATIVE_EMAIL_DOMAIN, "IDS_EMAIL_TPOP_SENDING_FAILED_SERVER_STORAGE_FULL_ABB");
- break;
- default:
- dgettext_string = dgettext(NATIVE_EMAIL_DOMAIN, "IDS_EMAIL_TPOP_SENDING_FAILED");
- break;
- }
-*/
+#if 0
+ switch (sending_error) {
+ case EMAIL_ERROR_NONE:
+ dgettext_string = dgettext(NATIVE_EMAIL_DOMAIN, "IDS_EMAIL_TPOP_EMAIL_SENT");
+ break;
+ case EMAIL_ERROR_FLIGHT_MODE_ENABLE:
+ dgettext_string = dgettext(NATIVE_EMAIL_DOMAIN, "IDS_EMAIL_TPOP_FAILED_TO_CONNECT_TO_NETWORK");
+ break;
+ case EMAIL_ERROR_NETWORK_NOT_AVAILABLE:
+ case EMAIL_ERROR_NO_SIM_INSERTED:
+ dgettext_string = dgettext(NATIVE_EMAIL_DOMAIN, "IDS_EMAIL_TPOP_NETWORK_NOT_AVAILABLE_EMAIL_WILL_BE_SENT_WHEN_CONNECTED_TO_NETWORK");
+ break;
+ case EMAIL_ERROR_SERVER_STORAGE_FULL:
+ dgettext_string = dgettext(NATIVE_EMAIL_DOMAIN, "IDS_EMAIL_TPOP_SENDING_FAILED_SERVER_STORAGE_FULL_ABB");
+ break;
+ default:
+ dgettext_string = dgettext(NATIVE_EMAIL_DOMAIN, "IDS_EMAIL_TPOP_SENDING_FAILED");
+ break;
+ }
+#endif
if ((noti_err = notification_set_layout(noti,
- NOTIFICATION_LY_NOTI_EVENT_SINGLE)) != NOTIFICATION_ERROR_NONE) {
+ NOTIFICATION_LY_NOTI_EVENT_SINGLE)) != NOTIFICATION_ERROR_NONE) {
EM_DEBUG_EXCEPTION("notification_set_layout failed [%d]", noti_err);
err = EMAIL_ERROR_NOTI;
goto FINISH_OFF;
}
if ((noti_err = notification_set_image(noti,
- NOTIFICATION_IMAGE_TYPE_ICON,
- EMAIL_NOTI_ICON_PATH)) != NOTIFICATION_ERROR_NONE) {
+ NOTIFICATION_IMAGE_TYPE_ICON,
+ EMAIL_NOTI_ICON_PATH)) != NOTIFICATION_ERROR_NONE) {
EM_DEBUG_EXCEPTION("notification_set_image failed [%d]", noti_err);
err = EMAIL_ERROR_NOTI;
goto FINISH_OFF;
}
if ((noti_err = notification_set_text(noti,
- NOTIFICATION_TEXT_TYPE_TITLE,
- p_mail_data->alias_recipient,
- NULL,
- NOTIFICATION_VARIABLE_TYPE_NONE)) != NOTIFICATION_ERROR_NONE) {
+ NOTIFICATION_TEXT_TYPE_TITLE,
+ p_mail_data->alias_recipient,
+ NULL,
+ NOTIFICATION_VARIABLE_TYPE_NONE)) != NOTIFICATION_ERROR_NONE) {
EM_DEBUG_EXCEPTION("notification_set_text failed [%d]", noti_err);
err = EMAIL_ERROR_NOTI;
goto FINISH_OFF;
}
- switch (sending_error) {
- case EMAIL_ERROR_NONE:
- notification_set_property(noti,NOTIFICATION_PROP_DISABLE_AUTO_DELETE);
-
- if ((noti_err = notification_set_text(noti,
- NOTIFICATION_TEXT_TYPE_CONTENT,
- "Email Sent",
- "IDS_EMAIL_TPOP_EMAIL_SENT",
- NOTIFICATION_VARIABLE_TYPE_NONE)) != NOTIFICATION_ERROR_NONE) {
- EM_DEBUG_EXCEPTION("notification_set_text failed [%d]", noti_err);
- err = EMAIL_ERROR_NOTI;
- goto FINISH_OFF;
- }
- break;
- case EMAIL_ERROR_SERVER_STORAGE_FULL:
- if ((noti_err = notification_set_text(noti,
- NOTIFICATION_TEXT_TYPE_CONTENT,
- "Sending failed. Server storage full.",
- "IDS_EMAIL_TPOP_SENDING_FAILED_SERVER_STORAGE_FULL_ABB",
- NOTIFICATION_VARIABLE_TYPE_NONE)) != NOTIFICATION_ERROR_NONE) {
- EM_DEBUG_EXCEPTION("notification_set_text failed [%d]", noti_err);
- err = EMAIL_ERROR_NOTI;
- goto FINISH_OFF;
- }
- break;
- default:
- if ((noti_err = notification_set_text(noti,
- NOTIFICATION_TEXT_TYPE_CONTENT,
- "Sending failed",
- "IDS_EMAIL_TPOP_SENDING_FAILED",
- NOTIFICATION_VARIABLE_TYPE_NONE)) != NOTIFICATION_ERROR_NONE) {
- EM_DEBUG_EXCEPTION("notification_set_text failed [%d]", noti_err);
- err = EMAIL_ERROR_NOTI;
- goto FINISH_OFF;
- }
- break;
- }
-
- if (sending_error == EMAIL_ERROR_SMTP_SEND_FAILURE_BY_OVERSIZE) {
- if ((noti_err = notification_set_text(noti,
- NOTIFICATION_TEXT_TYPE_INFO_1,
- "IDS_EMAIL_POP_THE_EMAIL_IS_TOO_LARGE",
- NULL,
- NOTIFICATION_VARIABLE_TYPE_NONE)) != NOTIFICATION_ERROR_NONE) {
- EM_DEBUG_EXCEPTION("notification_set_text TEXT_TYPE_INFO_1 failed");
- err = EMAIL_ERROR_NOTI;
- goto FINISH_OFF;
- }
- }
+ err = __noti_set_text_sending_error(noti, sending_error);
+ if (EMAIL_ERROR_NONE != err)
+ goto FINISH_OFF;
if ((noti_err = notification_set_display_applist(noti,
- NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY | NOTIFICATION_DISPLAY_APP_TICKER)) != NOTIFICATION_ERROR_NONE) {
+ NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY | NOTIFICATION_DISPLAY_APP_TICKER)) != NOTIFICATION_ERROR_NONE) {
EM_DEBUG_EXCEPTION("notification_insert failed [%d]", noti_err);
err = EMAIL_ERROR_NOTI;
goto FINISH_OFF;
@@ -1992,15 +1988,14 @@ INTERNAL_FUNC int emcore_add_notification_for_send(char *multi_user_name, int ac
goto FINISH_OFF;
}
- if (sending_error == EMAIL_ERROR_NONE) {
+ if (sending_error == EMAIL_ERROR_NONE)
g_timeout_add_seconds(3, __on_timer_delete_notification, (gpointer)private_id);
- }
break;
case EMAIL_ACTION_SENDING_MAIL:
-
- if ((noti_err = notification_set_text_domain(noti, NATIVE_EMAIL_DOMAIN, tzplatform_mkpath(TZ_SYS_RO_APP,"org.tizen.email/res/locale"))) != NOTIFICATION_ERROR_NONE) {
+ noti_err = notification_set_text_domain(noti, NATIVE_EMAIL_DOMAIN, tzplatform_mkpath(TZ_SYS_RO_APP, "org.tizen.email/res/locale"));
+ if (noti_err != NOTIFICATION_ERROR_NONE) {
EM_DEBUG_EXCEPTION("notification_set_text_domain failed [%d]", noti_err);
err = EMAIL_ERROR_NOTI;
goto FINISH_OFF;
@@ -2063,9 +2058,8 @@ FINISH_OFF:
app_control_destroy(service);
if ((action == EMAIL_ACTION_SEND_MAIL) && noti) {
- if ((noti_err = notification_free(noti)) != NOTIFICATION_ERROR_NONE) {
+ if ((noti_err = notification_free(noti)) != NOTIFICATION_ERROR_NONE)
err = EMAIL_ERROR_NOTI;
- }
}
if ((action != EMAIL_ACTION_SEND_MAIL) && (err != EMAIL_ERROR_NONE)) {
@@ -2099,9 +2093,8 @@ INTERNAL_FUNC void emcore_update_notification_for_send(int account_id, int mail_
notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
noti_err = notification_update_progress(g_sending_noti_handle, NOTIFICATION_PRIV_ID_NONE, progress);
- if (noti_err != NOTIFICATION_ERROR_NONE) {
+ if (noti_err != NOTIFICATION_ERROR_NONE)
EM_DEBUG_LOG("notification_update_progress failed [0x%x]", noti_err);
- }
EM_DEBUG_FUNC_END();
}
@@ -2115,7 +2108,7 @@ INTERNAL_FUNC int emcore_show_user_message(char *multi_user_name, int id, email_
emstorage_mail_tbl_t *mail_table_data = NULL;
if ((action == EMAIL_ACTION_SEND_MAIL || action == EMAIL_ACTION_SENDING_MAIL) && error != EMAIL_ERROR_CANCELLED) {
- /* In case email is cancelled using cancel button in Outbox there is no need to show Cancel/Retry Pop up */
+ /* In case email is cancelled using cancel button in Outbox there is no need to show Cancel/Retry Pop up */
if (id <= 0) {
EM_DEBUG_LOG("Invalid mail_id");
@@ -2157,7 +2150,7 @@ int emcore_get_storage_status(void)
#ifdef STORAGE_STATUS
nError = vconf_get_int(PS_KEY_SYSTEM_STORAGE_MOVI_STATUS,
- &storage_status);
+ &storage_status);
#endif /* STORAGE_STATUS */
if (nError == -1) {
@@ -2204,8 +2197,8 @@ int emcore_calc_mail_size(char *multi_user_name, email_mail_data_t *input_mail_d
int mail_size = 0; /* size of the plain text body and attachments */
int err = EMAIL_ERROR_NONE;
int i = 0;
- char *prefix_path = NULL;
- char real_file_path[255] = {0};
+ char *prefix_path = NULL;
+ char real_file_path[255] = {0};
if (!input_mail_data || (input_attachment_count && !input_attachment_data_list) || (!input_attachment_count && input_attachment_data_list) || !output_size) {
EM_DEBUG_EXCEPTION("EMAIL_ERROR_INVALID_PARAM");
@@ -2213,7 +2206,7 @@ int emcore_calc_mail_size(char *multi_user_name, email_mail_data_t *input_mail_d
goto FINISH_OFF;
}
- if (EM_SAFE_STRLEN(multi_user_name) > 0) {
+ if (EM_SAFE_STRLEN(multi_user_name) > 0) {
err = emcore_get_container_path(multi_user_name, &prefix_path);
if (err != EMAIL_ERROR_NONE) {
EM_DEBUG_EXCEPTION("emcore_get_container_path failed :[%d]", err);
@@ -2224,8 +2217,8 @@ int emcore_calc_mail_size(char *multi_user_name, email_mail_data_t *input_mail_d
}
if (input_mail_data->file_path_plain != NULL) {
- memset(real_file_path, 0x00, sizeof(real_file_path));
- SNPRINTF(real_file_path, sizeof(real_file_path), "%s%s", prefix_path, input_mail_data->file_path_plain);
+ memset(real_file_path, 0x00, sizeof(real_file_path));
+ SNPRINTF(real_file_path, sizeof(real_file_path), "%s%s", prefix_path, input_mail_data->file_path_plain);
if (stat(real_file_path, &st_buf) < 0) {
EM_DEBUG_EXCEPTION_SEC("input_mail_data->file_path_plain : stat(\"%s\") failed...", input_mail_data->file_path_plain);
@@ -2238,8 +2231,8 @@ int emcore_calc_mail_size(char *multi_user_name, email_mail_data_t *input_mail_d
}
if (input_mail_data->file_path_html != NULL) {
- memset(real_file_path, 0x00, sizeof(real_file_path));
- SNPRINTF(real_file_path, sizeof(real_file_path), "%s%s", prefix_path, input_mail_data->file_path_html);
+ memset(real_file_path, 0x00, sizeof(real_file_path));
+ SNPRINTF(real_file_path, sizeof(real_file_path), "%s%s", prefix_path, input_mail_data->file_path_html);
if (stat(real_file_path, &st_buf) < 0) {
EM_DEBUG_EXCEPTION_SEC("input_mail_data->file_path_html : stat(\"%s\") failed...", input_mail_data->file_path_html);
@@ -2251,8 +2244,8 @@ int emcore_calc_mail_size(char *multi_user_name, email_mail_data_t *input_mail_d
}
for (i = 0; i < input_attachment_count; i++) {
- memset(real_file_path, 0x00, sizeof(real_file_path));
- SNPRINTF(real_file_path, sizeof(real_file_path), "%s%s", prefix_path, input_attachment_data_list[i].attachment_path);
+ memset(real_file_path, 0x00, sizeof(real_file_path));
+ SNPRINTF(real_file_path, sizeof(real_file_path), "%s%s", prefix_path, input_attachment_data_list[i].attachment_path);
if (stat(real_file_path, &st_buf) < 0) {
EM_DEBUG_EXCEPTION_SEC("stat(\"%s\") failed...", input_attachment_data_list[i].attachment_path);
@@ -2290,8 +2283,8 @@ char *emcore_get_alias_of_mailbox(const char *mailbox_path)
if (token_list == NULL) {
EM_DEBUG_LOG("g_strsplit_set failed.");
- if (mailbox)
- g_free(mailbox);
+ if (mailbox)
+ g_free(mailbox);
return NULL;
}
@@ -2303,9 +2296,8 @@ char *emcore_get_alias_of_mailbox(const char *mailbox_path)
index++;
name = g_strdup(token_list[index - 1]);
- if (!name) {
+ if (!name)
return NULL;
- }
g_strfreev(token_list);
@@ -2313,7 +2305,7 @@ char *emcore_get_alias_of_mailbox(const char *mailbox_path)
EM_DEBUG_LOG_DEV("converted_name:%s", converted_name);
if (!converted_name || EM_SAFE_STRLEN(converted_name) == 0) {
- EM_SAFE_FREE(converted_name);
+ EM_SAFE_FREE(converted_name);
converted_name = g_strdup(name);
}
@@ -2387,9 +2379,8 @@ void emcore_fill_address_information_of_mail_tbl(char *multi_user_name, emstorag
email_account_t *ref_account = NULL;
ref_account = emcore_get_account_reference(multi_user_name, mail_data->account_id, false);
- if (!ref_account) {
+ if (!ref_account)
EM_DEBUG_LOG("emcore_get_account_reference failed [%d]", mail_data->account_id);
- }
EM_DEBUG_LOG_SEC("full_address_from [%s]", mail_data->full_address_from);
@@ -2429,9 +2420,8 @@ void emcore_fill_address_information_of_mail_tbl(char *multi_user_name, emstorag
}
g_strfreev(vector);
- if (recipient_self) {
+ if (recipient_self)
recipient = recipient_self;
- }
}
if (emcore_get_first_address(recipient, &first_alias, &first_address) == true) {
@@ -2459,56 +2449,56 @@ struct email_attribute_info {
};
static struct email_attribute_info _mail_attribute_info_array[] = {
- {EMAIL_MAIL_ATTRIBUTE_MAIL_ID, "mail_id", EMAIL_MAIL_ATTRIBUTE_VALUE_TYPE_INTEGER},
- {EMAIL_MAIL_ATTRIBUTE_ACCOUNT_ID, "account_id", EMAIL_MAIL_ATTRIBUTE_VALUE_TYPE_INTEGER},
- {EMAIL_MAIL_ATTRIBUTE_MAILBOX_ID, "mailbox_id", EMAIL_MAIL_ATTRIBUTE_VALUE_TYPE_INTEGER},
- {EMAIL_MAIL_ATTRIBUTE_MAILBOX_NAME, "mailbox_name", EMAIL_MAIL_ATTRIBUTE_VALUE_TYPE_STRING},
- {EMAIL_MAIL_ATTRIBUTE_MAILBOX_TYPE, "mailbox_type", EMAIL_MAIL_ATTRIBUTE_VALUE_TYPE_INTEGER},
- {EMAIL_MAIL_ATTRIBUTE_SUBJECT, "subject", EMAIL_MAIL_ATTRIBUTE_VALUE_TYPE_STRING},
- {EMAIL_MAIL_ATTRIBUTE_DATE_TIME, "date_time", EMAIL_MAIL_ATTRIBUTE_VALUE_TYPE_TIME},
- {EMAIL_MAIL_ATTRIBUTE_SERVER_MAIL_STATUS, "server_mail_status", EMAIL_MAIL_ATTRIBUTE_VALUE_TYPE_INTEGER},
- {EMAIL_MAIL_ATTRIBUTE_SERVER_MAILBOX_NAME, "server_mailbox_name", EMAIL_MAIL_ATTRIBUTE_VALUE_TYPE_STRING},
- {EMAIL_MAIL_ATTRIBUTE_SERVER_MAIL_ID, "server_mail_id", EMAIL_MAIL_ATTRIBUTE_VALUE_TYPE_STRING},
- {EMAIL_MAIL_ATTRIBUTE_MESSAGE_ID, "message_id", EMAIL_MAIL_ATTRIBUTE_VALUE_TYPE_STRING},
- {EMAIL_MAIL_ATTRIBUTE_REFERENCE_MAIL_ID, "reference_mail_id", EMAIL_MAIL_ATTRIBUTE_VALUE_TYPE_INTEGER},
- {EMAIL_MAIL_ATTRIBUTE_FROM, "full_address_from", EMAIL_MAIL_ATTRIBUTE_VALUE_TYPE_STRING},
- {EMAIL_MAIL_ATTRIBUTE_TO, "full_address_to", EMAIL_MAIL_ATTRIBUTE_VALUE_TYPE_STRING},
- {EMAIL_MAIL_ATTRIBUTE_CC, "full_address_cc", EMAIL_MAIL_ATTRIBUTE_VALUE_TYPE_STRING},
- {EMAIL_MAIL_ATTRIBUTE_BCC, "full_address_bcc", EMAIL_MAIL_ATTRIBUTE_VALUE_TYPE_STRING},
- {EMAIL_MAIL_ATTRIBUTE_BODY_DOWNLOAD_STATUS, "body_download_status", EMAIL_MAIL_ATTRIBUTE_VALUE_TYPE_INTEGER},
- {EMAIL_MAIL_ATTRIBUTE_MAIL_SIZE, "mail_size", EMAIL_MAIL_ATTRIBUTE_VALUE_TYPE_INTEGER},
- {EMAIL_MAIL_ATTRIBUTE_FILE_PATH_PLAIN, "file_path_plain", EMAIL_MAIL_ATTRIBUTE_VALUE_TYPE_STRING},
- {EMAIL_MAIL_ATTRIBUTE_FILE_PATH_HTML, "file_path_html", EMAIL_MAIL_ATTRIBUTE_VALUE_TYPE_STRING},
- {EMAIL_MAIL_ATTRIBUTE_FILE_SIZE, "file_size", EMAIL_MAIL_ATTRIBUTE_VALUE_TYPE_INTEGER},
- {EMAIL_MAIL_ATTRIBUTE_FLAGS_SEEN_FIELD, "flags_seen_field", EMAIL_MAIL_ATTRIBUTE_VALUE_TYPE_INTEGER},
- {EMAIL_MAIL_ATTRIBUTE_FLAGS_DELETED_FIELD, "flags_deleted_field", EMAIL_MAIL_ATTRIBUTE_VALUE_TYPE_INTEGER },
- {EMAIL_MAIL_ATTRIBUTE_FLAGS_FLAGGED_FIELD, "flags_flagged_field", EMAIL_MAIL_ATTRIBUTE_VALUE_TYPE_INTEGER},
- {EMAIL_MAIL_ATTRIBUTE_FLAGS_ANSWERED_FIELD, "flags_answered_field", EMAIL_MAIL_ATTRIBUTE_VALUE_TYPE_INTEGER},
- {EMAIL_MAIL_ATTRIBUTE_FLAGS_RECENT_FIELD, "flags_recent_field", EMAIL_MAIL_ATTRIBUTE_VALUE_TYPE_INTEGER},
- {EMAIL_MAIL_ATTRIBUTE_FLAGS_DRAFT_FIELD, "flags_draft_field", EMAIL_MAIL_ATTRIBUTE_VALUE_TYPE_INTEGER},
- {EMAIL_MAIL_ATTRIBUTE_FLAGS_FORWARDED_FIELD, "flags_forwarded_field", EMAIL_MAIL_ATTRIBUTE_VALUE_TYPE_INTEGER},
- {EMAIL_MAIL_ATTRIBUTE_DRM_STATUS, "drm_status", EMAIL_MAIL_ATTRIBUTE_VALUE_TYPE_INTEGER},
- {EMAIL_MAIL_ATTRIBUTE_PRIORITY, "priority", EMAIL_MAIL_ATTRIBUTE_VALUE_TYPE_INTEGER},
- {EMAIL_MAIL_ATTRIBUTE_SAVE_STATUS, "save_status", EMAIL_MAIL_ATTRIBUTE_VALUE_TYPE_INTEGER},
- {EMAIL_MAIL_ATTRIBUTE_LOCK_STATUS, "lock_status", EMAIL_MAIL_ATTRIBUTE_VALUE_TYPE_INTEGER},
- {EMAIL_MAIL_ATTRIBUTE_REPORT_STATUS, "report_status", EMAIL_MAIL_ATTRIBUTE_VALUE_TYPE_INTEGER},
- {EMAIL_MAIL_ATTRIBUTE_ATTACHMENT_COUNT, "attachment_count", EMAIL_MAIL_ATTRIBUTE_VALUE_TYPE_INTEGER},
- {EMAIL_MAIL_ATTRIBUTE_INLINE_CONTENT_COUNT, "inline_content_count", EMAIL_MAIL_ATTRIBUTE_VALUE_TYPE_INTEGER},
- {EMAIL_MAIL_ATTRIBUTE_THREAD_ID, "thread_id", EMAIL_MAIL_ATTRIBUTE_VALUE_TYPE_INTEGER},
- {EMAIL_MAIL_ATTRIBUTE_THREAD_ITEM_COUNT, "thread_item_count", EMAIL_MAIL_ATTRIBUTE_VALUE_TYPE_INTEGER},
- {EMAIL_MAIL_ATTRIBUTE_PREVIEW_TEXT, "preview_text", EMAIL_MAIL_ATTRIBUTE_VALUE_TYPE_STRING},
- {EMAIL_MAIL_ATTRIBUTE_MEETING_REQUEST_STATUS, "meeting_request_status", EMAIL_MAIL_ATTRIBUTE_VALUE_TYPE_INTEGER},
- {EMAIL_MAIL_ATTRIBUTE_MESSAGE_CLASS, "message_class", EMAIL_MAIL_ATTRIBUTE_VALUE_TYPE_INTEGER},
- {EMAIL_MAIL_ATTRIBUTE_DIGEST_TYPE, "digest_type", EMAIL_MAIL_ATTRIBUTE_VALUE_TYPE_INTEGER},
- {EMAIL_MAIL_ATTRIBUTE_SMIME_TYPE, "smime_type", EMAIL_MAIL_ATTRIBUTE_VALUE_TYPE_INTEGER},
- {EMAIL_MAIL_ATTRIBUTE_SCHEDULED_SENDING_TIME, "scheduled_sending_time", EMAIL_MAIL_ATTRIBUTE_VALUE_TYPE_TIME},
- {EMAIL_MAIL_ATTRIBUTE_REMAINING_RESEND_TIMES, "remaining_resend_times", EMAIL_MAIL_ATTRIBUTE_VALUE_TYPE_INTEGER},
- {EMAIL_MAIL_ATTRIBUTE_TAG_ID, "tag_id", EMAIL_MAIL_ATTRIBUTE_VALUE_TYPE_INTEGER},
- {EMAIL_MAIL_ATTRIBUTE_REPLIED_TIME, "replied_time", EMAIL_MAIL_ATTRIBUTE_VALUE_TYPE_TIME},
- {EMAIL_MAIL_ATTRIBUTE_FORWARDED_TIME, "forwarded_time", EMAIL_MAIL_ATTRIBUTE_VALUE_TYPE_TIME},
- {EMAIL_MAIL_ATTRIBUTE_RECIPIENT_ADDRESS, "email_recipient_address", EMAIL_MAIL_ATTRIBUTE_VALUE_TYPE_STRING},
- {EMAIL_MAIL_ATTRIBUTE_EAS_DATA_LENGTH_TYPE, "eas_data_length", EMAIL_MAIL_ATTRIBUTE_VALUE_TYPE_INTEGER},
- {EMAIL_MAIL_ATTRIBUTE_EAS_DATA_TYPE, "eas_data", EMAIL_MAIL_ATTRIBUTE_VALUE_TYPE_BINARY}
+ {EMAIL_MAIL_ATTRIBUTE_MAIL_ID, "mail_id", EMAIL_MAIL_ATTRIBUTE_VALUE_TYPE_INTEGER},
+ {EMAIL_MAIL_ATTRIBUTE_ACCOUNT_ID, "account_id", EMAIL_MAIL_ATTRIBUTE_VALUE_TYPE_INTEGER},
+ {EMAIL_MAIL_ATTRIBUTE_MAILBOX_ID, "mailbox_id", EMAIL_MAIL_ATTRIBUTE_VALUE_TYPE_INTEGER},
+ {EMAIL_MAIL_ATTRIBUTE_MAILBOX_NAME, "mailbox_name", EMAIL_MAIL_ATTRIBUTE_VALUE_TYPE_STRING},
+ {EMAIL_MAIL_ATTRIBUTE_MAILBOX_TYPE, "mailbox_type", EMAIL_MAIL_ATTRIBUTE_VALUE_TYPE_INTEGER},
+ {EMAIL_MAIL_ATTRIBUTE_SUBJECT, "subject", EMAIL_MAIL_ATTRIBUTE_VALUE_TYPE_STRING},
+ {EMAIL_MAIL_ATTRIBUTE_DATE_TIME, "date_time", EMAIL_MAIL_ATTRIBUTE_VALUE_TYPE_TIME},
+ {EMAIL_MAIL_ATTRIBUTE_SERVER_MAIL_STATUS, "server_mail_status", EMAIL_MAIL_ATTRIBUTE_VALUE_TYPE_INTEGER},
+ {EMAIL_MAIL_ATTRIBUTE_SERVER_MAILBOX_NAME, "server_mailbox_name", EMAIL_MAIL_ATTRIBUTE_VALUE_TYPE_STRING},
+ {EMAIL_MAIL_ATTRIBUTE_SERVER_MAIL_ID, "server_mail_id", EMAIL_MAIL_ATTRIBUTE_VALUE_TYPE_STRING},
+ {EMAIL_MAIL_ATTRIBUTE_MESSAGE_ID, "message_id", EMAIL_MAIL_ATTRIBUTE_VALUE_TYPE_STRING},
+ {EMAIL_MAIL_ATTRIBUTE_REFERENCE_MAIL_ID, "reference_mail_id", EMAIL_MAIL_ATTRIBUTE_VALUE_TYPE_INTEGER},
+ {EMAIL_MAIL_ATTRIBUTE_FROM, "full_address_from", EMAIL_MAIL_ATTRIBUTE_VALUE_TYPE_STRING},
+ {EMAIL_MAIL_ATTRIBUTE_TO, "full_address_to", EMAIL_MAIL_ATTRIBUTE_VALUE_TYPE_STRING},
+ {EMAIL_MAIL_ATTRIBUTE_CC, "full_address_cc", EMAIL_MAIL_ATTRIBUTE_VALUE_TYPE_STRING},
+ {EMAIL_MAIL_ATTRIBUTE_BCC, "full_address_bcc", EMAIL_MAIL_ATTRIBUTE_VALUE_TYPE_STRING},
+ {EMAIL_MAIL_ATTRIBUTE_BODY_DOWNLOAD_STATUS, "body_download_status", EMAIL_MAIL_ATTRIBUTE_VALUE_TYPE_INTEGER},
+ {EMAIL_MAIL_ATTRIBUTE_MAIL_SIZE, "mail_size", EMAIL_MAIL_ATTRIBUTE_VALUE_TYPE_INTEGER},
+ {EMAIL_MAIL_ATTRIBUTE_FILE_PATH_PLAIN, "file_path_plain", EMAIL_MAIL_ATTRIBUTE_VALUE_TYPE_STRING},
+ {EMAIL_MAIL_ATTRIBUTE_FILE_PATH_HTML, "file_path_html", EMAIL_MAIL_ATTRIBUTE_VALUE_TYPE_STRING},
+ {EMAIL_MAIL_ATTRIBUTE_FILE_SIZE, "file_size", EMAIL_MAIL_ATTRIBUTE_VALUE_TYPE_INTEGER},
+ {EMAIL_MAIL_ATTRIBUTE_FLAGS_SEEN_FIELD, "flags_seen_field", EMAIL_MAIL_ATTRIBUTE_VALUE_TYPE_INTEGER},
+ {EMAIL_MAIL_ATTRIBUTE_FLAGS_DELETED_FIELD, "flags_deleted_field", EMAIL_MAIL_ATTRIBUTE_VALUE_TYPE_INTEGER },
+ {EMAIL_MAIL_ATTRIBUTE_FLAGS_FLAGGED_FIELD, "flags_flagged_field", EMAIL_MAIL_ATTRIBUTE_VALUE_TYPE_INTEGER},
+ {EMAIL_MAIL_ATTRIBUTE_FLAGS_ANSWERED_FIELD, "flags_answered_field", EMAIL_MAIL_ATTRIBUTE_VALUE_TYPE_INTEGER},
+ {EMAIL_MAIL_ATTRIBUTE_FLAGS_RECENT_FIELD, "flags_recent_field", EMAIL_MAIL_ATTRIBUTE_VALUE_TYPE_INTEGER},
+ {EMAIL_MAIL_ATTRIBUTE_FLAGS_DRAFT_FIELD, "flags_draft_field", EMAIL_MAIL_ATTRIBUTE_VALUE_TYPE_INTEGER},
+ {EMAIL_MAIL_ATTRIBUTE_FLAGS_FORWARDED_FIELD, "flags_forwarded_field", EMAIL_MAIL_ATTRIBUTE_VALUE_TYPE_INTEGER},
+ {EMAIL_MAIL_ATTRIBUTE_DRM_STATUS, "drm_status", EMAIL_MAIL_ATTRIBUTE_VALUE_TYPE_INTEGER},
+ {EMAIL_MAIL_ATTRIBUTE_PRIORITY, "priority", EMAIL_MAIL_ATTRIBUTE_VALUE_TYPE_INTEGER},
+ {EMAIL_MAIL_ATTRIBUTE_SAVE_STATUS, "save_status", EMAIL_MAIL_ATTRIBUTE_VALUE_TYPE_INTEGER},
+ {EMAIL_MAIL_ATTRIBUTE_LOCK_STATUS, "lock_status", EMAIL_MAIL_ATTRIBUTE_VALUE_TYPE_INTEGER},
+ {EMAIL_MAIL_ATTRIBUTE_REPORT_STATUS, "report_status", EMAIL_MAIL_ATTRIBUTE_VALUE_TYPE_INTEGER},
+ {EMAIL_MAIL_ATTRIBUTE_ATTACHMENT_COUNT, "attachment_count", EMAIL_MAIL_ATTRIBUTE_VALUE_TYPE_INTEGER},
+ {EMAIL_MAIL_ATTRIBUTE_INLINE_CONTENT_COUNT, "inline_content_count", EMAIL_MAIL_ATTRIBUTE_VALUE_TYPE_INTEGER},
+ {EMAIL_MAIL_ATTRIBUTE_THREAD_ID, "thread_id", EMAIL_MAIL_ATTRIBUTE_VALUE_TYPE_INTEGER},
+ {EMAIL_MAIL_ATTRIBUTE_THREAD_ITEM_COUNT, "thread_item_count", EMAIL_MAIL_ATTRIBUTE_VALUE_TYPE_INTEGER},
+ {EMAIL_MAIL_ATTRIBUTE_PREVIEW_TEXT, "preview_text", EMAIL_MAIL_ATTRIBUTE_VALUE_TYPE_STRING},
+ {EMAIL_MAIL_ATTRIBUTE_MEETING_REQUEST_STATUS, "meeting_request_status", EMAIL_MAIL_ATTRIBUTE_VALUE_TYPE_INTEGER},
+ {EMAIL_MAIL_ATTRIBUTE_MESSAGE_CLASS, "message_class", EMAIL_MAIL_ATTRIBUTE_VALUE_TYPE_INTEGER},
+ {EMAIL_MAIL_ATTRIBUTE_DIGEST_TYPE, "digest_type", EMAIL_MAIL_ATTRIBUTE_VALUE_TYPE_INTEGER},
+ {EMAIL_MAIL_ATTRIBUTE_SMIME_TYPE, "smime_type", EMAIL_MAIL_ATTRIBUTE_VALUE_TYPE_INTEGER},
+ {EMAIL_MAIL_ATTRIBUTE_SCHEDULED_SENDING_TIME, "scheduled_sending_time", EMAIL_MAIL_ATTRIBUTE_VALUE_TYPE_TIME},
+ {EMAIL_MAIL_ATTRIBUTE_REMAINING_RESEND_TIMES, "remaining_resend_times", EMAIL_MAIL_ATTRIBUTE_VALUE_TYPE_INTEGER},
+ {EMAIL_MAIL_ATTRIBUTE_TAG_ID, "tag_id", EMAIL_MAIL_ATTRIBUTE_VALUE_TYPE_INTEGER},
+ {EMAIL_MAIL_ATTRIBUTE_REPLIED_TIME, "replied_time", EMAIL_MAIL_ATTRIBUTE_VALUE_TYPE_TIME},
+ {EMAIL_MAIL_ATTRIBUTE_FORWARDED_TIME, "forwarded_time", EMAIL_MAIL_ATTRIBUTE_VALUE_TYPE_TIME},
+ {EMAIL_MAIL_ATTRIBUTE_RECIPIENT_ADDRESS, "email_recipient_address", EMAIL_MAIL_ATTRIBUTE_VALUE_TYPE_STRING},
+ {EMAIL_MAIL_ATTRIBUTE_EAS_DATA_LENGTH_TYPE, "eas_data_length", EMAIL_MAIL_ATTRIBUTE_VALUE_TYPE_INTEGER},
+ {EMAIL_MAIL_ATTRIBUTE_EAS_DATA_TYPE, "eas_data", EMAIL_MAIL_ATTRIBUTE_VALUE_TYPE_BINARY}
};
INTERNAL_FUNC char* emcore_get_mail_field_name_by_attribute_type(email_mail_attribute_type input_attribute_type)
@@ -2586,9 +2576,9 @@ int emcore_strip_mail_body_from_file(char *multi_user_name, emstorage_mail_tbl_t
char *buf = NULL;
char *encoding_type = NULL;
char *utf8_encoded_string = NULL;
- char *prefix_path = NULL;
- char real_html_path[255] = {0};
- char real_plain_path[255] = {0};
+ char *prefix_path = NULL;
+ char real_html_path[255] = {0};
+ char real_plain_path[255] = {0};
gsize byte_read = 0;
gsize byte_written = 0;
GError *glib_error = NULL;
@@ -2601,7 +2591,7 @@ int emcore_strip_mail_body_from_file(char *multi_user_name, emstorage_mail_tbl_t
goto FINISH_OFF;
}
- if (EM_SAFE_STRLEN(multi_user_name) > 0) {
+ if (EM_SAFE_STRLEN(multi_user_name) > 0) {
err = emcore_get_container_path(multi_user_name, &prefix_path);
if (err != EMAIL_ERROR_NONE) {
EM_DEBUG_EXCEPTION("emcore_get_container_path failed :[%d]", err);
@@ -2621,7 +2611,7 @@ int emcore_strip_mail_body_from_file(char *multi_user_name, emstorage_mail_tbl_t
goto FINISH_OFF;
}
- SNPRINTF(real_html_path, sizeof(real_html_path), "%s%s", prefix_path, mail->file_path_html);
+ SNPRINTF(real_html_path, sizeof(real_html_path), "%s%s", prefix_path, mail->file_path_html);
if ((err = em_get_encoding_type_from_file_path(mail->file_path_plain, &encoding_type)) != EMAIL_ERROR_NONE) {
EM_DEBUG_EXCEPTION("em_get_encoding_type_from_file_path failed [%d]", err);
@@ -2636,8 +2626,8 @@ int emcore_strip_mail_body_from_file(char *multi_user_name, emstorage_mail_tbl_t
*stripped_text = EM_SAFE_STRDUP(result_buffer);
}
- if (!buf && mail->file_path_plain) {
- SNPRINTF(real_plain_path, sizeof(real_plain_path), "%s%s", prefix_path, mail->file_path_plain);
+ if (mail->file_path_plain) {
+ SNPRINTF(real_plain_path, sizeof(real_plain_path), "%s%s", prefix_path, mail->file_path_plain);
if ((err = em_get_encoding_type_from_file_path(mail->file_path_plain, &encoding_type)) != EMAIL_ERROR_NONE) {
EM_DEBUG_EXCEPTION("em_get_encoding_type_from_file_path failed [%d]", err);
@@ -2669,6 +2659,7 @@ int emcore_strip_mail_body_from_file(char *multi_user_name, emstorage_mail_tbl_t
}
byte_read = fread(buf, sizeof(char), st_buf.st_size, fp_plain);
+ buf[byte_read] = '\0';
if (byte_read <= 0) {
EM_SAFE_FREE(buf);
@@ -2685,7 +2676,6 @@ int emcore_strip_mail_body_from_file(char *multi_user_name, emstorage_mail_tbl_t
}
if (buf) {
- buf[byte_read] = '\0';
em_trim_left(buf);
if (encoding_type && strcasecmp(encoding_type, "UTF-8") != 0) {
EM_DEBUG_LOG("encoding_type [%s]", encoding_type);
@@ -2701,7 +2691,7 @@ int emcore_strip_mail_body_from_file(char *multi_user_name, emstorage_mail_tbl_t
if (utf8_encoded_string == NULL) {
if (!g_error_matches(glib_error, G_CONVERT_ERROR, G_CONVERT_ERROR_ILLEGAL_SEQUENCE)) {
- EM_SAFE_FREE(*stripped_text);
+ EM_SAFE_FREE(*stripped_text);
*stripped_text = EM_SAFE_STRDUP(buf);
goto FINISH_OFF;
}
@@ -2716,10 +2706,10 @@ int emcore_strip_mail_body_from_file(char *multi_user_name, emstorage_mail_tbl_t
}
EM_SAFE_FREE(buf);
- EM_SAFE_FREE(*stripped_text);
+ EM_SAFE_FREE(*stripped_text);
*stripped_text = EM_SAFE_STRDUP(utf8_encoded_string);
} else {
- EM_SAFE_FREE(*stripped_text);
+ EM_SAFE_FREE(*stripped_text);
*stripped_text = EM_SAFE_STRDUP(buf);
}
}
@@ -2759,8 +2749,8 @@ int emcore_get_preview_text_from_file(char *multi_user_name, const char *input_p
FILE *fp_plain = NULL;
GError *glib_error = NULL;
struct stat st_buf;
- char *prefix_path = NULL;
- char real_file_path[255] = {0};
+ char *prefix_path = NULL;
+ char real_file_path[255] = {0};
if (!output_preview_buffer) {
EM_DEBUG_EXCEPTION("EMAIL_ERROR_INVALID_PARAM");
@@ -2770,7 +2760,7 @@ int emcore_get_preview_text_from_file(char *multi_user_name, const char *input_p
local_preview_buffer_length = input_preview_buffer_length * 2;
- if (EM_SAFE_STRLEN(multi_user_name) > 0) {
+ if (EM_SAFE_STRLEN(multi_user_name) > 0) {
err = emcore_get_container_path(multi_user_name, &prefix_path);
if (err != EMAIL_ERROR_NONE) {
EM_DEBUG_EXCEPTION("emcore_get_container_path failed :[%d]", err);
@@ -2784,8 +2774,8 @@ int emcore_get_preview_text_from_file(char *multi_user_name, const char *input_p
/* get preview text from html file */
char result_buffer[MAX_PREVIEW_TEXT_LENGTH] = { 0, };
- memset(real_file_path, 0x00, sizeof(real_file_path));
- SNPRINTF(real_file_path, sizeof(real_file_path), "%s%s", prefix_path, input_html_path);
+ memset(real_file_path, 0x00, sizeof(real_file_path));
+ SNPRINTF(real_file_path, sizeof(real_file_path), "%s%s", prefix_path, input_html_path);
if ((err = em_get_encoding_type_from_file_path(input_html_path, &encoding_type)) != EMAIL_ERROR_NONE) {
EM_DEBUG_EXCEPTION("em_get_encoding_type_from_file_path failed [%d]", err);
@@ -2801,8 +2791,8 @@ int emcore_get_preview_text_from_file(char *multi_user_name, const char *input_p
if (!local_preview_text && input_plain_path) { /*prevent 26249*/
- memset(real_file_path, 0x00, sizeof(real_file_path));
- SNPRINTF(real_file_path, sizeof(real_file_path), "%s%s", prefix_path, input_plain_path);
+ memset(real_file_path, 0x00, sizeof(real_file_path));
+ SNPRINTF(real_file_path, sizeof(real_file_path), "%s%s", prefix_path, input_plain_path);
/* get preview text from plain text file */
if ((err = em_get_encoding_type_from_file_path(input_plain_path, &encoding_type)) != EMAIL_ERROR_NONE) {
@@ -2866,9 +2856,9 @@ int emcore_get_preview_text_from_file(char *multi_user_name, const char *input_p
utf8_encoded_string = (char *)g_convert(local_preview_text, -1, "UTF-8", encoding_type, &byte_read, &byte_written, &glib_error);
if (utf8_encoded_string == NULL) {
- if (!g_error_matches(glib_error, G_CONVERT_ERROR, G_CONVERT_ERROR_ILLEGAL_SEQUENCE)) {
+ if (!g_error_matches(glib_error, G_CONVERT_ERROR, G_CONVERT_ERROR_ILLEGAL_SEQUENCE))
goto FINISH_OFF;
- }
+
EM_DEBUG_LOG("Extract the preview text, again");
utf8_encoded_string = (char *)g_convert(local_preview_text, -1, "UTF-8", encoding_type, &byte_read, &byte_written, &glib_error);
@@ -2883,10 +2873,10 @@ int emcore_get_preview_text_from_file(char *multi_user_name, const char *input_p
}
FINISH_OFF:
-/*
- if (local_preview_text != NULL)
- *output_preview_buffer = EM_SAFE_STRDUP(local_preview_text);
-*/
+ /*
+ if (local_preview_text != NULL)
+ *output_preview_buffer = EM_SAFE_STRDUP(local_preview_text);
+ */
if (local_preview_text != NULL) {
EM_SAFE_FREE(*output_preview_buffer); /* valgrind */
*output_preview_buffer = EM_SAFE_STRDUP(local_preview_text);
@@ -3104,12 +3094,12 @@ INTERNAL_FUNC char *reg_replace_new(char *input_source_text, char *input_old_pat
}
replaced_str = g_regex_replace_literal(regex,
- input_source_text,
- strlen(input_source_text),
- 0,
- input_new_string,
- 0,
- &error);
+ input_source_text,
+ strlen(input_source_text),
+ 0,
+ input_new_string,
+ 0,
+ &error);
if (replaced_str == NULL) {
EM_DEBUG_EXCEPTION("g_regex_replace_literal failed : [%s][%d]", error->message, error->code);
goto FINISH_OFF;
@@ -3127,15 +3117,15 @@ FINISH_OFF:
static void emcore_get_content_string(xmlNode *input_node, char *input_result_buffer, int input_result_buffer_length, int *input_exit_flag)
{
- xmlNode *cur_node = NULL;
- char *temp_content_string = NULL;
+ xmlNode *cur_node = NULL;
+ char *temp_content_string = NULL;
- if (input_node == NULL || input_result_buffer == NULL || input_exit_flag == NULL) {
- EM_DEBUG_EXCEPTION("EMAIL_ERROR_INVALID_PARAM");
- goto FINISH_OFF;
- }
+ if (input_node == NULL || input_result_buffer == NULL || input_exit_flag == NULL) {
+ EM_DEBUG_EXCEPTION("EMAIL_ERROR_INVALID_PARAM");
+ goto FINISH_OFF;
+ }
- for (cur_node = input_node; cur_node; cur_node = cur_node->next) {
+ for (cur_node = input_node; cur_node; cur_node = cur_node->next) {
if (cur_node->name && (strcasecmp((const char *)cur_node->name, "head") == 0 || strcasecmp((const char *)cur_node->name, "title") == 0))
continue;
@@ -3189,7 +3179,7 @@ static void emcore_get_content_string(xmlNode *input_node, char *input_result_bu
if (*input_exit_flag == 1)
break;
- }
+ }
FINISH_OFF:
@@ -3229,8 +3219,8 @@ int emcore_strip_HTML_tag(const char *input_html_file_path, char *input_encoding
if (EM_SAFE_STRCMP(input_encoding_type, "unknown") == 0)
encoding_type = utf_charset;
else if (input_encoding_type && (strcasecmp(input_encoding_type, "ks_c_5601-1987") == 0 ||
- strcasecmp(input_encoding_type, "ksc5601") == 0 ||
- strcasecmp(input_encoding_type, "cp949") == 0))
+ strcasecmp(input_encoding_type, "ksc5601") == 0 ||
+ strcasecmp(input_encoding_type, "cp949") == 0))
encoding_type = euc_kr_charset;
else
encoding_type = input_encoding_type;
@@ -3238,7 +3228,7 @@ int emcore_strip_HTML_tag(const char *input_html_file_path, char *input_encoding
EM_DEBUG_LOG("encoding_type [%s]", encoding_type);
LIBXML_TEST_VERSION
- xmlSetGenericErrorFunc(NULL, emcore_default_xml_error_handler);
+ xmlSetGenericErrorFunc(NULL, emcore_default_xml_error_handler);
result_html_document = htmlReadFile(input_html_file_path, encoding_type, HTML_PARSE_RECOVER | HTML_PARSE_NOWARNING | HTML_PARSE_NOERROR | HTML_PARSE_NONET | HTML_PARSE_NOBLANKS);
if (result_html_document == NULL) {
EM_DEBUG_EXCEPTION("htmlReadFile failed");
@@ -3255,9 +3245,8 @@ int emcore_strip_HTML_tag(const char *input_html_file_path, char *input_encoding
em_trim_left(output_result_buffer);
FINISH_OFF:
- if (result_html_document) {
+ if (result_html_document)
xmlFreeDoc(result_html_document);
- }
EM_SAFE_FREE(result_string);
@@ -3418,7 +3407,7 @@ INTERNAL_FUNC int emcore_clear_notifications(char *multi_user_name, int account_
goto FINISH_OFF;
}
- for(i = 0; i < account_count; i++) {
+ for (i = 0; i < account_count; i++) {
error_code = emcore_delete_notification_by_account(multi_user_name, account_list[i].account_id, true, false, false);
if (error_code != EMAIL_ERROR_NONE)
EM_DEBUG_EXCEPTION("emcore_delete_notification_by_account failed");
@@ -3430,15 +3419,14 @@ INTERNAL_FUNC int emcore_clear_notifications(char *multi_user_name, int account_
}
if (!emstorage_update_save_status(multi_user_name, account_id, &error_code)) {
- EM_DEBUG_EXCEPTION("emstorage_update_save_status failed : [%d]", error_code);
+ EM_DEBUG_EXCEPTION("emstorage_update_save_status failed : [%d]", error_code);
goto FINISH_OFF;
}
FINISH_OFF:
- if (account_count) {
+ if (account_count)
emstorage_free_account(&account_list, account_count, NULL);
- }
EM_DEBUG_FUNC_END("return[%d]", error_code);
return error_code;
@@ -3453,7 +3441,7 @@ INTERNAL_FUNC int emcore_delete_notification_by_account(char *multi_user_name, i
#ifdef __FEATURE_NOTIFICATION_ENABLE__
notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
- notification_h noti = NULL;
+ notification_h noti = NULL;
notification_h noti_to_be_deleted = NULL;
notification_list_h noti_list = NULL;
notification_list_h head_noti_list = NULL;
@@ -3489,9 +3477,9 @@ INTERNAL_FUNC int emcore_delete_notification_by_account(char *multi_user_name, i
if (account_id_str && (atoi(account_id_str) == account_id)) {
if (is_delete_new_mail_noti &&
- (!g_strcmp0(noti_type_str, __NOTI_NEW_MAIL_SINGLE) ||
- !g_strcmp0(noti_type_str, __NOTI_NEW_MAIL_MULTI) ||
- !g_strcmp0(noti_type_str, __NOTI_SENT))) {
+ (!g_strcmp0(noti_type_str, __NOTI_NEW_MAIL_SINGLE) ||
+ !g_strcmp0(noti_type_str, __NOTI_NEW_MAIL_MULTI) ||
+ !g_strcmp0(noti_type_str, __NOTI_SENT))) {
// normal notification
noti_to_be_deleted = noti;
} else if (is_delete_sending_noti && !g_strcmp0(noti_type_str, __NOTI_SENDING)) {
@@ -3531,13 +3519,13 @@ FINISH_OFF:
* @fn emcore_convert_to_uid_range_set(email_id_set_t* id_set, int id_set_count, email_uid_range_set **uid_range_set, int range_len, int *err_code)
* Prepare a linked list of uid ranges with each node having a uid_range and lowest and highest uid in it.
*
- *@author h.gahlaut@samsung.com
+ *@author h.gahlaut@samsung.com
* @param[in] id_set Specifies the array of mail_id and corresponding server_mail_id sorted by server_mail_ids in ascending order
* @param[in] id_set_count Specifies the no. of cells in id_set array i.e. no. of sets of mail_ids and server_mail_ids
* @param[in] range_len Specifies the maximum length of string of range allowed.
* @param[out] uid_range_set Returns the uid_ranges formed in the form of a linked list with head stored in uid_range_set pointer
* @param[out] err_code Returns the error code.
- * @remarks An example of a uid_range formed is 2:6,8,10,14:15,89,
+ * @remarks An example of a uid_range formed is 2:6,8,10,14:15,89,
* While using it the caller should remove the ending, (comma)
* @return This function returns true on success or false on failure.
*/
@@ -3611,8 +3599,8 @@ INTERNAL_FUNC int emcore_convert_to_uid_range_set(email_id_set_t *id_set, int id
} while (i < id_set_count);
/* Flow comes here in two cases :
- 1. id_set ended and has continuous numbers at end of id_set so form subset string by first_uid:last_uid . in this case last_uid == current_uid
- 2. due to break statement */
+ 1. id_set ended and has continuous numbers at end of id_set so form subset string by first_uid:last_uid . in this case last_uid == current_uid
+ 2. due to break statement */
if (last_uid == current_uid) {
/* Case 1 */
@@ -3690,7 +3678,7 @@ int emcore_append_subset_string_to_uid_range(char *subset_string, email_uid_rang
int len_sub_string = EM_SAFE_STRLEN(subset_string);
int space_left_in_buffer = range_len - EM_SAFE_STRLEN(current_node->uid_range);
- if ((len_sub_string + 1 + 1) <= space_left_in_buffer) /* 1 for comma + 1 for ending null character */ {
+ if ((len_sub_string + 1 + 1) <= space_left_in_buffer)/* 1 for comma + 1 for ending null character */ {
SNPRINTF(current_node->uid_range + EM_SAFE_STRLEN(current_node->uid_range), space_left_in_buffer, "%s,", subset_string);
current_node->highest_uid = huid;
} else {
@@ -3733,7 +3721,7 @@ int emcore_append_subset_string_to_uid_range(char *subset_string, email_uid_rang
* void emcore_free_uid_range_set(email_uid_range_set **uid_range_head)
* Frees the linked list of uid ranges
*
- * @author h.gahlaut@samsung.com
+ * @author h.gahlaut@samsung.com
* @param[in] uid_range_head Head pointer of linked list of uid ranges
* @remarks
* @return This function does not return anything.
@@ -3767,14 +3755,14 @@ void emcore_free_uid_range_set(email_uid_range_set **uid_range_set)
* @fn emcore_form_comma_separated_strings(int numbers[], int num_count, int max_string_len, char *** strings, int *string_count, int *err_code)
* Forms comma separated strings of a give max_string_len from an array of numbers
*
- * @author h.gahlaut@samsung.com
+ * @author h.gahlaut@samsung.com
* @param[in] numbers Specifies the array of numbers to be converted into comma separated strings.
* @param[in] num_count Specifies the count of numbers in numbers array.
* @param[in] max_string_len Specifies the maximum length of comma separated strings that are to be formed.
* @param[out] strings Returns the base address of a double dimension array which stores the strings.
* @param[out] string_count Returns the number of strings formed.
* @param[out] err_code Returns the error code.
- * @remarks If Input to the function is five numbers like 2755 2754 2748 2749 2750 and a given max_string_len is 20.
+ * @remarks If Input to the function is five numbers like 2755 2754 2748 2749 2750 and a given max_string_len is 20.
* Then this function will form two comma separated strings as follows -
* "2755, 2754, 2748"
* "2749, 2750"
@@ -3798,9 +3786,9 @@ INTERNAL_FUNC int emcore_form_comma_separated_strings(int numbers[], int num_cou
int len_of_string_formed = 0;
if (NULL == numbers || num_count <= 0 ||
- max_string_len < (MAX_INTEGER_LENGTH + 2) || NULL == strings || NULL == string_count) /* 32767, is the highest integer possible in string.This requires 7 bytes of storage in character type array (1 byte for ending NULL and 1 byte for ending comma) so max_string_len should not be less than worst case possible. */ {
+ max_string_len < (MAX_INTEGER_LENGTH + 2) || NULL == strings || NULL == string_count) /* 32767, is the highest integer possible in string.This requires 7 bytes of storage in character type array (1 byte for ending NULL and 1 byte for ending comma) so max_string_len should not be less than worst case possible. */ {
EM_DEBUG_EXCEPTION("Invalid Parameter numbers[%p] num_count [%d] max_string_len [%d] strings [%p] string_count[%p]",
- numbers, num_count, max_string_len, strings, string_count);
+ numbers, num_count, max_string_len, strings, string_count);
error = EMAIL_ERROR_INVALID_PARAM;
goto FINISH_OFF;
}
@@ -3889,7 +3877,7 @@ FINISH_OFF:
* @fn emcore_free_comma_separated_strings(char *** string_list, int *string_count)
* Frees the double dimensional array of strings.
*
- * @author h.gahlaut@samsung.com
+ * @author h.gahlaut@samsung.com
* @param[in] uid_range_head Address of base address of double dimensional array of strings.
* @param[in] string_count Address of variable holding the count of strings.
* @remarks
@@ -3944,11 +3932,11 @@ int emcore_make_attachment_file_name_with_extension(char *source_file_name, char
EM_DEBUG_LOG("Extension Exist in the Attachment [%s] ", extcheck);
else { /* No extension attached, So add the Extension based on the subtype */
if (sub_type) {
- if ((MAX_PATH + 1) < (strlen(sub_type) + 1)) {
- EM_DEBUG_EXCEPTION("Buffer overflow");
- err = EMAIL_ERROR_OUT_OF_MEMORY;
- goto FINISH_OFF;
- }
+ if ((MAX_PATH + 1) < (strlen(sub_type) + 1)) {
+ EM_DEBUG_EXCEPTION("Buffer overflow");
+ err = EMAIL_ERROR_OUT_OF_MEMORY;
+ goto FINISH_OFF;
+ }
EM_SAFE_STRNCAT(attachment_file_name, ".", MAX_PATH - EM_SAFE_STRLEN(attachment_file_name) - 1);
EM_SAFE_STRNCAT(attachment_file_name, sub_type, MAX_PATH - EM_SAFE_STRLEN(attachment_file_name) - 1);
@@ -4048,10 +4036,9 @@ INTERNAL_FUNC int emcore_get_next_activity_id(int *activity_id, int *err_code)
ret = true;
- FINISH_OFF:
- if (NULL != err_code) {
+FINISH_OFF:
+ if (NULL != err_code)
*err_code = err;
- }
return ret;
@@ -4212,12 +4199,12 @@ INTERNAL_FUNC int emcore_load_query_from_file(char *file_path, char ***query_arr
goto FINISH_OFF;
}
- buf[file_size] = '\0';
if (fread(buf, sizeof(char), file_size, fp) != file_size) {
EM_DEBUG_EXCEPTION("Get the data from file : failed");
error = EMAIL_ERROR_SYSTEM_FAILURE;
goto FINISH_OFF;
}
+ buf[file_size] = '\0';
result_vector = g_strsplit(buf, ";", -1);
if (!result_vector || g_strv_length(result_vector) <= 0) {
@@ -4259,9 +4246,8 @@ FINISH_OFF:
EM_SAFE_FREE(buf);
- if (result_vector) {
+ if (result_vector)
g_strfreev(result_vector);
- }
EM_DEBUG_FUNC_END("error:[%d]", error);
return error;
@@ -4442,9 +4428,8 @@ INTERNAL_FUNC int emcore_calc_next_time_to_sync(char *multi_user_name, int input
/* if current time is not in peak schedule */
if (next_time == 0) {
/* if normal sync schedule is set */
- if (account->check_interval) {
+ if (account->check_interval)
next_time = input_current_time + (account->check_interval * 60);
- }
}
emcore_get_next_peak_start_time(account, input_current_time, &next_peak_start_time);
@@ -4455,9 +4440,7 @@ INTERNAL_FUNC int emcore_calc_next_time_to_sync(char *multi_user_name, int input
if (next_time && (next_time < next_peak_start_time)) {
/* create an alarm to sync in check_interval */
result_time = next_time;
- }
- /* else check_interval is zero or next peak schedule start is close than next check_interval */
- else {
+ } else { /* else check_interval is zero or next peak schedule start is close than next check_interval */
result_time = next_peak_start_time;
}
}
@@ -4468,9 +4451,8 @@ INTERNAL_FUNC int emcore_calc_next_time_to_sync(char *multi_user_name, int input
FINISH_OFF:
- if (account) {
+ if (account)
emstorage_free_account(&account, 1, NULL);
- }
EM_DEBUG_FUNC_END("err[%d]", err);
return err;
@@ -4673,7 +4655,7 @@ typedef struct {
int account_id;
char *email_address;
char *subject;
- char *multi_user_name;
+ char *multi_user_name;
time_t date_time;
email_action_t action;
} set_contacts_log_internal_t;
@@ -4799,11 +4781,11 @@ FINISH_OFF:
}
int emcore_set_contacts_log(char *multi_user_name,
- int account_id,
- char *email_address,
- char *subject,
- time_t date_time,
- email_action_t action)
+ int account_id,
+ char *email_address,
+ char *subject,
+ time_t date_time,
+ email_action_t action)
{
/* arg shall be destroyed in emcore_set_contacts_log_internal */
set_contacts_log_internal_t *arg = em_malloc(sizeof(set_contacts_log_internal_t));
@@ -4818,7 +4800,7 @@ int emcore_set_contacts_log(char *multi_user_name,
arg->subject = EM_SAFE_STRDUP(subject);
arg->date_time = date_time;
arg->action = action;
- arg->multi_user_name = EM_SAFE_STRDUP(multi_user_name);
+ arg->multi_user_name = EM_SAFE_STRDUP(multi_user_name);
g_main_context_invoke(NULL, emcore_set_contacts_log_internal, arg);
@@ -4842,11 +4824,11 @@ INTERNAL_FUNC int emcore_set_sent_contacts_log(char *multi_user_name, emstorage_
for (p_addr = addr; p_addr; p_addr = p_addr->next) {
SNPRINTF(email_address, MAX_EMAIL_ADDRESS_LENGTH, "%s@%s", addr->mailbox, addr->host);
if ((err = emcore_set_contacts_log(multi_user_name,
- input_mail_data->account_id,
- email_address,
- input_mail_data->subject,
- input_mail_data->date_time,
- EMAIL_ACTION_SEND_MAIL)) != EMAIL_ERROR_NONE) {
+ input_mail_data->account_id,
+ email_address,
+ input_mail_data->subject,
+ input_mail_data->date_time,
+ EMAIL_ACTION_SEND_MAIL)) != EMAIL_ERROR_NONE) {
EM_DEBUG_EXCEPTION("emcore_set_contacts_log failed : [%d]", err);
goto FINISH_OFF;
}
@@ -4875,11 +4857,11 @@ INTERNAL_FUNC int emcore_set_received_contacts_log(char *multi_user_name, emstor
int err = EMAIL_ERROR_NONE;
if ((err = emcore_set_contacts_log(multi_user_name,
- input_mail_data->account_id,
- input_mail_data->email_address_sender,
- input_mail_data->subject,
- input_mail_data->date_time,
- EMAIL_ACTION_SYNC_HEADER)) != EMAIL_ERROR_NONE) {
+ input_mail_data->account_id,
+ input_mail_data->email_address_sender,
+ input_mail_data->subject,
+ input_mail_data->date_time,
+ EMAIL_ACTION_SYNC_HEADER)) != EMAIL_ERROR_NONE) {
EM_DEBUG_EXCEPTION("emcore_set_contacts_log failed [%d]", err);
}
@@ -4888,20 +4870,20 @@ INTERNAL_FUNC int emcore_set_received_contacts_log(char *multi_user_name, emstor
}
typedef struct _contacts_delete_data {
- int account_id;
- char *multi_user_name;
+ int account_id;
+ char *multi_user_name;
} contacts_delete_data;
gboolean emcore_delete_contacts_log_internal(void* arg)
{
EM_DEBUG_FUNC_BEGIN();
- contacts_delete_data *data = (contacts_delete_data *)arg;
+ contacts_delete_data *data = (contacts_delete_data *)arg;
int contacts_error = CONTACTS_ERROR_NONE;
void *join_zone = NULL;
- if (EM_SAFE_STRLEN(data->multi_user_name) > 0) {
+ if (EM_SAFE_STRLEN(data->multi_user_name) > 0) {
if (emcore_set_join_zone(data->multi_user_name, &join_zone) != EMAIL_ERROR_NONE) {
EM_DEBUG_EXCEPTION("emcore_set_join_zone failed");
return FALSE;
@@ -4909,16 +4891,16 @@ gboolean emcore_delete_contacts_log_internal(void* arg)
}
/* Delete record of the account id */
- if ((contacts_error = contacts_phone_log_delete(CONTACTS_PHONE_LOG_DELETE_BY_EMAIL_EXTRA_DATA1, data->account_id)) != CONTACTS_ERROR_NONE) {
+ contacts_error = contacts_phone_log_delete(CONTACTS_PHONE_LOG_DELETE_BY_EMAIL_EXTRA_DATA1, data->account_id);
+ if (contacts_error != CONTACTS_ERROR_NONE)
EM_DEBUG_EXCEPTION("contacts_phone_log_delete failed [%d]", contacts_error);
- }
-/* err = convert_contact_err_to_email_err(contacts_error); */
+ /* err = convert_contact_err_to_email_err(contacts_error); */
if (join_zone)
emcore_unset_join_zone(join_zone);
- EM_SAFE_FREE(data->multi_user_name);
- EM_SAFE_FREE(data);
+ EM_SAFE_FREE(data->multi_user_name);
+ EM_SAFE_FREE(data);
EM_DEBUG_FUNC_END();
return FALSE;
@@ -4926,16 +4908,16 @@ gboolean emcore_delete_contacts_log_internal(void* arg)
INTERNAL_FUNC int emcore_delete_contacts_log(char *multi_user_name, int account_id)
{
- contacts_delete_data *data = NULL;
+ contacts_delete_data *data = NULL;
- data = (contacts_delete_data *)em_malloc(sizeof(contacts_delete_data));
- if (data == NULL) {
- EM_DEBUG_EXCEPTION("em_mallocfailed");
- return EMAIL_ERROR_OUT_OF_MEMORY;
- }
+ data = (contacts_delete_data *)em_malloc(sizeof(contacts_delete_data));
+ if (data == NULL) {
+ EM_DEBUG_EXCEPTION("em_mallocfailed");
+ return EMAIL_ERROR_OUT_OF_MEMORY;
+ }
- data->account_id = account_id;
- data->multi_user_name = EM_SAFE_STRDUP(multi_user_name);
+ data->account_id = account_id;
+ data->multi_user_name = EM_SAFE_STRDUP(multi_user_name);
g_main_context_invoke(NULL, emcore_delete_contacts_log_internal, (void*) data);
@@ -4946,7 +4928,7 @@ INTERNAL_FUNC int emcore_get_mail_display_name(char *multi_user_name, char *emai
{
if (!email_address || !contact_display_name) {
EM_DEBUG_EXCEPTION("NULL_PARAM email_address[%p] contact_display_name[%p]",
- email_address, contact_display_name);
+ email_address, contact_display_name);
return EMAIL_ERROR_INVALID_PARAM;
}
@@ -4959,32 +4941,32 @@ INTERNAL_FUNC int emcore_get_mail_display_name(char *multi_user_name, char *emai
#endif
GDBusProxy* bproxy = g_dbus_proxy_new_for_bus_sync(G_BUS_TYPE_SESSION,
- G_DBUS_PROXY_FLAGS_NONE,
- NULL,
- EMAIL_SERVICE_NAME,
- EMAIL_SERVICE_PATH,
- EMAIL_SERVICE_NAME,
- NULL,
- &gerror);
+ G_DBUS_PROXY_FLAGS_NONE,
+ NULL,
+ EMAIL_SERVICE_NAME,
+ EMAIL_SERVICE_PATH,
+ EMAIL_SERVICE_NAME,
+ NULL,
+ &gerror);
if (!bproxy) {
EM_DEBUG_EXCEPTION("g_dbus_proxy_new_for_bus_sync error [%s]",
- gerror->message);
+ gerror->message);
ret = EMAIL_ERROR_IPC_PROTOCOL_FAILURE;
goto FINISH_OFF;
}
result = g_dbus_proxy_call_sync(bproxy,
- "GetDisplayName",
- g_variant_new("(ss)", email_address, multi_user_name),
- G_DBUS_CALL_FLAGS_NONE,
- -1,
- NULL,
- &gerror);
+ "GetDisplayName",
+ g_variant_new("(ss)", email_address, multi_user_name),
+ G_DBUS_CALL_FLAGS_NONE,
+ -1,
+ NULL,
+ &gerror);
if (!result) {
EM_DEBUG_EXCEPTION("g_dbus_proxy_call_sync 'GetDisplayName' error [%s]",
- gerror->message);
+ gerror->message);
ret = EMAIL_ERROR_IPC_PROTOCOL_FAILURE;
goto FINISH_OFF;
}
@@ -5010,8 +4992,8 @@ FINISH_OFF:
INTERNAL_FUNC int emcore_get_mail_display_name_internal(char *multi_user_name,
- char *email_address,
- char **contact_display_name)
+ char *email_address,
+ char **contact_display_name)
{
EM_DEBUG_FUNC_BEGIN_SEC("contact_name_value[%s], contact_display_name[%p]", email_address, contact_display_name);
@@ -5022,33 +5004,33 @@ INTERNAL_FUNC int emcore_get_mail_display_name_internal(char *multi_user_name,
/* Contact variable */
contacts_record_h record = NULL;
-/*
- if ((contact_err = contacts_connect_on_thread()) != CONTACTS_ERROR_NONE) {
- EM_DEBUG_EXCEPTION("Open connect service failed [%d]", contact_err);
- goto FINISH_OFF;
- }
-*/
+ /*
+ if ((contact_err = contacts_connect_on_thread()) != CONTACTS_ERROR_NONE) {
+ EM_DEBUG_EXCEPTION("Open connect service failed [%d]", contact_err);
+ goto FINISH_OFF;
+ }
+ */
if ((contact_err = emcore_search_contact_info_by_address(multi_user_name, _contacts_contact_email._uri, _contacts_contact_email.email, email_address, 1, &record)) != CONTACTS_ERROR_NONE) {
if (contact_err != CONTACTS_ERROR_NO_DATA) /* no matching record found */
EM_DEBUG_EXCEPTION("emcore_search_contact_info_by_address failed [%d]", contact_err);
goto FINISH_OFF;
}
-/*
- if ((contact_err = contacts_list_get_count(list, &list_count)) != CONTACTS_ERROR_NONE) {
- EM_DEBUG_EXCEPTION("contacts_list_get_count failed");
- goto FINISH_OFF;
- }
+ /*
+ if ((contact_err = contacts_list_get_count(list, &list_count)) != CONTACTS_ERROR_NONE) {
+ EM_DEBUG_EXCEPTION("contacts_list_get_count failed");
+ goto FINISH_OFF;
+ }
- if (list_count > 1) {
- EM_DEBUG_EXCEPTION("Duplicated contacts info");
- contact_err = CONTACTS_ERROR_INTERNAL;
- goto FINISH_OFF;
- } else if (list_count == 0) {
- EM_DEBUG_EXCEPTION("Not found contact info");
- contact_err = CONTACTS_ERROR_NO_DATA;
- goto FINISH_OFF;
- }
-*/
+ if (list_count > 1) {
+ EM_DEBUG_EXCEPTION("Duplicated contacts info");
+ contact_err = CONTACTS_ERROR_INTERNAL;
+ goto FINISH_OFF;
+ } else if (list_count == 0) {
+ EM_DEBUG_EXCEPTION("Not found contact info");
+ contact_err = CONTACTS_ERROR_NO_DATA;
+ goto FINISH_OFF;
+ }
+ */
if (contacts_record_get_str(record, _contacts_contact_email.display_name, &display) != CONTACTS_ERROR_NONE) {
EM_DEBUG_EXCEPTION("contacts_record_get_str failed");
@@ -5059,7 +5041,7 @@ INTERNAL_FUNC int emcore_get_mail_display_name_internal(char *multi_user_name,
FINISH_OFF:
-/* contacts_disconnect_on_thread(); */
+ /* contacts_disconnect_on_thread(); */
if (record != NULL)
contacts_record_destroy(record, false);
@@ -5084,16 +5066,15 @@ INTERNAL_FUNC int emcore_connect_contacts_service(char *multi_user_name)
void *join_zone = NULL;
- if (EM_SAFE_STRLEN(multi_user_name) > 0) {
+ if (EM_SAFE_STRLEN(multi_user_name) > 0) {
if ((err = emcore_set_join_zone(multi_user_name, &join_zone)) != EMAIL_ERROR_NONE) {
EM_DEBUG_EXCEPTION("emcore_set_join_zone failed : [%d]", err);
return err;
}
- }
+ }
- if ((contact_err = contacts_connect()) != CONTACTS_ERROR_NONE) {
+ if ((contact_err = contacts_connect()) != CONTACTS_ERROR_NONE)
EM_DEBUG_EXCEPTION("contacts_connect failed : [%d]", contact_err);
- }
err = convert_contact_err_to_email_err(contact_err);
@@ -5117,11 +5098,10 @@ INTERNAL_FUNC int emcore_disconnect_contacts_service(char *multi_user_name)
EM_DEBUG_EXCEPTION("emcore_set_join_zone failed : [%d]", err);
return err;
}
- }
+ }
- if ((contact_err = contacts_disconnect()) != CONTACTS_ERROR_NONE) {
+ if ((contact_err = contacts_disconnect()) != CONTACTS_ERROR_NONE)
EM_DEBUG_EXCEPTION("contacts_disconnect failed : [%d]", contact_err);
- }
err = convert_contact_err_to_email_err(contact_err);
@@ -5164,7 +5144,7 @@ INTERNAL_FUNC int emcore_check_blocking_mode(char *multi_user_name, char *sender
{
if (!sender_address || !blocking_status) {
EM_DEBUG_EXCEPTION("NULL_PARAM sender_address[%p] blocking_status[%p]",
- sender_address, blocking_status);
+ sender_address, blocking_status);
return EMAIL_ERROR_INVALID_PARAM;
}
@@ -5178,32 +5158,32 @@ INTERNAL_FUNC int emcore_check_blocking_mode(char *multi_user_name, char *sender
#endif
GDBusProxy* bproxy = g_dbus_proxy_new_for_bus_sync(G_BUS_TYPE_SESSION,
- G_DBUS_PROXY_FLAGS_NONE,
- NULL,
- EMAIL_SERVICE_NAME,
- EMAIL_SERVICE_PATH,
- EMAIL_SERVICE_NAME,
- NULL,
- &gerror);
+ G_DBUS_PROXY_FLAGS_NONE,
+ NULL,
+ EMAIL_SERVICE_NAME,
+ EMAIL_SERVICE_PATH,
+ EMAIL_SERVICE_NAME,
+ NULL,
+ &gerror);
if (!bproxy) {
EM_DEBUG_EXCEPTION("g_dbus_proxy_new_for_bus_sync error [%s]",
- gerror->message);
+ gerror->message);
ret = EMAIL_ERROR_IPC_PROTOCOL_FAILURE;
goto FINISH_OFF;
}
result = g_dbus_proxy_call_sync(bproxy,
- "CheckBlockingMode",
- g_variant_new("(ss)", sender_address, multi_user_name),
- G_DBUS_CALL_FLAGS_NONE,
- -1,
- NULL,
- &gerror);
+ "CheckBlockingMode",
+ g_variant_new("(ss)", sender_address, multi_user_name),
+ G_DBUS_CALL_FLAGS_NONE,
+ -1,
+ NULL,
+ &gerror);
if (!result) {
EM_DEBUG_EXCEPTION("g_dbus_proxy_call_sync 'CheckBlockingMode' error [%s]",
- gerror->message);
+ gerror->message);
ret = EMAIL_ERROR_IPC_PROTOCOL_FAILURE;
goto FINISH_OFF;
}
@@ -5234,9 +5214,8 @@ INTERNAL_FUNC int emcore_check_blocking_mode_internal(char *multi_user_name, cha
char *token = NULL;
contacts_record_h record = NULL;
- if (!blocking_mode_of_setting) {
+ if (!blocking_mode_of_setting)
return err;
- }
if (vconf_get_int(VCONFKEY_SETAPPL_BLOCKINGMODE_ALLOWED_CONTACT_TYPE, &allowed_contact_type) != 0) {
EM_DEBUG_EXCEPTION("vconf_get_int failed");
@@ -5244,12 +5223,12 @@ INTERNAL_FUNC int emcore_check_blocking_mode_internal(char *multi_user_name, cha
goto FINISH_OFF;
}
-/*
- if ((contact_error = contacts_connect_on_thread()) != CONTACTS_ERROR_NONE) {
- EM_DEBUG_EXCEPTION("Open connect service failed [%d]", contact_error);
- goto FINISH_OFF;
- }
-*/
+ /*
+ if ((contact_error = contacts_connect_on_thread()) != CONTACTS_ERROR_NONE) {
+ EM_DEBUG_EXCEPTION("Open connect service failed [%d]", contact_error);
+ goto FINISH_OFF;
+ }
+ */
switch (allowed_contact_type) {
case ALLOWED_CONTACT_TYPE_NONE:
EM_DEBUG_LOG("allowed_contact_type is none : bloacking all(notification)");
@@ -5328,9 +5307,9 @@ INTERNAL_FUNC int emcore_check_blocking_mode_internal(char *multi_user_name, cha
FINISH_OFF:
-/*
- contacts_disconnect_on_thread();
-*/
+ /*
+ contacts_disconnect_on_thread();
+ */
err = convert_contact_err_to_email_err(contact_error);
EM_SAFE_FREE(person_id_string);
@@ -5379,9 +5358,8 @@ INTERNAL_FUNC char *emcore_set_mime_entity(char *mime_path)
if (mime_entity != NULL && !searched)
searched = 1;
- if (searched) {
+ if (searched)
fprintf(fp_write, "%s", temp_buffer);
- }
}
}
@@ -5604,42 +5582,42 @@ INTERNAL_FUNC char *__em_get_month_in_string(int month)
char *mon = NULL;
switch (month) {
- case 0:
- mon = strdup("jan");
- break;
- case 1:
- mon = strdup("feb");
- break;
- case 2:
- mon = strdup("mar");
- break;
- case 3:
- mon = strdup("apr");
- break;
- case 4:
- mon = strdup("may");
- break;
- case 5:
- mon = strdup("jun");
- break;
- case 6:
- mon = strdup("jul");
- break;
- case 7:
- mon = strdup("aug");
- break;
- case 8:
- mon = strdup("sep");
- break;
- case 9:
- mon = strdup("oct");
- break;
- case 10:
- mon = strdup("nov");
- break;
- case 11:
- mon = strdup("dec");
- break;
+ case 0:
+ mon = strdup("jan");
+ break;
+ case 1:
+ mon = strdup("feb");
+ break;
+ case 2:
+ mon = strdup("mar");
+ break;
+ case 3:
+ mon = strdup("apr");
+ break;
+ case 4:
+ mon = strdup("may");
+ break;
+ case 5:
+ mon = strdup("jun");
+ break;
+ case 6:
+ mon = strdup("jul");
+ break;
+ case 7:
+ mon = strdup("aug");
+ break;
+ case 8:
+ mon = strdup("sep");
+ break;
+ case 9:
+ mon = strdup("oct");
+ break;
+ case 10:
+ mon = strdup("nov");
+ break;
+ case 11:
+ mon = strdup("dec");
+ break;
}
return mon;
}
diff --git a/test/testapp-mail.c b/test/testapp-mail.c
index 46f6339..9d4002f 100644
--- a/test/testapp-mail.c
+++ b/test/testapp-mail.c
@@ -547,11 +547,10 @@ static gboolean testapp_test_mail_send(int *result_mail_id)
testapp_print("Calling email_send_mail...\n");
- if (email_send_mail(added_mail_id, &handle) < 0) {
+ if (email_send_mail(added_mail_id, &handle) < 0)
testapp_print("Sending failed[%d]\n", err);
- } else {
+ else
testapp_print("Start sending. handle[%d]\n", handle);
- }
email_free_mail_data(&result_mail_data, 1);
}
@@ -692,7 +691,11 @@ static gboolean testapp_test_get_mail_list_ex()
testapp_print("email_get_mail_list_ex succeed.\n");
for (i = 0; i < result_mail_count; i++) {
- testapp_print("mail_id [%d], subject [%s], mailbox_type [%d] full_address_from [%s]\n", result_mail_list[i].mail_id, result_mail_list[i].subject, result_mail_list[i].mailbox_type, result_mail_list[i].full_address_from);
+ testapp_print("mail_id [%d], subject [%s], mailbox_type [%d] full_address_from [%s]\n",
+ result_mail_list[i].mail_id,
+ result_mail_list[i].subject,
+ result_mail_list[i].mailbox_type,
+ result_mail_list[i].full_address_from);
}
} else {
testapp_print("email_get_mail_list_ex failed.\n");
@@ -806,9 +809,8 @@ static gboolean testapp_test_update_mail_attribute()
mail_id_count = (mail_id_count < 5000) ? mail_id_count : 5000;
- if (mail_id_count > 0) {
+ if (mail_id_count > 0)
mail_id_array = malloc(sizeof(int) * mail_id_count);
- }
for (i = 0; i < mail_id_count; i++) {
testapp_print("\n > Enter mail id: ");
@@ -966,11 +968,10 @@ static gboolean testapp_test_send_read_receipt()
testapp_print("eamil_add_read_receipt returns receipt_mail_id [%d] - err[%d]\n", receipt_mail_id, err_code);
testapp_print("Calling email_send_mail...\n");
- if ((err_code = email_send_mail(receipt_mail_id, &handle)) != EMAIL_ERROR_NONE) {
+ if ((err_code = email_send_mail(receipt_mail_id, &handle)) != EMAIL_ERROR_NONE)
testapp_print("Sending failed[%d]\n", err_code);
- } else {
+ else
testapp_print("Start sending. handle[%d]\n", handle);
- }
return 0;
}
@@ -984,9 +985,8 @@ static gboolean testapp_test_delete_attachment()
if (0 >= scanf("%d", &attachment_id))
testapp_print("Invalid input. ");
- if ((err_code = email_delete_attachment(attachment_id)) != EMAIL_ERROR_NONE) {
+ if ((err_code = email_delete_attachment(attachment_id)) != EMAIL_ERROR_NONE)
testapp_print("email_delete_attachment failed[%d]\n", err_code);
- }
return 0;
}
@@ -1040,9 +1040,9 @@ static gboolean testapp_test_get_mail_list()
else
mail_list_pointer = &mail_list;
- if (is_for_thread_view == -2) {
+ if (is_for_thread_view == -2)
list_type = EMAIL_LIST_TYPE_LOCAL;
- } else if (is_for_thread_view == -1)
+ else if (is_for_thread_view == -1)
list_type = EMAIL_LIST_TYPE_THREAD;
else
list_type = EMAIL_LIST_TYPE_NORMAL;
@@ -1068,12 +1068,9 @@ static gboolean testapp_test_get_mail_list()
testapp_print(" >>> mailbox_type [ %d ] \n", mail_list[i].mailbox_type);
testapp_print(" >>> mail_id [ %d ] \n", mail_list[i].mail_id);
testapp_print(" >>> account_id [ %d ] \n", mail_list[i].account_id);
- if (mail_list[i].full_address_from != NULL)
- testapp_print(" >>> full_address_from [ %s ] \n", mail_list[i].full_address_from);
- if (mail_list[i].email_address_recipient != NULL)
- testapp_print(" >>> email_address_recipient [ %s ] \n", mail_list[i].email_address_recipient);
- if (mail_list[i].subject != NULL)
- testapp_print(" >>> subject [ %s ] \n", mail_list[i].subject);
+ testapp_print(" >>> full_address_from [ %s ] \n", mail_list[i].full_address_from);
+ testapp_print(" >>> email_address_recipient [ %s ] \n", mail_list[i].email_address_recipient);
+ testapp_print(" >>> subject [ %s ] \n", mail_list[i].subject);
testapp_print(" >>> body_download_status [ %d ] \n", mail_list[i].body_download_status);
temp_time_info = localtime(&mail_list[i].date_time);
testapp_print(" >>> date_time [ %d/%d/%d %d:%d:%d] \n",
@@ -1205,9 +1202,8 @@ static gboolean testapp_test_move_mails_to_mailbox_of_another_account()
mail_id_count = (mail_id_count < 5000) ? mail_id_count : 5000;
- if (mail_id_count > 0) {
+ if (mail_id_count > 0)
mail_id_array = malloc(sizeof(int) * mail_id_count);
- }
for (i = 0; i < mail_id_count; i++) {
testapp_print("\n > Enter mail id: ");
@@ -1225,9 +1221,10 @@ static gboolean copy_file(char *input_source_path, char *input_dest_path)
{
int childExitStatus;
pid_t pid;
- if (!input_source_path || !input_dest_path) {
+
+ if (!input_source_path || !input_dest_path)
return FALSE;
- }
+
testapp_print("copy_file started\n");
pid = fork();
@@ -1302,9 +1299,8 @@ static gboolean testapp_test_send_mail_with_downloading_attachment_of_original_m
original_mail_data->body_download_status = 1;
/* Set from address */
- if (!original_mail_data->full_address_from) {
+ if (!original_mail_data->full_address_from)
original_mail_data->full_address_from = strdup("<abc@abc.com>");
- }
/* Rewrite subject */
if (original_mail_data->subject) {
@@ -1506,11 +1502,10 @@ static gboolean testapp_test_schedule_sending_mail()
testapp_print("Calling email_schedule_sending_mail...\n");
- if (email_schedule_sending_mail(added_mail_id, time_to_send) < 0) {
+ if (email_schedule_sending_mail(added_mail_id, time_to_send) < 0)
testapp_print("email_schedule_sending_mail failed[%d]\n", err);
- } else {
+ else
testapp_print("Start sending. handle[%d]\n", handle);
- }
}
return TRUE;
@@ -1732,11 +1727,10 @@ static gboolean testapp_test_move_all_mails_to_mailbox()
testapp_print("Invalid input. ");
err = email_move_all_mails_to_mailbox(src_mailbox_id, dest_mailbox_id);
- if (err < 0) {
+ if (err < 0)
testapp_print("email_move_all_mails_to_mailbox failed: err[%d]\n", err);
- } else {
+ else
testapp_print("email_move_all_mails_to_mailbox suceeded\n");
- }
return false;
}
@@ -1790,11 +1784,10 @@ static gboolean testapp_test_db_test()
if (0 >= scanf("%s", bcc))
testapp_print("Invalid input. ");
- if (emstorage_test(NULL, mail_id, account_id, to, cc, bcc, &err) == true) {
+ if (emstorage_test(NULL, mail_id, account_id, to, cc, bcc, &err) == true)
testapp_print(">> Saving Succeeded\n");
- } else {
+ else
testapp_print(">> Saving Failed[%d]\n", err);
- }
free(to);
free(cc);
@@ -2129,9 +2122,9 @@ static gboolean testapp_test_search_mail_on_server()
search_filter_count++;
}
- if ((err_code = email_search_mail_on_server(account_id, mailbox_id, search_filter, search_filter_count, &handle)) != EMAIL_ERROR_NONE) {
+ err_code = email_search_mail_on_server(account_id, mailbox_id, search_filter, search_filter_count, &handle);
+ if (err_code != EMAIL_ERROR_NONE)
testapp_print("email_search_mail_on_server failed [%d]", err_code);
- }
testapp_print(" >>> testapp_test_search_mail_on_server : END \n");
return TRUE;
@@ -2622,11 +2615,10 @@ static gboolean testapp_test_send_mails_every_x_minutes()
if (added_mail_id) {
testapp_print("Calling email_schedule_sending_mail...\n");
- if (email_schedule_sending_mail(added_mail_id, time_to_send) < 0) {
+ if (email_schedule_sending_mail(added_mail_id, time_to_send) < 0)
testapp_print("email_schedule_sending_mail failed[%d]\n", err);
- } else {
+ else
testapp_print("Start sending. handle[%d]\n", handle);
- }
}
}