PROJECT(email-common C)
SET(SRCS-common
- ${PROJECT_COMMON_DIR}/src/email-debug.c
${PROJECT_COMMON_DIR}/src/email-engine.c
${PROJECT_COMMON_DIR}/src/email-html-converter.c
${PROJECT_COMMON_DIR}/src/email-utils.c
#define B0211_C 0xFA /* Core GUI Item BG gray color */
#define TRANSPARENT 0, 0, 0, 0
-#define COLOR_BACK_BTN 61, 185, 204, 255
#define COLOR_BLACK 0, 0, 0, 255
#define COLOR_WHITE 255, 255, 255, 255
#define COLOR_GRAY 245, 245, 242, 255
#define MAX_ACCOUNT_COUNT 10
/* define bundle key */
-#define EMAIL_BUNDLE_KEY_NEW_ACCOUNT_ID "NEW_ACCOUNT_ID"
#define EMAIL_BUNDLE_KEY_ACCOUNT_TYPE "ACCOUNT_TYPE"
#define EMAIL_BUNDLE_KEY_ACCOUNT_ID "ACCOUNT_ID"
#define EMAIL_BUNDLE_KEY_MAILBOX "MAILBOX_ID"
#define EMAIL_BUNDLE_KEY_VIEW_TYPE "VIEW_TYPE"
#define EMAIL_BUNDLE_KEY_RUN_TYPE "RUN_TYPE"
#define EMAIL_BUNDLE_KEY_MAIL_ID "MAIL_ID"
+//TODO This bundle gets in Viewer module but nobody set it. Can be removed after Viewer module refactoring
#define EMAIL_BUNDLE_KEY_FIRST_LANDSCAPE "bFirstLandscape"
#define EMAIL_BUNDLE_KEY_MSG "MSG"
#define EMAIL_BUNDLE_KEY_TO "TO"
#define EMAIL_BUNDLE_KEY_FILTER_OPERATION "filter_op"
#define EMAIL_BUNDLE_KEY_FILTER_MODE "filter_mode"
+//TODO This bundle gets in Filter module but it never set. It can be removed by Filter refactoring
#define EMAIL_BUNDLE_KEY_FILTER_ADDR "filter_addr"
/* define bundle value */
#define EMAIL_BUNDLE_VAL_ALL_ACCOUNT "ALL_ACCOUNT"
#define EMAIL_BUNDLE_VAL_SINGLE_ACCOUNT "SINGLE_ACCOUNT"
#define EMAIL_BUNDLE_VAL_PRIORITY_SENDER "PRIORITY_SENDER"
+//TODO This bundle gets in Account module but it never set. It can be removed by Account refactoring
#define EMAIL_BUNDLE_VAL_SCHEDULED_OUTBOX "SCHEDULED_OUTBOX"
#define EMAIL_BUNDLE_VAL_FILTER_INBOX "FILTER_INBOX"
#define EMAIL_BUNDLE_VAL_VIEWER_RESTORE_VIEW "VIEWER_RESTORE_VIEW"
#define EMAIL_BUNDLE_VAL_VIEWER_DESTROY_VIEW "VIEWER_DESTROY_VIEW"
-#define EMAIL_BUNDLE_VAL_FILTER_OPERATION_FILTER "filter_op_filter"
+//TODO This bundle checks in Filter module but it never set. It can be removed by Filter refactoring
#define EMAIL_BUNDLE_VAL_FILTER_OPERATION_BLOCK "filter_op_block"
#define EMAIL_BUNDLE_VAL_FILTER_OPERATION_PS "filter_op_priority_sender"
#undef debug_enter
#undef debug_leave
-#undef debug_time
#ifdef _DEBUG
#define debug_enter() do { debug_trace(" * Enter *"); } while (0)
#define debug_leave() do { debug_trace(" * Leave *"); } while (0)
-#define GET_FILE_NAME(p) \
- do { \
- char *f = __FILE__; \
- p = strrchr(f, '/'); \
- if (p) p++; \
- else p = f; \
- } while (0)
-
-#define debug_time() \
- do { \
- char *p = NULL; \
- GET_FILE_NAME(p); \
- email_time_elapsed_message(p, __FUNCTION__, __LINE__); \
- } while (0)
-
#else /* _DEBUG */
#define debug_trace(fmt, args...)
#define debug_enter()
#define debug_leave()
-#define debug_time()
#endif /* _DEBUG */
} \
} while (0)
-#define PROFILE_BEGIN(pfid)\
- unsigned int __prf_l1_##pfid = __LINE__;\
- struct timeval __prf_1_##pfid;\
- struct timeval __prf_2_##pfid;\
- do {\
- gettimeofday(&__prf_1_##pfid, 0);\
- debug_log("[%s:%s():#%u] * PROFILE (" #pfid ") BEGIN *",\
- (rindex(__FILE__, '/') ? rindex(__FILE__, '/')+1 : __FILE__),\
- __FUNCTION__,\
- __prf_l1_##pfid);\
- } while (0)
-
-#define PROFILE_END(pfid)\
- unsigned int __prf_l2_##pfid = __LINE__;\
- do {\
- gettimeofday(&__prf_2_##pfid, 0);\
- long __ds = __prf_2_##pfid.tv_sec - __prf_1_##pfid.tv_sec;\
- long __dm = __prf_2_##pfid.tv_usec - __prf_1_##pfid.tv_usec;\
- if (__dm < 0) { __ds--; __dm = 1000000 + __dm; }\
- debug_log("[%s:%s(): #%u ~ #%u] * PROFILE(" #pfid ") END * "\
- " %u.%06u seconds elapsed\n",\
- (rindex(__FILE__, '/') ? rindex(__FILE__, '/')+1 : __FILE__),\
- __FUNCTION__,\
- __prf_l1_##pfid,\
- __prf_l2_##pfid,\
- (unsigned int)(__ds),\
- (unsigned int)(__dm));\
- } while (0)
-
typedef enum {
EMAIL_DEBUG_CRITICAL = 0,
EMAIL_DEBUG_WARNING,
EMAIL_DEBUG_MAX
} EmailDebugType;
-EMAIL_API void email_debug_message(EmailDebugType type, const gchar *file_name, const gchar *func, gint line_number, const gchar *format, ...);
-EMAIL_API void email_time_elapsed_message(const gchar *file_name, const gchar *func, gint line_number);
-EMAIL_API void email_time_elapsed_reset(void);
-EMAIL_API void email_system_debug_initialize(void);
-EMAIL_API void email_system_debug_finalize(void);
-
G_END_DECLS
#endif /* _EMAIL_DEBUG_H_ */
#define TAG_LEN 50 /*tag for hightlight keyword <color=#ff0000>key</>*/
#define FROM_LEN 100
#define SUBJECT_LEN 100
-#define FOLDER_LEN 100
#define ADDR_LEN 320
#define RECIPIENT_LEN 100
EMAIL_API void email_engine_free_mailbox_info(email_mailbox_list_info_t **info);
/* See EmailMailboxInfo. */
-EMAIL_API int email_engine_get_enabled_mail_count(gint account_id, const gchar *folder_name, gint thread_id, int sort_type, bool thread_view);
-EMAIL_API void email_engine_get_mail_list_ex(gint account_id, const gchar *folder_name, gint thread_id, int start_index, int limit_count, const gchar *match, int sort_type, bool thread_view, int search_type, email_mail_list_item_t **mailbox_data, int *mail_count);
EMAIL_API void email_engine_free_mail_list(GList **list);
EMAIL_API guint email_engine_get_mail_list(int account_id, int mailbox_id, email_mail_list_item_t **mail_list, int *mail_count);
EMAIL_API guint email_engine_get_mail_list_count(gint account_id, const gchar *folder_name);
-EMAIL_API gboolean email_engine_get_mail_info(gint mail_id, gint account_id, const gchar *folder_name, email_mailbox_info_t *info);
EMAIL_API gboolean email_engine_sync_folder(gint account_id, int mailbox_id, int *handle);
EMAIL_API gboolean email_engine_sync_all_folder(gint account_id, int *handle1, int *handle2);
EMAIL_API void email_engine_stop_working(gint account_id, int handle);
-EMAIL_API gchar *email_engine_get_mail_sender(gint account_id, const gchar *folder_name, gint mail_id); /* g_free(). */
-EMAIL_API gchar *email_engine_get_mail_valid_sender(gint account_id, const gchar *folder_name, gint mail_id); /* g_free(). */
-EMAIL_API gchar *email_engine_get_mail_recipient(gint account_id, const gchar *folder_name, gint mail_id); /* g_free(). */
-EMAIL_API GList *email_engine_get_mail_sender_list(gint account_id, gint curr_account_id, const gchar *folder_name, gint mail_id);
EMAIL_API void email_engine_free_mail_sender_list(GList **list);
-EMAIL_API gboolean email_engine_check_lock(gint account_id, const gchar *folder_name, gint mail_id);
-EMAIL_API gboolean email_engine_set_lock_toggle(gint account_id, const gchar *folder_name, gint mail_id);
EMAIL_API gboolean email_engine_check_seen_mail(gint account_id, gint mail_id);
EMAIL_API gboolean email_engine_check_draft_mail(gint account_id, gint mail_id);
EMAIL_API int email_engine_check_body_download(int mail_id);
EMAIL_API gboolean email_engine_move_mail_list(gint account_id, const int mailbox_id, GList *id_list);
EMAIL_API gboolean email_engine_move_all_mail(gint account_id, int old_mailbox_id, int new_mailbox_id);
EMAIL_API gint email_engine_get_unread_mail_count(gint account_id, const gchar *folder_name);
-EMAIL_API gint email_engine_get_mail_status(gint account_id, const gchar *folder_name, gint mail_id);
-EMAIL_API gboolean email_engine_update_mail_status(gint account_id, const gchar *folder_name, gint mail_id, gint status);
-EMAIL_API gboolean email_engine_get_sending_status(gint account_id, const gchar *folder_name, gint mail_id);
EMAIL_API gchar *email_engine_get_attachment_path(gint attach_id); /* g_free(). */
-EMAIL_API gint email_engine_get_attachment_id(gint account_id, const gchar *folder_name, gint mail_id, gint index);
EMAIL_API gboolean email_engine_get_account_info(gint account_id, email_account_info_t **account_info);
EMAIL_API gboolean email_engine_set_account_info(gint account_id, email_account_info_t *account_info);
EMAIL_API void email_engine_free_account_info(email_account_info_t **account_info);
-EMAIL_API gchar *email_engine_get_mailbox_by_mail_id(gint mail_id);
EMAIL_API int email_engine_get_ca_mailbox_list(int account_id, email_mailbox_t **mailbox_list);
EMAIL_API void email_engine_free_ca_mailbox_list(email_mailbox_t **mailbox_list, int count);
EMAIL_API gchar *email_engine_convert_from_folder_to_srcbox(gint account_id, email_mailbox_type_e mailbox_type);
EMAIL_API GList *email_engine_get_ca_mailbox_list_using_glist(int account_id);
EMAIL_API void email_engine_free_ca_mailbox_list_using_glist(GList **mailbox_list);
EMAIL_API GList *email_engine_get_mail_list_data(email_mail_list_item_t *mailbox_data, int mail_count, const char *folder_name, const char *key);
-EMAIL_API email_mailbox_type_e email_engine_get_mailbox_type(int account_id, char *p_folder_name);
EMAIL_API gboolean email_engine_get_smtp_mail_size(gint account_id, int *handle);
EMAIL_API int email_engine_get_max_account_id(void);
x = NULL; \
} while (0)
-#undef UPDATE_HELP_OBJECT
-#define UPDATE_HELP_OBJECT(x, new_indicating_obj) \
- do { \
- if (x) { \
- email_update_help_obj(x, new_indicating_obj); \
- } \
- } while (0)
-
-#undef UPDATE_HELP_OBJECT_ITEM
-#define UPDATE_HELP_OBJECT_ITEM(x) \
- do { \
- if (x) { \
- email_update_help_obj_item(x); \
- } \
- } while (0)
-
-#undef SHOW_EVAS_OBJECT
-#define SHOW_EVAS_OBJECT(x) \
- do { \
- if (x) evas_object_show(x); \
- } while (0)
-
-#undef HIDE_EVAS_OBJECT
-#define HIDE_EVAS_OBJECT(x) \
- do { \
- if (x) evas_object_hide(x); \
- } while (0)
-
/*utf8 util*/
#define UTF8_VALIDATE(from, len) \
({\
EMAIL_API const char *email_get_phone_storage_url();
EMAIL_API const char *email_get_mmc_storage_url();
-EMAIL_API void email_set_group_order(int i, bool hide);
-EMAIL_API bool email_get_group_order(int i);
-
EMAIL_API email_network_status_e email_get_network_state(void);
EMAIL_API email_file_type_e email_get_file_type_from_mime_type(const char *mime_type);
EMAIL_API const char *email_get_icon_path_from_file_type(email_file_type_e ftype);
-EMAIL_API char *email_get_current_theme_name(void);
-
EMAIL_API gboolean email_check_dir_exist(const gchar *path);
-EMAIL_API gboolean email_check_hidden(const gchar *file);
EMAIL_API gboolean email_check_file_exist(const gchar *path);
-EMAIL_API gchar *email_parse_get_title_from_path(const gchar *path); /* g_free(). */
EMAIL_API gchar *email_parse_get_title_from_filename(const gchar *title); /* g_free(). */
EMAIL_API gchar *email_parse_get_filepath_from_path(const gchar *path); /* g_free(). */
EMAIL_API gchar *email_parse_get_ext_from_filename(const gchar *filename); /* g_free(). */
EMAIL_API gchar *email_parse_get_filename_from_path(const gchar *path); /* g_free(). */
-EMAIL_API gchar *email_parse_get_filenameext_from_path(const gchar *path); /* g_free(). */
EMAIL_API void email_parse_get_filename_n_ext_from_path(const gchar *path, gchar **ret_file_name, gchar **ret_ext);
-EMAIL_API gchar *email_get_temp_dirname(const gchar *tmp_folder_path);
EMAIL_API gboolean email_save_file(const gchar *path, const gchar *buf, gsize len);
EMAIL_API gchar *email_get_buff_from_file(const gchar *path, guint max_kbyte); /* g_free(). */
-EMAIL_API void email_dump_buff(const gchar *buff, const gchar *name);
EMAIL_API char *email_body_encoding_convert(char *text_content, char *from_charset, char *to_charset);
EMAIL_API gchar *email_get_file_size_string(guint64 size); /* g_free(). */
EMAIL_API guint64 email_get_file_size(const gchar *path);
EMAIL_API gboolean email_get_address_validation(const char *address);
EMAIL_API gboolean email_get_recipient_info(const gchar *_recipient, gchar **_nick, gchar **_addr);
-EMAIL_API gchar *email_get_sync_name_list(const gchar *recipient); /* g_free(). */
-EMAIL_API guint email_get_recipient_count(const gchar *recipient);
-EMAIL_API gchar *email_cut_text_by_char_len(const gchar *text, gint len); /* g_free(). */
EMAIL_API gchar *email_cut_text_by_byte_len(const gchar *text, gint len); /* g_free(). */
EMAIL_API char *email_get_str_datetime(const time_t time_val);
EMAIL_API char *email_get_date_text(const char *locale, char *skeleton, void *time);
EMAIL_API char *email_get_date_text_with_formatter(void *formatter, void *time);
-EMAIL_API int email_get_default_first_day_of_week();
-EMAIL_API bool email_time_isequal(time_t first_time_t, time_t second_time_t);
-EMAIL_API bool email_time_isbigger(time_t first_time_t, time_t second_time_t);
-EMAIL_API time_t email_convert_datetime(const char *datetime_str);
EMAIL_API char *email_get_timezone_str(void);
-EMAIL_API gint email_get_clock_time_zone(void);
-EMAIL_API gboolean email_get_day_light_saving(void);
-EMAIL_API gint email_get_time_revision(void);
-EMAIL_API int email_get_timezone_in_minutes(char *str);
EMAIL_API int email_create_folder(const char *path);
EMAIL_API gboolean email_copy_file_feedback(const char *src_full_path, const char *dest_full_path, gboolean(*copy_file_cb) (void *data, float percentage), void *cb_data);
EMAIL_API int email_register_accessibility_font_size_changed_callback(system_settings_changed_cb func, void *data);
EMAIL_API int email_unregister_accessibility_font_size_changed_callback(system_settings_changed_cb func);
-EMAIL_API void set_app_terminated();
-EMAIL_API int get_app_terminated();
-EMAIL_API void set_app_paused();
-EMAIL_API void reset_app_paused();
-EMAIL_API int get_app_paused();
-
EMAIL_API char *email_util_strrtrim(char *s);
EMAIL_API char *email_util_strltrim(char *s);
EMAIL_API char *email_util_strtrim(char *s);
EMAIL_API char *email_get_mime_type_from_file(const char *path);
EMAIL_API bool email_is_smime_cert_attachment(const char *mime_type);
-EMAIL_API bool email_is_encryption_cert_attachment(const char *mime_type);
-EMAIL_API bool email_is_signing_cert_attachment(const char *mime_type);
EMAIL_API int email_get_deleted_flag_mail_count(int account_id);
EMAIL_API int email_get_favourite_mail_count(bool unread_only);
EMAIL_API inline char *email_get_system_string(const char *string_id);
EMAIL_API inline char *email_get_email_string(const char *string_id);
-EMAIL_API void email_set_viewer_launched_on_mailbox_flag(bool value);
-EMAIL_API bool email_get_viewer_launched_on_mailbox_flag();
-
EMAIL_API Elm_Genlist_Item_Class* email_util_get_genlist_item_class(const char *style,
Elm_Gen_Item_Text_Get_Cb text_get,
Elm_Gen_Item_Content_Get_Cb content_get,
#include <unistd.h>
#include <string.h>
-#define email_trace_memory() \
- do { \
- char dev[1024] = "\0"; \
- pid_t pid = getpid(); \
- snprintf(dev, sizeof(dev), "/proc/%d/status", pid); \
- int fd = open(dev, O_RDONLY); \
- if (fd) { \
- int nread = 0; \
- char read_buf[1024] = "\0"; \
- while ((nread = read(fd, read_buf, sizeof(read_buf))) > 0) { \
- char *substr = strstr(read_buf, "VmRSS:"); \
- int i = 0; \
- for (i = 0; substr[i] != '\0'; ++i) { \
- if (substr[i] == '\n') { \
- break; \
- } \
- } \
- char buf[512] = "\0"; \
- strncpy(buf, substr, i); \
- buf[i + 1] = '\0'; \
- debug_warning("\t%s", buf); \
- } \
- close(fd); \
- } \
- } while (0)
-
typedef struct {
void *ug_data;
void *data;
+++ /dev/null
-/*
- * Copyright (c) 2009-2015 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#define _SYSTEM_DEBUG_ 1
-#define _USE_TIME_ELAPSED_ 0
-
-#include <sys/time.h>
-#include <time.h>
-#include <string.h>
-#include <glib.h>
-#include <glib/gprintf.h>
-#include <glib/gstdio.h>
-
-#if _SYSTEM_DEBUG_ == 1
-#include <dlog.h>
-#endif /* _SYSTEM_DEBUG_ */
-
-#include "email-debug.h"
-
-#define FG_RED 31
-#define FG_GREEN 32
-#define FG_YELLOW 33
-#define FG_MAGENTA 35
-#define FG_CYAN 36
-#define BG_BLACK 40
-
-#define email_debug_print(msg) \
-do { \
- printf("\x1b[%dm\x1b[%dm%s", BG_BLACK, FG_GREEN, msg); \
- printf("\x1b[0m\n"); \
-} while (0)
-
-#define email_assert_print(msg) \
-do { \
- printf("\x1b[%dm\x1b[%dm%s", BG_BLACK, FG_MAGENTA, msg); \
- printf("\x1b[0m\n"); \
-} while (0)
-
-#define email_time_print(msg) \
-do { \
- printf("\x1b[%dm\x1b[%dm%s", BG_BLACK, FG_CYAN, msg); \
- printf("\x1b[0m\n"); \
-} while (0)
-
-#define email_warning_print(msg) \
-do { \
- printf("\x1b[%dm\x1b[%dm%s", BG_BLACK, FG_YELLOW, msg); \
- printf("\x1b[0m\n"); \
-} while (0)
-
-#define email_critical_print(msg) \
-do { \
- printf("\x1b[%dm\x1b[%dm%s", BG_BLACK, FG_RED, msg); \
- printf("\x1b[0m\n"); \
-} while (0)
-
-#if _USE_TIME_ELAPSED_ == 1
-static double _g_start_time = 0;
-static double _g_old_time = 0;
-#endif /* _USE_TIME_ELAPSED_ */
-
-#if _SYSTEM_DEBUG_ == 1
-static void _debug_A(EmailDebugType type, const gchar *message)
-{
-#define MID_EMAIL (MID_MESSAGING + SET_IDENT(0))
-
- switch (type) {
- case EMAIL_DEBUG_CRITICAL:
- LOGW("%s", message);
- break;
- case EMAIL_DEBUG_WARNING:
- LOGI("%s", message);
- break;
- case EMAIL_DEBUG_EXPR:
- case EMAIL_DEBUG_TIME:
- case EMAIL_DEBUG_LOG:
- LOGD("%s", message);
- break;
- default:
- break;
- }
-
-}
-#else /* _SYSTEM_DEBUG_ */
-static void _debug_B(EmailDebugType type, const gchar *message)
-{
- switch (type) {
- case EMAIL_DEBUG_CRITICAL:
- email_critical_print(message);
- break;
- case EMAIL_DEBUG_WARNING:
- email_warning_print(message);
- break;
- case EMAIL_DEBUG_EXPR:
- email_assert_print(message);
- break;
- case EMAIL_DEBUG_TIME:
- email_time_print(message);
- break;
- case EMAIL_DEBUG_LOG:
- email_debug_print(message);
- break;
- default:
- break;
- }
-
-}
-#endif /* _SYSTEM_DEBUG_ */
-
-EMAIL_API void email_debug_message(EmailDebugType type, const gchar *file_name, const gchar *func, gint line_number, const gchar *format, ...)
-{
- va_list args;
- gchar msg_buf[1024] = "\0", buffer[2048] = "\0";
- const gchar *dbg_prefix = NULL;
-
- switch (type) {
- case EMAIL_DEBUG_CRITICAL:
- dbg_prefix = " * Critical * ";
- break;
- case EMAIL_DEBUG_WARNING:
- dbg_prefix = " * Warning * ";
- break;
- case EMAIL_DEBUG_EXPR:
- case EMAIL_DEBUG_TIME:
- case EMAIL_DEBUG_LOG:
- dbg_prefix = " ";
- break;
- default:
- break;
- }
-
- va_start(args, format);
- g_vsnprintf(msg_buf, sizeof(msg_buf), format, args);
-#if _SYSTEM_DEBUG_ == 1
- g_snprintf(buffer, sizeof(buffer), "[%s:%s:#%d]%s%s\n", file_name, func, line_number, dbg_prefix, msg_buf);
-#else /* _SYSTEM_DEBUG_ */
- g_snprintf(buffer, sizeof(buffer), "[%s:%s:#%d]%s%s", file_name, func, line_number, dbg_prefix, msg_buf);
-#endif /* _SYSTEM_DEBUG_ */
- va_end(args);
-
-#if _SYSTEM_DEBUG_ == 1
- _debug_A(type, buffer);
-#else /* _SYSTEM_DEBUG_ */
- _debug_B(type, buffer);
-#endif /* _SYSTEM_DEBUG_ */
-}
-
-EMAIL_API void email_time_elapsed_message(const gchar *file_name, const gchar *func, gint line_number)
-{
-#if _USE_TIME_ELAPSED_ == 1
- gchar message[512] = "\0";
- struct timeval tv;
- double new_time = 0;
- double elapsed = 0;
- double interval = 0;
-
- memset(&tv, 0, sizeof(struct timeval));
-
- gettimeofday(&tv, NULL);
-
- new_time = (double)(tv.tv_sec * 1000000 + tv.tv_usec);
-
- if (_g_start_time == 0) {
- _g_start_time = new_time;
- }
-
- if (_g_old_time == 0) {
- _g_old_time = new_time;
- }
-
- elapsed = (double)(new_time - _g_start_time) / CLOCKS_PER_SEC;
- interval = (double)(new_time - _g_old_time) / CLOCKS_PER_SEC;
-
- if (_g_old_time != new_time) {
- _g_old_time = new_time;
- }
-
- g_snprintf(message, sizeof(message), "elapsed (%lf) interval (%lf)", elapsed, interval);
-
- email_debug_message(EMAIL_DEBUG_TIME, file_name, func, line_number, message);
-#endif /* _USE_TIME_ELAPSED_ */
-}
-
-EMAIL_API void email_time_elapsed_reset(void)
-{
- debug_enter();
-
-#if _USE_TIME_ELAPSED_ == 1
- _g_start_time = 0;
- _g_old_time = 0;
-#endif /* _USE_TIME_ELAPSED_ */
-}
-
-/* EOF */
#define EMAIL_BUFF_SIZE_BIG 128
#define EMAIL_BUFF_SIZE_HUG 256
#define EMAIL_BUFF_SIZE_4K 4096
-static bool b_hide_status[EMAIL_STR_SIZE] = {'\0'};
EMAIL_API const char *locale = NULL;
static bool is_24_hr_format = false;
EMAIL_GROUP_MAX,
};
-
-static gint _g_time_rev_set = 0;
-static gint _g_time_rev = 0;
-static bool _g_viewer_launched_on_mailbox = false;
-
static struct info {
char res_dir[EMAIL_SMALL_PATH_MAX];
char data_dir[EMAIL_SMALL_PATH_MAX];
return result;
}
-EMAIL_API void email_set_group_order(int i, bool hide)
-{
- b_hide_status[i] = hide;
-}
-
-EMAIL_API bool email_get_group_order(int i)
-{
- return b_hide_status[i];
-}
-
EMAIL_API email_file_type_e email_get_file_type_from_mime_type(const char *mime_type)
{
debug_enter();
return buff;
}
-EMAIL_API char *email_get_current_theme_name(void)
-{
- char *theme_name = NULL;
- char *save_ptr = NULL;
-
- /* Get current theme path. Return value is a full path of theme file. ex) blue-hd:default */
- const char *current_theme_path = elm_theme_get(NULL);
- debug_secure("current_theme_path [%s]", current_theme_path);
-
- if (current_theme_path == NULL) {
- debug_log("current_theme_path is NULL !!");
- return NULL;
- }
-
- theme_name = strdup(current_theme_path);
- if (theme_name == NULL) {
- debug_log("theme_name is NULL !!");
- return NULL;
- }
-
- theme_name = strtok_r(theme_name, ":", &save_ptr);
- if (theme_name == NULL) {
- debug_log("theme_name is NULL !!");
- return NULL;
- }
-
- debug_secure("theme_name [%s]", theme_name);
-
- return theme_name;
-}
-
EMAIL_API gboolean email_check_file_exist(const gchar * path)
{
debug_enter();
return TRUE;
}
-EMAIL_API gboolean email_check_hidden(const gchar * file)
-{
- debug_enter();
- RETURN_VAL_IF_FAIL(STR_VALID(file), FALSE);
-
- if (file[0] == '.') {
- return TRUE;
- }
- return FALSE;
-}
-
-EMAIL_API gchar *email_parse_get_title_from_path(const gchar *path)
-{
- debug_enter();
- RETURN_VAL_IF_FAIL(STR_VALID(path), NULL);
-
- guint index = 0;
-
- gchar *file_path = g_strdup(path);
- file_path = g_strstrip(file_path);
- gchar **token_list = g_strsplit_set(file_path, "/", -1);
- g_free(file_path); /* MUST BE. */
-
- RETURN_VAL_IF_FAIL(token_list != NULL, NULL);
-
- while (token_list[index] != NULL) {
- index++;
- }
-
- gchar *file_name = g_strdup(token_list[index - 1]);
-
- g_strfreev(token_list); /* MUST BE. */
- token_list = NULL;
-
- if (file_name)
- token_list = g_strsplit_set(file_name, ".", -1);
-
- g_free(file_name); /* MUST BE. */
-
- RETURN_VAL_IF_FAIL(token_list != NULL, NULL);
-
- gchar *title = g_strdup(token_list[0]);
-
- g_strfreev(token_list); /* MUST BE. */
-
- debug_secure("title name: %s", title);
-
- return title;
-}
-
EMAIL_API gchar *email_parse_get_title_from_filename(const gchar *filename)
{
debug_enter();
return file_name_without_ext;
}
-EMAIL_API gchar *email_parse_get_filenameext_from_path(const gchar *path)
-{
- debug_enter();
- RETURN_VAL_IF_FAIL(STR_VALID(path), NULL);
-
- guint index = 0;
-
- gchar *file_path = g_strdup(path);
- file_path = g_strstrip(file_path);
- gchar **token_list = g_strsplit_set(file_path, "/", -1);
- g_free(file_path); /* MUST BE. */
-
- RETURN_VAL_IF_FAIL(token_list != NULL, NULL);
-
- while (token_list[index] != NULL) {
- index++;
- }
-
- gchar *file_name = g_strdup(token_list[index - 1]);
-
- g_strfreev(token_list); /* MUST BE. */
-
- debug_secure("file name (%s)", file_name);
-
- return file_name;
-}
-
EMAIL_API void email_parse_get_filename_n_ext_from_path(const gchar *path, gchar **ret_file_name, gchar **ret_ext)
{
debug_enter();
return ext;
}
-EMAIL_API gchar *email_get_temp_dirname(const gchar *tmp_folder_path)
-{
- debug_enter();
- debug_secure("tmp_folder_path (%s)", tmp_folder_path);
- pid_t pid = getpid();
- char *dirname = g_strdup_printf("%s/%d", tmp_folder_path, pid);
- debug_leave();
- return dirname;
-}
-
EMAIL_API gboolean email_save_file(const gchar *path, const gchar *buf, gsize len)
{
debug_enter();
return content;
}
-EMAIL_API void email_dump_buff(const gchar *buff, const gchar *name)
-{
- debug_enter();
- RETURN_IF_FAIL(STR_VALID(buff));
-
- tzset(); /* MUST BE. */
- time_t now = time(NULL);
- struct tm *t = localtime(&now);
- retm_if(!t, "localtime() - failed");
-
- gchar buff_path[MAX_PATH_LEN] = "\0";
-
- g_snprintf(buff_path, sizeof(buff_path), "%s/%04d.%02d.%02d[%02dH.%02dM.%02dS]_%s.html",
- email_get_phone_tmp_dir(),
- t->tm_year + 1900, t->tm_mon, t->tm_mday, t->tm_hour, t->tm_min, t->tm_sec, name);
- debug_secure("path [%s]", buff_path);
-
- gboolean result = email_save_file(buff_path, buff, STR_LEN((gchar *)buff));
- if (!result) {
- debug_log("email_save_file fail!");
- }
-}
-
EMAIL_API char *email_body_encoding_convert(char *text_content, char *from_charset, char *to_charset)
{
debug_enter();
return res;
}
-EMAIL_API gchar *email_get_sync_name_list(const gchar *recipient)
-{
-#define COMMA_S ","
-#define COMMA_C ','
- debug_enter();
- RETURN_VAL_IF_FAIL(STR_VALID(recipient), NULL);
-
- gchar *addr_list = g_strdup(recipient);
- gchar *stx = g_strdup_printf("%c", 0x02);
- const gchar etx = 0x03;
-
- /* removes leading & trailing spaces. */
- addr_list = g_strstrip(addr_list);
-
- gchar **token_list = g_strsplit_set(addr_list, stx, -1);
-
- if (addr_list != NULL) {
- g_free(addr_list);
- }
-
- g_free(stx);
-
- RETURN_VAL_IF_FAIL(token_list != NULL, NULL);
-
- gchar *sync_list = NULL;
- guint index = 1;
-
- while (token_list[index] != NULL) {
-
- gchar *token = strchr(token_list[index], etx);
-
- if (token != NULL && STR_LEN(token) > 1) {
-
- gchar *temp = sync_list;
-
- if (index == 1) {
- sync_list = g_strdup_printf("%s", token + 1);
- } else {
- sync_list = g_strdup_printf("%s%s", temp, token + 1);
- }
-
- if (temp != NULL) {
- g_free(temp); /* MUST BE. */
- }
- }
-
- index++;
- }
-
- g_strfreev(token_list); /* MUST BE. */
-
- return sync_list;
-}
-
-EMAIL_API guint email_get_recipient_count(const gchar *recipients)
-{
- debug_enter();
- RETURN_VAL_IF_FAIL(STR_VALID(recipients), 0);
-
- guint index = 0;
-
- gchar *addr_list = g_strdup(recipients);
-
- /* removes leading & trailing spaces. */
- addr_list = g_strstrip(addr_list);
-
- gchar **token_list = g_strsplit_set(addr_list, ",", -1);
-
- if (addr_list != NULL) {
- g_free(addr_list);
- }
-
- RETURN_VAL_IF_FAIL(token_list != NULL, 0);
-
- while (token_list[index] != NULL) {
- index++;
- }
-
- g_strfreev(token_list); /* MUST BE. */
-
- return index;
-}
-
-EMAIL_API gchar *email_cut_text_by_char_len(const gchar *text, gint len)
-{
- debug_enter();
- RETURN_VAL_IF_FAIL(STR_VALID(text), NULL);
- RETURN_VAL_IF_FAIL(len > 0, NULL);
-
- gchar *offset = g_utf8_offset_to_pointer(text, len);
- gchar *ret_text = (gchar *)g_malloc0(offset - text + 1);
-
- STR_NCPY(ret_text, (gchar *)text, offset - text);
-
- return ret_text;
-}
-
EMAIL_API gchar *email_cut_text_by_byte_len(const gchar *text, gint len)
{
debug_enter();
return ret_text;
}
-EMAIL_API int email_get_default_first_day_of_week()
-{
- i18n_error_code_e status = I18N_ERROR_NONE;
- i18n_uchar utf16_timezone[EMAIL_BUFF_SIZE_MID] = {0};
- char timezone[EMAIL_BUFF_SIZE_SML] = {'\0'};
- int first_day_of_week = 0, len = 0;
- int default_first_day_of_week = -1;
- char *locale_tmp = NULL;
-
- int res = system_settings_get_value_string(SYSTEM_SETTINGS_KEY_LOCALE_COUNTRY, &locale_tmp);
- if (res != SYSTEM_SETTINGS_ERROR_NONE || locale_tmp == NULL) {
- debug_critical("system_settings_get_value_string() failed. res = %d, local = %s", res, locale_tmp);
- FREE(locale_tmp);
- return default_first_day_of_week;
- }
-
- status = i18n_ulocale_set_default(locale_tmp);
- if (status != I18N_ERROR_NONE) {
- debug_critical("i18n_ulocale_set_default() failed: %d", status);
- FREE(locale_tmp);
- return default_first_day_of_week;
- }
-
- FREE(locale_tmp);
-
- i18n_ustring_copy_ua_n(utf16_timezone, timezone, sizeof(timezone));
- len = i18n_ustring_get_length(utf16_timezone);
-
- i18n_ucalendar_h cal = NULL;
- i18n_ucalendar_create(utf16_timezone, len, locale, I18N_UCALENDAR_TRADITIONAL, &cal);
- retvm_if(!cal, -1, "cal is null");
-
- i18n_ucalendar_get_attribute(cal, I18N_UCALENDAR_FIRST_DAY_OF_WEEK, &first_day_of_week);
-
- i18n_ucalendar_destroy(cal);
-
- return first_day_of_week - 1;
-}
-
-EMAIL_API bool email_time_isequal(time_t first_time_t, time_t second_time_t)
-{
- return first_time_t == second_time_t ? TRUE : FALSE;
-}
-
-EMAIL_API bool email_time_isbigger(time_t first_time_t, time_t second_time_t)
-{
- return first_time_t > second_time_t ? TRUE : FALSE;
-}
-
-EMAIL_API time_t email_convert_datetime(const char *datetime_str/* YYYYMMDDHHMMSS */)
-{
- debug_enter();
- RETURN_VAL_IF_FAIL(STR_VALID(datetime_str), -1);
-
- char buf[EMAIL_BUFF_SIZE_TIN] = "\0";
- struct tm t;
-
- memset(&t, 0, sizeof(struct tm));
-
- /* Year. */
- memset(buf, 0, sizeof(buf));
- snprintf(buf, sizeof(buf), "%.4s", datetime_str);
- t.tm_year = atoi(buf) - 1900;
-
- /* Month. */
- memset(buf, 0, sizeof(buf));
- snprintf(buf, sizeof(buf), "%.2s", datetime_str + 4);
- t.tm_mon = atoi(buf) - 1;
-
- /* Day. */
- memset(buf, 0, sizeof(buf));
- snprintf(buf, sizeof(buf), "%.2s", datetime_str + 6);
- t.tm_mday = atoi(buf);
-
- /* Hour. */
- memset(buf, 0, sizeof(buf));
- snprintf(buf, sizeof(buf), "%.2s", datetime_str + 8);
- t.tm_hour = atoi(buf);
-
- /* Minute. */
- memset(buf, 0, sizeof(buf));
- snprintf(buf, sizeof(buf), "%.2s", datetime_str + 10);
- t.tm_min = atoi(buf);
-
- /* Second. */
- memset(buf, 0, sizeof(buf));
- snprintf(buf, sizeof(buf), "%.2s", datetime_str + 12);
- t.tm_sec = atoi(buf);
-
- return mktime(&t) + email_get_time_revision();
-}
-
static int is_today(struct tm *req_tm, struct tm *now_tm)
{
if (req_tm->tm_year == now_tm->tm_year && req_tm->tm_yday == now_tm->tm_yday)
return g_strdup(buf + 20); /* Asia/Seoul */
}
-gint _email_get_default_clock_time_zone(void)
-{
- guint time_zone = email_get_timezone_in_minutes("+09");
- debug_secure("time_zone: %d", time_zone);
- return time_zone;
-}
-
-EMAIL_API gint email_get_clock_time_zone(void)
-{
- debug_enter();
- char *time_zone_str = NULL;
- char *display_name = NULL;
- guint time_zone = 0;
- i18n_timezone_h tzone = NULL;
-
- int res = system_settings_get_value_string(
- SYSTEM_SETTINGS_KEY_LOCALE_TIMEZONE,
- &time_zone_str);
-
- if (res != SYSTEM_SETTINGS_ERROR_NONE || time_zone_str == NULL) {
- debug_error("unable to get system timezone"
- "res = %d, timezone = %s", res, time_zone_str);
-
- FREE(time_zone_str);
- return _email_get_default_clock_time_zone();
- }
-
- debug_secure("timezone string: %s", time_zone_str);
-
- res = i18n_timezone_create(&tzone, time_zone_str);
- if (res != I18N_ERROR_NONE) {
- debug_error("failed to create timezone handler. res = %d", res);
- FREE(time_zone_str);
- return _email_get_default_clock_time_zone();
- }
-
- res = i18n_timezone_get_display_name_with_type(tzone,
- email_get_day_light_saving(),
- I18N_TIMEZONE_DISPLAY_TYPE_LONG_GMT,
- &display_name);
-
- if (res != I18N_ERROR_NONE || display_name == NULL) {
- debug_error("failed to get timezone display name. "
- "res = %d, display_name = %s", res, display_name);
- time_zone = _email_get_default_clock_time_zone();
- } else {
- char buf[MAX_STR_LEN] = {'\0'};
- snprintf(buf, MAX_STR_LEN, "%s", display_name + EMAIL_GMT_NAME_SIZE);
- time_zone = email_get_timezone_in_minutes(buf);
- debug_secure("time_zone: %d", time_zone);
- }
-
- i18n_timezone_destroy(tzone);
- FREE(display_name);
- FREE(time_zone_str);
-
- return time_zone;
-}
-
-EMAIL_API gboolean email_get_day_light_saving(void)
-{
- debug_enter();
- int dst = 0;
- struct tm *ts;
- time_t ctime;
-
- ctime = time(NULL);
- ts = localtime(&ctime);
-
- if (!ts) {
- return FALSE;
- }
-
- dst = ts->tm_isdst;
- debug_secure("day light saving is %d", dst);
-
- return (dst == 1 ? TRUE : FALSE);
-}
-
-EMAIL_API int email_get_timezone_in_minutes(char *str)
-{
- debug_enter();
- int sign = 1;
- int temp_int = 0;
- int i = 0;
-
- for (i = 0; i < strlen(str); ++i) {
- if (str[i] == ':') {
- str[i] = '.';
- break;
- }
- }
-
- double temp_float = atof(str);
- debug_log("temp_float: %f", temp_float);
- temp_float = temp_float * 10;
- temp_int = temp_float;
-
- if (temp_int > 0) {
- sign = 1;
- } else {
- sign = -1;
- }
-
- temp_int = temp_int * sign;
-
- if (temp_int % 10 != 0) {
- temp_int = temp_int / 10;
- return (sign * (60 * temp_int + 30));
- } else {
- temp_int = temp_int / 10;
- return (sign * 60 * temp_int);
- }
-}
-
-EMAIL_API gint email_get_time_revision(void)
-{
- debug_enter();
-
- if (_g_time_rev_set)
- return _g_time_rev;
-
- guint tz_val = email_get_clock_time_zone() * 60;
-
- gboolean dst_enabled = email_get_day_light_saving();
-
- guint dst = dst_enabled ? 3600 : 0;
-
- _g_time_rev_set = 1;
- _g_time_rev = tz_val + dst;
-
- return (tz_val + dst);
-}
-
EMAIL_API int email_create_folder(const char *path)
{
debug_enter();
return result;
}
-
-static int termination_flag = 0;
-static int pause_flag = 1;
-
-EMAIL_API void set_app_terminated()
-{
- termination_flag = 1;
-}
-
-EMAIL_API int get_app_terminated()
-{
- return termination_flag;
-}
-
-EMAIL_API void set_app_paused()
-{
- pause_flag = 1;
-}
-
-EMAIL_API void reset_app_paused()
-{
- pause_flag = 0;
-}
-
-EMAIL_API int get_app_paused()
-{
- return pause_flag;
-}
-
EMAIL_API char *email_util_strrtrim(char *s)
{
char *end = s + strlen(s);
return ret;
}
-EMAIL_API bool email_is_encryption_cert_attachment(const char *mime_type)
-{
- debug_enter();
-
- retvm_if(!mime_type, false, "Invalid parameter: mime_type is NULL!");
-
- bool ret = false;
-
- if (!g_ascii_strcasecmp(mime_type, EMAIL_MIME_TYPE_ENCRYPTED) ||
- !g_ascii_strcasecmp(mime_type, EMAIL_MIME_TYPE_ENCRYPTED_X)) {
- ret = true;
- }
-
- debug_leave();
- return ret;
-}
-
-EMAIL_API bool email_is_signing_cert_attachment(const char *mime_type)
-{
- debug_enter();
-
- retvm_if(!mime_type, false, "Invalid parameter: mime_type is NULL!");
-
- bool ret = false;
-
- if (!g_ascii_strcasecmp(mime_type, EMAIL_MIME_TYPE_SIGNED) ||
- !g_ascii_strcasecmp(mime_type, EMAIL_MIME_TYPE_SIGNED_X)) {
- ret = true;
- }
-
- debug_leave();
- return ret;
-}
-
EMAIL_API int email_get_deleted_flag_mail_count(int account_id)
{
debug_enter();
return ret;
}
-EMAIL_API void email_set_viewer_launched_on_mailbox_flag(bool value)
-{
- _g_viewer_launched_on_mailbox = value;
-}
-
-EMAIL_API bool email_get_viewer_launched_on_mailbox_flag()
-{
- return _g_viewer_launched_on_mailbox;
-}
-
EMAIL_API Elm_Genlist_Item_Class *email_util_get_genlist_item_class(const char *style,
Elm_Gen_Item_Text_Get_Cb text_get,
Elm_Gen_Item_Content_Get_Cb content_get,
{
debug_enter();
-
- if (get_app_terminated()) {
- debug_log("App is in terminating");
- return;
- }
debug_secure("Object path=%s, interface name=%s, signal name=%s", object_path, interface_name, signal_name);
EmailAccountUGD *ug_data = (EmailAccountUGD *)data;
{
debug_enter();
- if (get_app_terminated()) {
- debug_warning("App is in terminating");
- return;
- }
debug_secure("Object path=%s, interface name=%s, signal name=%s", object_path, interface_name, signal_name);
EmailMailboxUGD *mailbox_ugd = (EmailMailboxUGD *)data;
case NOTI_ACCOUNT_UPDATE:
/* DATA1[account_id] */
debug_log("NOTI_ACCOUNT_UPDATE (account_id:%d)", data1);
- if (get_app_paused()) {
- debug_log("account updated during pause status");
- }
break;
case NOTI_MAIL_UPDATE: